diff --git a/src/Endpoints/Connector.php b/src/Endpoints/Connector.php new file mode 100644 index 000000000..fbd8fcd44 --- /dev/null +++ b/src/Endpoints/Connector.php @@ -0,0 +1,512 @@ +checkRequiredParameters(['connector_id'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_check_in'; + $method = 'PUT'; + + $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)); + } + + + /** + * Deletes a connector. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be deleted. + * 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(['connector_id'], $params); + $url = '/_connector/' . $this->encode($params['connector_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 connector. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be returned. + * 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(['connector_id'], $params); + $url = '/_connector/' . $this->encode($params['connector_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)); + } + + + /** + * Updates the stats of last sync in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-last-sync-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) Object with stats related to the last connector sync run. + * } $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 lastSync(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_last_sync'; + $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)); + } + + + /** + * Lists all connectors. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * from: int, // Starting offset (default: 0) + * size: int, // specifies a max number of results to get (default: 100) + * 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 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 list(array $params = []) + { + $url = '/_connector'; + $method = 'GET'; + + $url = $this->addQueryString($url, $params, ['from','size','pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); + } + + + /** + * Creates a connector. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * 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 connector configuration. + * } $params + * + * @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 post(array $params = []) + { + $this->checkRequiredParameters(['body'], $params); + $url = '/_connector'; + $method = 'POST'; + + $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)); + } + + + /** + * Creates or updates a connector. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector 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 connector configuration. + * } $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(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_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)); + } + + + /** + * Updates the connector configuration. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-configuration-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) Mapping between field names to configuration. + * } $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 updateConfiguration(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_configuration'; + $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)); + } + + + /** + * Updates the error field in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-error-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) An object containing the connector's error. + * } $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 updateError(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_error'; + $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)); + } + + + /** + * Updates the filtering field in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-filtering-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) A list of connector filtering configurations. + * } $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 updateFiltering(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_filtering'; + $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)); + } + + + /** + * Updates the name and/or description fields in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-name-description-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) An object containing the connector's name and/or description. + * } $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 updateName(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_name'; + $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)); + } + + + /** + * Updates the pipeline field in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-pipeline-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) An object with connector ingest pipeline configuration. + * } $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 updatePipeline(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_pipeline'; + $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)); + } + + + /** + * Updates the scheduling field in the connector document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/update-connector-scheduling-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_id: string, // (REQUIRED) The unique identifier of the connector to be 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) An object containing the connector's scheduling configuration. + * } $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 updateScheduling(array $params = []) + { + $this->checkRequiredParameters(['connector_id','body'], $params); + $url = '/_connector/' . $this->encode($params['connector_id']) . '/_scheduling'; + $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)); + } +} diff --git a/src/Endpoints/ConnectorSyncJob.php b/src/Endpoints/ConnectorSyncJob.php new file mode 100644 index 000000000..7d05fd64c --- /dev/null +++ b/src/Endpoints/ConnectorSyncJob.php @@ -0,0 +1,322 @@ +checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_cancel'; + $method = 'PUT'; + + $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)); + } + + + /** + * Checks in a connector sync job (refreshes 'last_seen'). + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/check-in-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be checked in + * 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 checkIn(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_check_in'; + $method = 'PUT'; + + $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)); + } + + + /** + * Deletes a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be deleted. + * 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(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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)); + } + + + /** + * Sets an error for a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-error-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to set an error for. + * 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 error to set in the connector sync job. + * } $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 error(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_error'; + $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)); + } + + + /** + * Returns the details about a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be returned. + * 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(['connector_sync_job_id'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_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)); + } + + + /** + * Lists all connector sync jobs. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/list-connector-sync-jobs-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * from: int, // Starting offset (default: 0) + * size: int, // specifies a max number of results to get (default: 100) + * status: string, // Sync job status, which sync jobs are fetched for + * connector_id: string, // Id of the connector to fetch the sync jobs for + * 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 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 list(array $params = []) + { + $url = '/_connector/_sync_job'; + $method = 'GET'; + + $url = $this->addQueryString($url, $params, ['from','size','status','connector_id','pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); + } + + + /** + * Creates a connector sync job. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-sync-job-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * 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 connector sync job data. + * } $params + * + * @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 post(array $params = []) + { + $this->checkRequiredParameters(['body'], $params); + $url = '/_connector/_sync_job'; + $method = 'POST'; + + $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)); + } + + + /** + * Updates the stats fields in the connector sync job document. + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html + * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + * @param array{ + * connector_sync_job_id: string, // (REQUIRED) The unique identifier of the connector sync job to be 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 stats to update for the connector sync job. + * } $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 updateStats(array $params = []) + { + $this->checkRequiredParameters(['connector_sync_job_id','body'], $params); + $url = '/_connector/_sync_job/' . $this->encode($params['connector_sync_job_id']) . '/_stats'; + $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)); + } +} diff --git a/src/Endpoints/Indices.php b/src/Endpoints/Indices.php index a1c2fab40..4614144d7 100644 --- a/src/Endpoints/Indices.php +++ b/src/Endpoints/Indices.php @@ -1684,6 +1684,7 @@ public function putMapping(array $params = []) * master_timeout: time, // Specify timeout for connection to master * timeout: time, // Explicit operation timeout * preserve_existing: boolean, // Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` + * reopen: boolean, // Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false` * ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed) * allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * expand_wildcards: enum, // Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -1712,7 +1713,7 @@ public function putSettings(array $params = []) $url = '/_settings'; $method = 'PUT'; } - $url = $this->addQueryString($url, $params, ['master_timeout','timeout','preserve_existing','ignore_unavailable','allow_no_indices','expand_wildcards','flat_settings','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['master_timeout','timeout','preserve_existing','reopen','ignore_unavailable','allow_no_indices','expand_wildcards','flat_settings','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', diff --git a/src/Endpoints/Profiling.php b/src/Endpoints/Profiling.php new file mode 100644 index 000000000..ed7c3d2e7 --- /dev/null +++ b/src/Endpoints/Profiling.php @@ -0,0 +1,64 @@ +addQueryString($url, $params, ['master_timeout','timeout','wait_for_resources_created','pretty','human','error_trace','source','filter_path']); + $headers = [ + 'Accept' => 'application/json', + ]; + return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); + } +} diff --git a/src/Endpoints/SearchApplication.php b/src/Endpoints/SearchApplication.php index 8c97fc26a..6a282f7fc 100644 --- a/src/Endpoints/SearchApplication.php +++ b/src/Endpoints/SearchApplication.php @@ -213,6 +213,7 @@ public function list(array $params = []) /** * Creates a behavioral analytics event for existing collection. * + * @see http://todo.com/tbd * @internal This API is EXPERIMENTAL and may be changed or removed completely in a future release * * @param array{ diff --git a/src/Endpoints/Security.php b/src/Endpoints/Security.php index 8c7536587..2d148e9d8 100644 --- a/src/Endpoints/Security.php +++ b/src/Endpoints/Security.php @@ -867,6 +867,7 @@ public function enrollNode(array $params = []) * realm_name: string, // realm name of the user who created this API key to be retrieved * owner: boolean, // flag to query API keys owned by the currently authenticated user * with_limited_by: boolean, // flag to show the limited-by role descriptors of API Keys + * active_only: boolean, // flag to limit response to only active (not invalidated or expired) API keys * 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) @@ -885,7 +886,7 @@ public function getApiKey(array $params = []) $url = '/_security/api_key'; $method = 'GET'; - $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['id','name','username','realm_name','owner','with_limited_by','active_only','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', ]; diff --git a/src/Endpoints/Simulate.php b/src/Endpoints/Simulate.php new file mode 100644 index 000000000..cded13a69 --- /dev/null +++ b/src/Endpoints/Simulate.php @@ -0,0 +1,71 @@ +checkRequiredParameters(['body'], $params); + if (isset($params['index'])) { + $url = '/_ingest/' . $this->encode($params['index']) . '/_simulate'; + $method = empty($params['body']) ? 'GET' : 'POST'; + } else { + $url = '/_ingest/_simulate'; + $method = empty($params['body']) ? 'GET' : 'POST'; + } + $url = $this->addQueryString($url, $params, ['pipeline','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)); + } +} diff --git a/src/Traits/ClientEndpointsTrait.php b/src/Traits/ClientEndpointsTrait.php index dd09540e7..c4b55beed 100644 --- a/src/Traits/ClientEndpointsTrait.php +++ b/src/Traits/ClientEndpointsTrait.php @@ -45,6 +45,7 @@ trait ClientEndpointsTrait * _source_includes: list, // Default list of fields to extract and return from the _source field, can be overridden on each sub-request * pipeline: string, // The pipeline id to preprocess incoming documents with * require_alias: boolean, // Sets require_alias for all incoming documents. Defaults to unset (false) + * list_executed_pipelines: boolean, // Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) * 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) @@ -69,7 +70,7 @@ public function bulk(array $params = []) $url = '/_bulk'; $method = 'POST'; } - $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','pretty','human','error_trace','source','filter_path']); + $url = $this->addQueryString($url, $params, ['wait_for_active_shards','refresh','routing','timeout','type','_source','_source_excludes','_source_includes','pipeline','require_alias','list_executed_pipelines','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/x-ndjson', @@ -1186,6 +1187,7 @@ public function mtermvectors(array $params = []) * 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, // An index_filter specified with the Query DSL * } $params * * @throws MissingParameterException if a required parameter is missing @@ -1204,6 +1206,7 @@ public function openPointInTime(array $params = []) $url = $this->addQueryString($url, $params, ['preference','routing','ignore_unavailable','expand_wildcards','keep_alive','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', + 'Content-Type' => 'application/json', ]; return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } diff --git a/src/Traits/NamespaceTrait.php b/src/Traits/NamespaceTrait.php index 857f7ace8..5278536b9 100644 --- a/src/Traits/NamespaceTrait.php +++ b/src/Traits/NamespaceTrait.php @@ -21,6 +21,8 @@ use Elastic\Elasticsearch\Endpoints\Cat; use Elastic\Elasticsearch\Endpoints\Ccr; use Elastic\Elasticsearch\Endpoints\Cluster; +use Elastic\Elasticsearch\Endpoints\Connector; +use Elastic\Elasticsearch\Endpoints\ConnectorSyncJob; use Elastic\Elasticsearch\Endpoints\DanglingIndices; use Elastic\Elasticsearch\Endpoints\Enrich; use Elastic\Elasticsearch\Endpoints\Eql; @@ -38,12 +40,14 @@ use Elastic\Elasticsearch\Endpoints\Ml; use Elastic\Elasticsearch\Endpoints\Monitoring; use Elastic\Elasticsearch\Endpoints\Nodes; +use Elastic\Elasticsearch\Endpoints\Profiling; use Elastic\Elasticsearch\Endpoints\QueryRuleset; use Elastic\Elasticsearch\Endpoints\Rollup; use Elastic\Elasticsearch\Endpoints\SearchApplication; use Elastic\Elasticsearch\Endpoints\SearchableSnapshots; use Elastic\Elasticsearch\Endpoints\Security; use Elastic\Elasticsearch\Endpoints\Shutdown; +use Elastic\Elasticsearch\Endpoints\Simulate; use Elastic\Elasticsearch\Endpoints\Slm; use Elastic\Elasticsearch\Endpoints\Snapshot; use Elastic\Elasticsearch\Endpoints\Sql; @@ -109,6 +113,24 @@ public function cluster(): Cluster } + public function connector(): Connector + { + if (!isset($this->namespace['Connector'])) { + $this->namespace['Connector'] = new Connector($this); + } + return $this->namespace['Connector']; + } + + + public function connectorSyncJob(): ConnectorSyncJob + { + if (!isset($this->namespace['ConnectorSyncJob'])) { + $this->namespace['ConnectorSyncJob'] = new ConnectorSyncJob($this); + } + return $this->namespace['ConnectorSyncJob']; + } + + public function danglingIndices(): DanglingIndices { if (!isset($this->namespace['DanglingIndices'])) { @@ -262,6 +284,15 @@ public function nodes(): Nodes } + public function profiling(): Profiling + { + if (!isset($this->namespace['Profiling'])) { + $this->namespace['Profiling'] = new Profiling($this); + } + return $this->namespace['Profiling']; + } + + public function queryRuleset(): QueryRuleset { if (!isset($this->namespace['QueryRuleset'])) { @@ -316,6 +347,15 @@ public function shutdown(): Shutdown } + public function simulate(): Simulate + { + if (!isset($this->namespace['Simulate'])) { + $this->namespace['Simulate'] = new Simulate($this); + } + return $this->namespace['Simulate']; + } + + public function slm(): Slm { if (!isset($this->namespace['Slm'])) {