|
| 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 ConnectorSyncJob extends AbstractEndpoint |
| 30 | +{ |
| 31 | + /** |
| 32 | + * Cancels a connector sync job. |
| 33 | + * |
| 34 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cancel-connector-sync-job-api.html |
| 35 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 36 | + * |
| 37 | + * @param array{ |
| 38 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be canceled |
| 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 cancel(array $params = []) |
| 54 | + { |
| 55 | + $this->checkRequiredParameters(['connector_sync_job_id'], $params); |
| 56 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel'; |
| 57 | + $method = 'PUT'; |
| 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 | + * Checks in a connector sync job (refreshes 'last_seen'). |
| 69 | + * |
| 70 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html |
| 71 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 72 | + * |
| 73 | + * @param array{ |
| 74 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in |
| 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 checkIn(array $params = []) |
| 90 | + { |
| 91 | + $this->checkRequiredParameters(['connector_sync_job_id'], $params); |
| 92 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in'; |
| 93 | + $method = 'PUT'; |
| 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 | + * Deletes a connector sync job. |
| 105 | + * |
| 106 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html |
| 107 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 108 | + * |
| 109 | + * @param array{ |
| 110 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted. |
| 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 | + * } $params |
| 117 | + * |
| 118 | + * @throws MissingParameterException if a required parameter is missing |
| 119 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 120 | + * @throws ClientResponseException if the status code of response is 4xx |
| 121 | + * @throws ServerResponseException if the status code of response is 5xx |
| 122 | + * |
| 123 | + * @return Elasticsearch|Promise |
| 124 | + */ |
| 125 | + public function delete(array $params = []) |
| 126 | + { |
| 127 | + $this->checkRequiredParameters(['connector_sync_job_id'], $params); |
| 128 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); |
| 129 | + $method = 'DELETE'; |
| 130 | + |
| 131 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 132 | + $headers = [ |
| 133 | + 'Accept' => 'application/json', |
| 134 | + ]; |
| 135 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 136 | + } |
| 137 | + |
| 138 | + |
| 139 | + /** |
| 140 | + * Sets an error for a connector sync job. |
| 141 | + * |
| 142 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html |
| 143 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 144 | + * |
| 145 | + * @param array{ |
| 146 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for. |
| 147 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 148 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 149 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 150 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 151 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 152 | + * body: array, // (REQUIRED) The error to set in the connector sync job. |
| 153 | + * } $params |
| 154 | + * |
| 155 | + * @throws MissingParameterException if a required parameter is missing |
| 156 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 157 | + * @throws ClientResponseException if the status code of response is 4xx |
| 158 | + * @throws ServerResponseException if the status code of response is 5xx |
| 159 | + * |
| 160 | + * @return Elasticsearch|Promise |
| 161 | + */ |
| 162 | + public function error(array $params = []) |
| 163 | + { |
| 164 | + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); |
| 165 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error'; |
| 166 | + $method = 'PUT'; |
| 167 | + |
| 168 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 169 | + $headers = [ |
| 170 | + 'Accept' => 'application/json', |
| 171 | + 'Content-Type' => 'application/json', |
| 172 | + ]; |
| 173 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 174 | + } |
| 175 | + |
| 176 | + |
| 177 | + /** |
| 178 | + * Returns the details about a connector sync job. |
| 179 | + * |
| 180 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html |
| 181 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 182 | + * |
| 183 | + * @param array{ |
| 184 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned. |
| 185 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 186 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 187 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 188 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 189 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 190 | + * } $params |
| 191 | + * |
| 192 | + * @throws MissingParameterException if a required parameter is missing |
| 193 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 194 | + * @throws ClientResponseException if the status code of response is 4xx |
| 195 | + * @throws ServerResponseException if the status code of response is 5xx |
| 196 | + * |
| 197 | + * @return Elasticsearch|Promise |
| 198 | + */ |
| 199 | + public function get(array $params = []) |
| 200 | + { |
| 201 | + $this->checkRequiredParameters(['connector_sync_job_id'], $params); |
| 202 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']); |
| 203 | + $method = 'GET'; |
| 204 | + |
| 205 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 206 | + $headers = [ |
| 207 | + 'Accept' => 'application/json', |
| 208 | + ]; |
| 209 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 210 | + } |
| 211 | + |
| 212 | + |
| 213 | + /** |
| 214 | + * Lists all connector sync jobs. |
| 215 | + * |
| 216 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html |
| 217 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 218 | + * |
| 219 | + * @param array{ |
| 220 | + * from: int, // Starting offset (default: 0) |
| 221 | + * size: int, // specifies a max number of results to get (default: 100) |
| 222 | + * status: string, // Sync job status, which sync jobs are fetched for |
| 223 | + * connector_id: string, // Id of the connector to fetch the sync jobs for |
| 224 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 225 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 226 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 227 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 228 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 229 | + * } $params |
| 230 | + * |
| 231 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 232 | + * @throws ClientResponseException if the status code of response is 4xx |
| 233 | + * @throws ServerResponseException if the status code of response is 5xx |
| 234 | + * |
| 235 | + * @return Elasticsearch|Promise |
| 236 | + */ |
| 237 | + public function list(array $params = []) |
| 238 | + { |
| 239 | + $url = '/_connector/_sync_job'; |
| 240 | + $method = 'GET'; |
| 241 | + |
| 242 | + $url = $this->addQueryString($url, $params, ['from','size','status','connector_id','pretty','human','error_trace','source','filter_path']); |
| 243 | + $headers = [ |
| 244 | + 'Accept' => 'application/json', |
| 245 | + ]; |
| 246 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 247 | + } |
| 248 | + |
| 249 | + |
| 250 | + /** |
| 251 | + * Creates a connector sync job. |
| 252 | + * |
| 253 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html |
| 254 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 255 | + * |
| 256 | + * @param array{ |
| 257 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 258 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 259 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 260 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 261 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 262 | + * body: array, // (REQUIRED) The connector sync job data. |
| 263 | + * } $params |
| 264 | + * |
| 265 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 266 | + * @throws ClientResponseException if the status code of response is 4xx |
| 267 | + * @throws ServerResponseException if the status code of response is 5xx |
| 268 | + * |
| 269 | + * @return Elasticsearch|Promise |
| 270 | + */ |
| 271 | + public function post(array $params = []) |
| 272 | + { |
| 273 | + $this->checkRequiredParameters(['body'], $params); |
| 274 | + $url = '/_connector/_sync_job'; |
| 275 | + $method = 'POST'; |
| 276 | + |
| 277 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 278 | + $headers = [ |
| 279 | + 'Accept' => 'application/json', |
| 280 | + 'Content-Type' => 'application/json', |
| 281 | + ]; |
| 282 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 283 | + } |
| 284 | + |
| 285 | + |
| 286 | + /** |
| 287 | + * Updates the stats fields in the connector sync job document. |
| 288 | + * |
| 289 | + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html |
| 290 | + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release |
| 291 | + * |
| 292 | + * @param array{ |
| 293 | + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be updated. |
| 294 | + * pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false) |
| 295 | + * human: boolean, // Return human readable values for statistics. (DEFAULT: true) |
| 296 | + * error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false) |
| 297 | + * source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
| 298 | + * filter_path: list, // A comma-separated list of filters used to reduce the response. |
| 299 | + * body: array, // (REQUIRED) The stats to update for the connector sync job. |
| 300 | + * } $params |
| 301 | + * |
| 302 | + * @throws MissingParameterException if a required parameter is missing |
| 303 | + * @throws NoNodeAvailableException if all the hosts are offline |
| 304 | + * @throws ClientResponseException if the status code of response is 4xx |
| 305 | + * @throws ServerResponseException if the status code of response is 5xx |
| 306 | + * |
| 307 | + * @return Elasticsearch|Promise |
| 308 | + */ |
| 309 | + public function updateStats(array $params = []) |
| 310 | + { |
| 311 | + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); |
| 312 | + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats'; |
| 313 | + $method = 'PUT'; |
| 314 | + |
| 315 | + $url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']); |
| 316 | + $headers = [ |
| 317 | + 'Accept' => 'application/json', |
| 318 | + 'Content-Type' => 'application/json', |
| 319 | + ]; |
| 320 | + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); |
| 321 | + } |
| 322 | +} |
0 commit comments