|
| 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 ProjectRouting extends AbstractEndpoint |
| 30 | +{ |
| 31 | + /** |
| 32 | + * Create or update named project routing expression |
| 33 | + * |
| 34 | + * @group serverless |
| 35 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 36 | + * |
| 37 | + * @param array{ |
| 38 | + * name: string, // (REQUIRED) The name of the project routing expression |
| 39 | + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) |
| 40 | + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) |
| 41 | + * error_trace?: bool, // 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?: string|array<string>, // A comma-separated list of filters used to reduce the response. |
| 44 | + * body: string|array<mixed>, // (REQUIRED) Project routing expression to save. If body is a string must be a valid JSON. |
| 45 | + * } $params |
| 46 | + * |
| 47 | + * @throws MissingParameterException if a required parameter is missing |
| 48 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 49 | + * @throws ClientResponseException if the status code of response is 4xx |
| 50 | + * @throws ServerResponseException if the status code of response is 5xx |
| 51 | + * |
| 52 | + * @return Elasticsearch|Promise |
| 53 | + */ |
| 54 | + public function create(?array $params = null) |
| 55 | + { |
| 56 | + $params = $params ?? []; |
| 57 | + $this->checkRequiredParameters(['name','body'], $params); |
| 58 | + $url = '/_project_routing/' . $this->encode($params['name']); |
| 59 | + $method = 'PUT'; |
| 60 | + |
| 61 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 62 | + $headers = [ |
| 63 | + 'Accept' => 'application/json', |
| 64 | + 'Content-Type' => 'application/json', |
| 65 | + ]; |
| 66 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
| 67 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'project_routing.create'); |
| 68 | + return $this->client->sendRequest($request); |
| 69 | + } |
| 70 | + |
| 71 | + |
| 72 | + /** |
| 73 | + * Create or update named project routing expressions |
| 74 | + * |
| 75 | + * @group serverless |
| 76 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 77 | + * |
| 78 | + * @param array{ |
| 79 | + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) |
| 80 | + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) |
| 81 | + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) |
| 82 | + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 83 | + * filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response. |
| 84 | + * body: string|array<mixed>, // (REQUIRED) Project routing expressions to save. If body is a string must be a valid JSON. |
| 85 | + * } $params |
| 86 | + * |
| 87 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 88 | + * @throws ClientResponseException if the status code of response is 4xx |
| 89 | + * @throws ServerResponseException if the status code of response is 5xx |
| 90 | + * |
| 91 | + * @return Elasticsearch|Promise |
| 92 | + */ |
| 93 | + public function createMany(?array $params = null) |
| 94 | + { |
| 95 | + $params = $params ?? []; |
| 96 | + $this->checkRequiredParameters(['body'], $params); |
| 97 | + $url = '/_project_routing/'; |
| 98 | + $method = 'PUT'; |
| 99 | + |
| 100 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 101 | + $headers = [ |
| 102 | + 'Accept' => 'application/json', |
| 103 | + 'Content-Type' => 'application/json', |
| 104 | + ]; |
| 105 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
| 106 | + $request = $this->addOtelAttributes($params, [], $request, 'project_routing.create_many'); |
| 107 | + return $this->client->sendRequest($request); |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | + /** |
| 112 | + * Delete named project routing expression |
| 113 | + * |
| 114 | + * @group serverless |
| 115 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 116 | + * |
| 117 | + * @param array{ |
| 118 | + * name: string, // (REQUIRED) The name of the project routing expression |
| 119 | + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) |
| 120 | + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) |
| 121 | + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) |
| 122 | + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 123 | + * filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response. |
| 124 | + * } $params |
| 125 | + * |
| 126 | + * @throws MissingParameterException if a required parameter is missing |
| 127 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 128 | + * @throws ClientResponseException if the status code of response is 4xx |
| 129 | + * @throws ServerResponseException if the status code of response is 5xx |
| 130 | + * |
| 131 | + * @return Elasticsearch|Promise |
| 132 | + */ |
| 133 | + public function delete(?array $params = null) |
| 134 | + { |
| 135 | + $params = $params ?? []; |
| 136 | + $this->checkRequiredParameters(['name'], $params); |
| 137 | + $url = '/_project_routing/' . $this->encode($params['name']); |
| 138 | + $method = 'DELETE'; |
| 139 | + |
| 140 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 141 | + $headers = [ |
| 142 | + 'Accept' => 'application/json', |
| 143 | + 'Content-Type' => 'application/json', |
| 144 | + ]; |
| 145 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
| 146 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'project_routing.delete'); |
| 147 | + return $this->client->sendRequest($request); |
| 148 | + } |
| 149 | + |
| 150 | + |
| 151 | + /** |
| 152 | + * Get named project routing expression |
| 153 | + * |
| 154 | + * @group serverless |
| 155 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 156 | + * |
| 157 | + * @param array{ |
| 158 | + * name: string, // (REQUIRED) The name of the project routing expression |
| 159 | + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) |
| 160 | + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) |
| 161 | + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) |
| 162 | + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 163 | + * filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response. |
| 164 | + * } $params |
| 165 | + * |
| 166 | + * @throws MissingParameterException if a required parameter is missing |
| 167 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 168 | + * @throws ClientResponseException if the status code of response is 4xx |
| 169 | + * @throws ServerResponseException if the status code of response is 5xx |
| 170 | + * |
| 171 | + * @return Elasticsearch|Promise |
| 172 | + */ |
| 173 | + public function get(?array $params = null) |
| 174 | + { |
| 175 | + $params = $params ?? []; |
| 176 | + $this->checkRequiredParameters(['name'], $params); |
| 177 | + $url = '/_project_routing/' . $this->encode($params['name']); |
| 178 | + $method = 'GET'; |
| 179 | + |
| 180 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 181 | + $headers = [ |
| 182 | + 'Accept' => 'application/json', |
| 183 | + 'Content-Type' => 'application/json', |
| 184 | + ]; |
| 185 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
| 186 | + $request = $this->addOtelAttributes($params, ['name'], $request, 'project_routing.get'); |
| 187 | + return $this->client->sendRequest($request); |
| 188 | + } |
| 189 | + |
| 190 | + |
| 191 | + /** |
| 192 | + * Get named project routing expressions |
| 193 | + * |
| 194 | + * @group serverless |
| 195 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 196 | + * |
| 197 | + * @param array{ |
| 198 | + * pretty?: bool, // Pretty format the returned JSON response. (DEFAULT: false) |
| 199 | + * human?: bool, // Return human readable values for statistics. (DEFAULT: true) |
| 200 | + * error_trace?: bool, // Include the stack trace of returned errors. (DEFAULT: false) |
| 201 | + * source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 202 | + * filter_path?: string|array<string>, // A comma-separated list of filters used to reduce the response. |
| 203 | + * } $params |
| 204 | + * |
| 205 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 206 | + * @throws ClientResponseException if the status code of response is 4xx |
| 207 | + * @throws ServerResponseException if the status code of response is 5xx |
| 208 | + * |
| 209 | + * @return Elasticsearch|Promise |
| 210 | + */ |
| 211 | + public function getMany(?array $params = null) |
| 212 | + { |
| 213 | + $params = $params ?? []; |
| 214 | + $url = '/_project_routing/'; |
| 215 | + $method = 'GET'; |
| 216 | + |
| 217 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 218 | + $headers = [ |
| 219 | + 'Accept' => 'application/json', |
| 220 | + 'Content-Type' => 'application/json', |
| 221 | + ]; |
| 222 | + $request = $this->createRequest($method, $url, $headers, $params['body'] ?? null); |
| 223 | + $request = $this->addOtelAttributes($params, [], $request, 'project_routing.get_many'); |
| 224 | + return $this->client->sendRequest($request); |
| 225 | + } |
| 226 | +} |
0 commit comments