diff --git a/app/process/AiMetadata.php b/app/process/AiMetadata.php index b963f16..a1610c8 100644 --- a/app/process/AiMetadata.php +++ b/app/process/AiMetadata.php @@ -29,6 +29,7 @@ class AiMetadata $this->queue->releaseDueDelayed(); $archiveUid = $this->queue->pop($this->queue->blockTimeout()); if ($archiveUid === null) { + sleep($this->queue->idleSleepSeconds()); continue; } diff --git a/app/service/AiMetadataQueue.php b/app/service/AiMetadataQueue.php index f963bd4..95445fc 100644 --- a/app/service/AiMetadataQueue.php +++ b/app/service/AiMetadataQueue.php @@ -62,6 +62,11 @@ class AiMetadataQueue return (int) config('queue.ai_metadata.block_timeout', 5); } + public function idleSleepSeconds(): int + { + return max(1, (int) config('queue.ai_metadata.idle_sleep_seconds', 1)); + } + private function pendingKey(): string { return config('queue.ai_metadata.pending', 'proofdb:ai:metadata:pending'); diff --git a/composer.json b/composer.json index 6ca059b..764e007 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "webman/validation": "^2.2", "symfony/uid": "^8.0", "vlucas/phpdotenv": "^5.6", - "guzzlehttp/guzzle": "^7.10" + "guzzlehttp/guzzle": "^7.10", + "opensearch-project/opensearch-php": "^2.6" }, "suggest": { "ext-event": "For better performance. " @@ -67,5 +68,10 @@ ] }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "config": { + "allow-plugins": { + "php-http/discovery": true + } + } } diff --git a/composer.lock b/composer.lock index 47bd242..affbe80 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f1556df2c64ede0da8f43d75af9461fe", + "content-hash": "74649fce03b1c3319cd73b61cc7c202f", "packages": [ { "name": "brick/math", @@ -368,6 +368,117 @@ ], "time": "2025-03-06T22:45:56+00:00" }, + { + "name": "ezimuel/guzzlestreams", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/guzzlestreams.git", + "reference": "903161be81e9f497cc42fb7db982404a4e6441b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/903161be81e9f497cc42fb7db982404a4e6441b0", + "reference": "903161be81e9f497cc42fb7db982404a4e6441b0", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "~9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "support": { + "source": "https://github.com/ezimuel/guzzlestreams/tree/4.1.0" + }, + "time": "2025-08-05T06:44:46+00:00" + }, + { + "name": "ezimuel/ringphp", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/ringphp.git", + "reference": "b97f46088940671100012482577eeb59f26a13b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/b97f46088940671100012482577eeb59f26a13b5", + "reference": "b97f46088940671100012482577eeb59f26a13b5", + "shasum": "" + }, + "require": { + "ezimuel/guzzlestreams": "^3.0.1 || ^4.0.0", + "php": ">=5.4.0", + "react/promise": "^2.0 || ^3.0" + }, + "replace": { + "guzzlehttp/ringphp": "self.version" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~9.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", + "support": { + "source": "https://github.com/ezimuel/ringphp/tree/1.4.1" + }, + "time": "2026-02-11T16:42:15+00:00" + }, { "name": "fruitcake/php-cors", "version": "v1.4.0", @@ -2255,6 +2366,172 @@ }, "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "opensearch-project/opensearch-php", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/opensearch-project/opensearch-php.git", + "reference": "6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opensearch-project/opensearch-php/zipball/6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd", + "reference": "6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": ">=1.3.7", + "ezimuel/ringphp": "^1.4.0", + "php": "^8.2", + "php-http/discovery": "^1.20", + "psr/http-client": "^1.0.3", + "psr/http-client-implementation": "*", + "psr/http-factory": "^1.1.0", + "psr/http-factory-implementation": "*", + "psr/http-message": "^2.0", + "psr/http-message-implementation": "*", + "psr/log": "^3.0.2", + "symfony/yaml": "^v6.4.26|^7.3.5|^v8.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.359.8", + "colinodell/psr-testlogger": "^1.3.1", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^v3.89.1", + "guzzlehttp/psr7": "^2.8.0", + "mockery/mockery": "^1.6.12", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.32", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "phpstan/phpstan-mockery": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.4.2", + "phpunit/phpunit": "^10.5.58", + "react/promise": "^v3.3", + "symfony/console": "v6.4.31|^7.4.3|^8.0.3", + "symfony/finder": "^v6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client": "^6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client-contracts": "^v3.6.0|^v8.0.3", + "twig/twig": "^3.0" + }, + "suggest": { + "aws/aws-sdk-php": "Required (^3.0.0) in order to use the AWS Signing Client Decorator", + "guzzlehttp/psr7": "Required (^2.7) in order to use the Guzzle HTTP client", + "monolog/monolog": "Allows for client-level logging and tracing", + "symfony/http-client": "Required (^6.4|^7.0|^8.0) in order to use the Symfony HTTP client" + }, + "type": "library", + "autoload": { + "psr-4": { + "OpenSearch\\": "src/OpenSearch/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0", + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Elastic" + }, + { + "name": "OpenSearch Contributors" + } + ], + "description": "PHP Client for OpenSearch", + "keywords": [ + "client", + "elasticsearch", + "opensearch", + "search" + ], + "support": { + "issues": "https://github.com/opensearch-project/opensearch-php/issues", + "source": "https://github.com/opensearch-project/opensearch-php/tree/2.6.0" + }, + "time": "2026-03-24T03:15:15+00:00" + }, + { + "name": "php-http/discovery", + "version": "1.20.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/discovery.git", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + }, + "type": "composer-plugin", + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "homepage": "http://php-http.org", + "keywords": [ + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr17", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.20.0" + }, + "time": "2024-10-02T11:20:13+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.5", @@ -2786,6 +3063,79 @@ }, "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-08-19T18:57:03+00:00" + }, { "name": "symfony/clock", "version": "v8.0.8", @@ -4874,6 +5224,81 @@ ], "time": "2026-03-31T07:15:36+00:00" }, + { + "name": "symfony/yaml", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1", + "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<7.4" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v5.6.3", diff --git a/config/opensearch.php b/config/opensearch.php new file mode 100644 index 0000000..526eddb --- /dev/null +++ b/config/opensearch.php @@ -0,0 +1,43 @@ + [ + 'hosts' => $hosts, + 'username' => getenv('OPENSEARCH_USERNAME') ?: null, + 'password' => getenv('OPENSEARCH_PASSWORD') ?: null, + 'ssl_verify' => $bool('OPENSEARCH_SSL_VERIFY', true), + 'timeout' => (float) (getenv('OPENSEARCH_TIMEOUT') ?: 30), + 'connect_timeout' => (float) (getenv('OPENSEARCH_CONNECT_TIMEOUT') ?: 5), + ], + + 'indices' => [ + 'chunks' => getenv('OPENSEARCH_INDEX_CHUNKS') ?: 'proofdb_chunks', + ], + + 'bulk' => [ + 'refresh' => getenv('OPENSEARCH_BULK_REFRESH') ?: 'false', + 'chunk_size' => (int) (getenv('OPENSEARCH_BULK_CHUNK_SIZE') ?: 500), + ], +]; diff --git a/config/queue.php b/config/queue.php index f9cfedf..753e280 100644 --- a/config/queue.php +++ b/config/queue.php @@ -10,5 +10,6 @@ return [ 'max_retries' => (int) (getenv('AI_METADATA_QUEUE_MAX_RETRIES') ?: 5), 'base_delay_seconds' => (int) (getenv('AI_METADATA_QUEUE_BASE_DELAY_SECONDS') ?: 60), 'block_timeout' => (int) (getenv('AI_METADATA_QUEUE_BLOCK_TIMEOUT') ?: 5), + 'idle_sleep_seconds' => (int) (getenv('AI_METADATA_QUEUE_IDLE_SLEEP_SECONDS') ?: 1), ], ]; diff --git a/readme.md b/readme.md index bf02355..23e50eb 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,7 @@ Unlike generic RAG systems, this project treats **"evidence" as first-class stru The system is divided into three conceptual layers: -* **Proof DB** → Data layer (MySQL + OpenSearch + Vector) +* **Proof DB** → Data layer (PostgreSQL + OpenSearch + Vector) * **Archive Cask** → Frontend interface (not part of this task) * **Few-shot Engine** → OCR (external, not part of this task) @@ -43,7 +43,7 @@ The backend follows a **modular service architecture** (not microservices yet, b 2. **Storage Layer** - * MySQL → metadata, relations + * PostgreSQL → metadata, relations * OpenSearch → full-text index * Vector DB → embeddings (can be OpenSearch kNN or Qdrant) @@ -72,7 +72,7 @@ The backend follows a **modular service architecture** (not microservices yet, b ### Database -* MySQL (relational metadata) +* PostgreSQL (relational metadata) ### Search Engine @@ -130,7 +130,7 @@ Chunk * **archive_uid 是档案级核心 ID,使用 ULID** * **chunk_uid 是 chunk 级核心 ID,格式为 `{archive_uid}_{chunk_index}_{short_uid}`** -* MySQL / OpenSearch / Vector DB 全部围绕 `archive_uid` 和 `chunk_uid` +* PostgreSQL / OpenSearch / Vector DB 全部围绕 `archive_uid` 和 `chunk_uid` * **page_number 是证据定位的关键字段** * Chunk 是向量化和检索召回单位,不是精确 citation 单位 * 证据定位只需要定位到页码,因此 chunk 可以跨段落合并,但不能跨页 @@ -212,3 +212,72 @@ GET /api/evidence/{chunk_uid} [1]: https://dev.to/tomjohnson3/understanding-backend-architecture-ljb?utm_source=chatgpt.com "Understanding Backend Architecture" [2]: https://exodata.io/what-is-a-tech-stack-how-to-architect-a-modern-scalable-technology-stack/?utm_source=chatgpt.com "How to Build a Tech Stack That Scales [2026] | Exodata" [3]: https://medium.com/%40hanxuyang0826/roadmap-to-backend-programming-master-architectural-patterns-c763c9194414?utm_source=chatgpt.com "Roadmap to Backend Programming Master: Architectural ..." + +--- + +## 10. StepMapToDo + +> Code review date: 2026-05-03 +> Scope reviewed: `app/`, `config/`, `scripts/`, `apidoc/`, project root runtime/deploy files. `vendor/` is treated as third-party dependency code and not counted as project implementation. +> Database decision: PostgreSQL is the project database contract. The default Webman Dockerfile is out of scope for this StepMap. + +### Done + +- [x] Webman backend skeleton is present and listens on `0.0.0.0:8787`. +- [x] Import API route is registered: `POST /api/articles/import`. +- [x] Import controller supports multipart Markdown upload, raw Markdown body, and JSON body. +- [x] Archive import service can normalize payloads, infer fallback title/source, validate inputs, parse DOCMASTER Markdown page markers, and fall back to single-page Markdown when markers are absent. +- [x] Page-level parsing and chunking are implemented with page-bounded chunks. Current chunking does not intentionally cross page boundaries. +- [x] Noise filtering exists for common archive/OCR boilerplate such as page numbers, classification headers, and declassification footer lines. +- [x] List-style policy records and following `COMMENT` blocks are kept together where the local pattern matches. +- [x] `archive_uid` uses ULID and `chunk_uid` follows `{archive_uid}_{chunk_index}_{short_uid}`. +- [x] Runtime import snapshot writing is implemented under `runtime/proofdb/imports/{import_uid}.json`. +- [x] Relational persistence is implemented through `ArchiveRepository::saveImport()`, including `archives` and `chunks` writes. +- [x] PostgreSQL is the selected relational database, matching current `pgsql`, JSONB, `BIGSERIAL`, and `TIMESTAMPTZ` implementation. +- [x] PostgreSQL setup script exists for creating `archives` and `chunks` tables plus indexes. +- [x] Async AI metadata queue exists on Redis with pending, delayed, failed, retry, and error keys. +- [x] `ai_metadata` Workerman process is registered and can consume Redis jobs. +- [x] OpenAI-compatible chat client exists for metadata enrichment. +- [x] Metadata enrichment service can request/fill `title`, `year`, `author`, `tags`, and `summary` when LLM config is available. +- [x] LLM retry helper exists for retryable HTTP/provider errors. +- [x] Import API documentation exists in `apidoc/importapi.md`. + +### Partially Done + +- [ ] Archive/Page/Chunk model is partly persisted: `archives` and `chunks` tables exist, but pages/page blocks are only summarized in import output and snapshots, not stored as first-class relational tables. +- [ ] `embedding_status`, `embedding_ref`, and `embedding_model` fields exist, but no embedding generation or vector index write path exists yet. +- [ ] Import response exposes page summaries and chunk IDs, but there is no read API yet to fetch archive, page, or chunk records after import. +- [ ] AI metadata enrichment updates the archive row, but import-time response only reports the queue state; clients need a follow-up API or polling path to observe completed enrichment. +- [ ] API documentation still contains an old "后续接入 MySQL" phrase; update it to PostgreSQL to match the database decision. +- [ ] Database and Redis credentials are hard-coded in config files; move them to environment variables before production use. + +### Not Done + +- [ ] OpenSearch integration is not implemented. +- [ ] Full-text indexing of chunks is not implemented. +- [ ] Full-text search API is not implemented: `POST /api/search/fulltext`. +- [ ] Embedding API/client for vector generation is not implemented. +- [ ] Vector database integration is not implemented, neither OpenSearch kNN nor Qdrant. +- [ ] Vector search API is not implemented: `POST /api/search/vector`. +- [ ] Hybrid search fusion/rerank is not implemented: `POST /api/search/hybrid`. +- [ ] Evidence reconstruction API is not implemented: `GET /api/evidence/{chunk_uid}`. +- [ ] Chunk detail API is not implemented: `GET /api/chunks/{chunk_uid}`. +- [ ] Page-level citation reconstruction is not implemented beyond storing `page_start` and `page_end` on chunks. +- [ ] OpenSearch/Vector schema, index mappings, and migration/setup scripts are not present. +- [ ] Background worker for embedding pending chunks is not present. +- [ ] Reindex/re-embed maintenance commands are not present. +- [ ] Request validation is handwritten in the service; no dedicated validator classes or reusable validation layer are present. +- [ ] Automated tests for Markdown parsing, chunking, import persistence, queue behavior, and metadata enrichment are not present. +- [ ] API authentication, rate limiting, and admin controls are not present. +- [ ] Observability for import/search/enrichment jobs is minimal; no structured job metrics or admin status endpoints are present. +- [ ] Default index page/view still uses Webman starter content and is not Proof DB specific. + +### Next Build Order + +1. Normalize remaining API documentation wording from MySQL to PostgreSQL. +2. Add read APIs for archives/chunks/evidence so imported data can be verified without reading snapshots or the database directly. +3. Add focused tests for DOCMASTER page parsing, noise filtering, comment coalescing, chunk UID stability, and repository persistence. +4. Implement embedding generation worker and persist `embedding_ref`/`embedding_model`. +5. Add OpenSearch full-text indexing and `POST /api/search/fulltext`. +6. Add vector backend choice and `POST /api/search/vector`. +7. Implement hybrid fusion/rerank and citation-oriented evidence reconstruction. diff --git a/vendor/bin/yaml-lint b/vendor/bin/yaml-lint new file mode 100755 index 0000000..388092f --- /dev/null +++ b/vendor/bin/yaml-lint @@ -0,0 +1,119 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if ( + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) + ) { + return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint'); + } +} + +return include __DIR__ . '/..'.'/symfony/yaml/Resources/bin/yaml-lint'; diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index cefc6a5..eb7774c 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -29,6 +29,7 @@ return array( 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', 'd2136ff22b54ac75cd96a40e0022218e' => $vendorDir . '/workerman/webman-framework/src/support/helpers.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', '09f6b20656683369174dd6fa83b7e5fb' => $vendorDir . '/symfony/polyfill-uuid/bootstrap.php', 'ef65a1626449d89d0811cf9befce46f0' => $vendorDir . '/illuminate/events/functions.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 682036c..910bb8f 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -30,6 +30,7 @@ return array( 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), + 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), 'Symfony\\Component\\Uid\\' => array($vendorDir . '/symfony/uid'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), @@ -46,6 +47,7 @@ return array( 'Support\\Exception\\' => array($vendorDir . '/workerman/webman-framework/src/support/exception'), 'Support\\Bootstrap\\' => array($vendorDir . '/workerman/webman-framework/src/support/bootstrap'), 'Support\\' => array($vendorDir . '/workerman/webman-framework/src/support'), + 'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), @@ -54,6 +56,7 @@ return array( 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'), 'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'), + 'OpenSearch\\' => array($vendorDir . '/opensearch-project/opensearch-php/src/OpenSearch'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'Laravel\\SerializableClosure\\' => array($vendorDir . '/laravel/serializable-closure/src'), 'Illuminate\\Validation\\' => array($vendorDir . '/illuminate/validation'), @@ -70,7 +73,10 @@ return array( 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), 'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'), 'Illuminate\\Bus\\' => array($vendorDir . '/illuminate/bus'), + 'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'), 'GuzzleHttp\\UriTemplate\\' => array($vendorDir . '/guzzlehttp/uri-template/src'), + 'GuzzleHttp\\Stream\\' => array($vendorDir . '/ezimuel/guzzlestreams/src'), + 'GuzzleHttp\\Ring\\' => array($vendorDir . '/ezimuel/ringphp/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 1f1c948..77da2ee 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -30,6 +30,7 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', 'd2136ff22b54ac75cd96a40e0022218e' => __DIR__ . '/..' . '/workerman/webman-framework/src/support/helpers.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', '09f6b20656683369174dd6fa83b7e5fb' => __DIR__ . '/..' . '/symfony/polyfill-uuid/bootstrap.php', 'ef65a1626449d89d0811cf9befce46f0' => __DIR__ . '/..' . '/illuminate/events/functions.php', ); @@ -73,6 +74,7 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 'Symfony\\Contracts\\Translation\\' => 30, 'Symfony\\Contracts\\Service\\' => 26, 'Symfony\\Contracts\\EventDispatcher\\' => 34, + 'Symfony\\Component\\Yaml\\' => 23, 'Symfony\\Component\\VarDumper\\' => 28, 'Symfony\\Component\\Uid\\' => 22, 'Symfony\\Component\\Translation\\' => 30, @@ -90,6 +92,10 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 'Support\\Bootstrap\\' => 18, 'Support\\' => 8, ), + 'R' => + array ( + 'React\\Promise\\' => 14, + ), 'P' => array ( 'Psr\\SimpleCache\\' => 16, @@ -101,6 +107,10 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 'Psr\\Clock\\' => 10, 'PhpOption\\' => 10, ), + 'O' => + array ( + 'OpenSearch\\' => 11, + ), 'M' => array ( 'Monolog\\' => 8, @@ -126,9 +136,15 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 'Illuminate\\Container\\' => 21, 'Illuminate\\Bus\\' => 15, ), + 'H' => + array ( + 'Http\\Discovery\\' => 15, + ), 'G' => array ( 'GuzzleHttp\\UriTemplate\\' => 23, + 'GuzzleHttp\\Stream\\' => 18, + 'GuzzleHttp\\Ring\\' => 16, 'GuzzleHttp\\Psr7\\' => 16, 'GuzzleHttp\\Promise\\' => 19, 'GuzzleHttp\\' => 11, @@ -264,6 +280,10 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 array ( 0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts', ), + 'Symfony\\Component\\Yaml\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/yaml', + ), 'Symfony\\Component\\VarDumper\\' => array ( 0 => __DIR__ . '/..' . '/symfony/var-dumper', @@ -328,6 +348,10 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 array ( 0 => __DIR__ . '/..' . '/workerman/webman-framework/src/support', ), + 'React\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/react/promise/src', + ), 'Psr\\SimpleCache\\' => array ( 0 => __DIR__ . '/..' . '/psr/simple-cache/src', @@ -361,6 +385,10 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 array ( 0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption', ), + 'OpenSearch\\' => + array ( + 0 => __DIR__ . '/..' . '/opensearch-project/opensearch-php/src/OpenSearch', + ), 'Monolog\\' => array ( 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', @@ -429,10 +457,22 @@ class ComposerStaticInit691f538563ac6695008ddc51b7722c80 array ( 0 => __DIR__ . '/..' . '/illuminate/bus', ), + 'Http\\Discovery\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/discovery/src', + ), 'GuzzleHttp\\UriTemplate\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/uri-template/src', ), + 'GuzzleHttp\\Stream\\' => + array ( + 0 => __DIR__ . '/..' . '/ezimuel/guzzlestreams/src', + ), + 'GuzzleHttp\\Ring\\' => + array ( + 0 => __DIR__ . '/..' . '/ezimuel/ringphp/src', + ), 'GuzzleHttp\\Psr7\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index eac6ab1..be1ffe9 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -377,6 +377,123 @@ ], "install-path": "../egulias/email-validator" }, + { + "name": "ezimuel/guzzlestreams", + "version": "4.1.0", + "version_normalized": "4.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/guzzlestreams.git", + "reference": "903161be81e9f497cc42fb7db982404a4e6441b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/903161be81e9f497cc42fb7db982404a4e6441b0", + "reference": "903161be81e9f497cc42fb7db982404a4e6441b0", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "~9.0" + }, + "time": "2025-08-05T06:44:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "support": { + "source": "https://github.com/ezimuel/guzzlestreams/tree/4.1.0" + }, + "install-path": "../ezimuel/guzzlestreams" + }, + { + "name": "ezimuel/ringphp", + "version": "1.4.1", + "version_normalized": "1.4.1.0", + "source": { + "type": "git", + "url": "https://github.com/ezimuel/ringphp.git", + "reference": "b97f46088940671100012482577eeb59f26a13b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/b97f46088940671100012482577eeb59f26a13b5", + "reference": "b97f46088940671100012482577eeb59f26a13b5", + "shasum": "" + }, + "require": { + "ezimuel/guzzlestreams": "^3.0.1 || ^4.0.0", + "php": ">=5.4.0", + "react/promise": "^2.0 || ^3.0" + }, + "replace": { + "guzzlehttp/ringphp": "self.version" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~9.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "time": "2026-02-11T16:42:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", + "support": { + "source": "https://github.com/ezimuel/ringphp/tree/1.4.1" + }, + "install-path": "../ezimuel/ringphp" + }, { "name": "fruitcake/php-cors", "version": "v1.4.0", @@ -2348,6 +2465,178 @@ }, "install-path": "../nikic/fast-route" }, + { + "name": "opensearch-project/opensearch-php", + "version": "2.6.0", + "version_normalized": "2.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/opensearch-project/opensearch-php.git", + "reference": "6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opensearch-project/opensearch-php/zipball/6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd", + "reference": "6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": ">=1.3.7", + "ezimuel/ringphp": "^1.4.0", + "php": "^8.2", + "php-http/discovery": "^1.20", + "psr/http-client": "^1.0.3", + "psr/http-client-implementation": "*", + "psr/http-factory": "^1.1.0", + "psr/http-factory-implementation": "*", + "psr/http-message": "^2.0", + "psr/http-message-implementation": "*", + "psr/log": "^3.0.2", + "symfony/yaml": "^v6.4.26|^7.3.5|^v8.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.359.8", + "colinodell/psr-testlogger": "^1.3.1", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^v3.89.1", + "guzzlehttp/psr7": "^2.8.0", + "mockery/mockery": "^1.6.12", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.32", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "phpstan/phpstan-mockery": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.4.2", + "phpunit/phpunit": "^10.5.58", + "react/promise": "^v3.3", + "symfony/console": "v6.4.31|^7.4.3|^8.0.3", + "symfony/finder": "^v6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client": "^6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client-contracts": "^v3.6.0|^v8.0.3", + "twig/twig": "^3.0" + }, + "suggest": { + "aws/aws-sdk-php": "Required (^3.0.0) in order to use the AWS Signing Client Decorator", + "guzzlehttp/psr7": "Required (^2.7) in order to use the Guzzle HTTP client", + "monolog/monolog": "Allows for client-level logging and tracing", + "symfony/http-client": "Required (^6.4|^7.0|^8.0) in order to use the Symfony HTTP client" + }, + "time": "2026-03-24T03:15:15+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "OpenSearch\\": "src/OpenSearch/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0", + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Elastic" + }, + { + "name": "OpenSearch Contributors" + } + ], + "description": "PHP Client for OpenSearch", + "keywords": [ + "client", + "elasticsearch", + "opensearch", + "search" + ], + "support": { + "issues": "https://github.com/opensearch-project/opensearch-php/issues", + "source": "https://github.com/opensearch-project/opensearch-php/tree/2.6.0" + }, + "install-path": "../opensearch-project/opensearch-php" + }, + { + "name": "php-http/discovery", + "version": "1.20.0", + "version_normalized": "1.20.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/discovery.git", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + }, + "time": "2024-10-02T11:20:13+00:00", + "type": "composer-plugin", + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "homepage": "http://php-http.org", + "keywords": [ + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr17", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.20.0" + }, + "install-path": "../php-http/discovery" + }, { "name": "phpoption/phpoption", "version": "1.9.5", @@ -2909,6 +3198,82 @@ }, "install-path": "../ralouphie/getallheaders" }, + { + "name": "react/promise", + "version": "v3.3.0", + "version_normalized": "3.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "time": "2025-08-19T18:57:03+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "install-path": "../react/promise" + }, { "name": "symfony/clock", "version": "v8.0.8", @@ -5072,6 +5437,84 @@ ], "install-path": "../symfony/var-dumper" }, + { + "name": "symfony/yaml", + "version": "v8.0.8", + "version_normalized": "8.0.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1", + "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<7.4" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0" + }, + "time": "2026-03-30T15:14:47+00:00", + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/yaml" + }, { "name": "vlucas/phpdotenv", "version": "v5.6.3", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index ec659b0..55c3686 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'workerman/webman', - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => null, + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'b8f599a6177d1d8c523473a30f8c357bc9b7bf66', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -55,6 +55,24 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'ezimuel/guzzlestreams' => array( + 'pretty_version' => '4.1.0', + 'version' => '4.1.0.0', + 'reference' => '903161be81e9f497cc42fb7db982404a4e6441b0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ezimuel/guzzlestreams', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'ezimuel/ringphp' => array( + 'pretty_version' => '1.4.1', + 'version' => '1.4.1.0', + 'reference' => 'b97f46088940671100012482577eeb59f26a13b5', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ezimuel/ringphp', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'fruitcake/php-cors' => array( 'pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', @@ -100,6 +118,12 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'guzzlehttp/ringphp' => array( + 'dev_requirement' => false, + 'replaced' => array( + 0 => '1.4.1', + ), + ), 'guzzlehttp/uri-template' => array( 'pretty_version' => 'v1.0.5', 'version' => '1.0.5.0', @@ -307,6 +331,36 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'opensearch-project/opensearch-php' => array( + 'pretty_version' => '2.6.0', + 'version' => '2.6.0.0', + 'reference' => '6bcff126ffd8f54ca33a0dd659128cbc5d3b2bcd', + 'type' => 'library', + 'install_path' => __DIR__ . '/../opensearch-project/opensearch-php', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'php-http/async-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '*', + ), + ), + 'php-http/client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '*', + ), + ), + 'php-http/discovery' => array( + 'pretty_version' => '1.20.0', + 'version' => '1.20.0.0', + 'reference' => '82fe4c73ef3363caed49ff8dd1539ba06044910d', + 'type' => 'composer-plugin', + 'install_path' => __DIR__ . '/../php-http/discovery', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'phpoption/phpoption' => array( 'pretty_version' => '1.9.5', 'version' => '1.9.5.0', @@ -373,7 +427,8 @@ 'psr/http-client-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', + 0 => '*', + 1 => '1.0', ), ), 'psr/http-factory' => array( @@ -388,7 +443,8 @@ 'psr/http-factory-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', + 0 => '*', + 1 => '1.0', ), ), 'psr/http-message' => array( @@ -403,7 +459,8 @@ 'psr/http-message-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.0', + 0 => '*', + 1 => '1.0', ), ), 'psr/log' => array( @@ -440,6 +497,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'react/promise' => array( + 'pretty_version' => 'v3.3.0', + 'version' => '3.3.0.0', + 'reference' => '23444f53a813a3296c1368bb104793ce8d88f04a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../react/promise', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'spatie/once' => array( 'dev_requirement' => false, 'replaced' => array( @@ -683,6 +749,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'symfony/yaml' => array( + 'pretty_version' => 'v8.0.8', + 'version' => '8.0.8.0', + 'reference' => '54174ab48c0c0f9e21512b304be17f8150ccf8f1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/yaml', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'vlucas/phpdotenv' => array( 'pretty_version' => 'v5.6.3', 'version' => '5.6.3.0', @@ -747,9 +822,9 @@ 'dev_requirement' => false, ), 'workerman/webman' => array( - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => null, + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'b8f599a6177d1d8c523473a30f8c357bc9b7bf66', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/ezimuel/guzzlestreams/CHANGELOG.rst b/vendor/ezimuel/guzzlestreams/CHANGELOG.rst new file mode 100644 index 0000000..39d5c68 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/CHANGELOG.rst @@ -0,0 +1,101 @@ +========= +Changelog +========= + +4.0.0 (2024-06-19) +------------------ + +* Changed the minimum PHP version to 7.4+ +* Created .gitattributes to avoid installing test folder + https://github.com/ezimuel/guzzlestreams/pull/2 + +3.0.0 (2014-10-12) +------------------ + +* Now supports creating streams from functions and iterators. +* Supports creating buffered streams and asynchronous streams. +* Removed ``functions.php``. Use the corresponding functions provided by + ``GuzzleHttp\Streams\Utils`` instead. +* Moved ``GuzzleHttp\Stream\MetadataStreamInterface::getMetadata`` to + ``GuzzleHttp\Stream\StreamInterface``. MetadataStreamInterface is no longer + used and is marked as deprecated. +* Added ``attach()`` to ``GuzzleHttp\Stream\StreamInterface`` for PSR-7 + compatibility. +* Removed ``flush()`` from StreamInterface. +* Removed the ``$maxLength`` parameter from + ``GuzzleHttp\Stream\StreamInterface::getContents()``. This function now + returns the entire remainder of the stream. If you want to limit the maximum + amount of data read from the stream, use the + ``GuzzleHttp\Stream\Utils::copyToString()`` function. +* Streams that return an empty string, ``''``, are no longer considered a + failure. You MUST return ``false`` to mark the read as a failure, and ensure + that any decorators you create properly return ``true`` in response to the + ``eof()`` method when the stream is consumed. +* ``GuzzleHttp\Stream\Stream::__construct``, + ``GuzzleHttp\Stream\Stream::factory``, and + ``GuzzleHttp\Stream\Utils::create`` no longer accept a size in the second + argument. They now accept an associative array of options, including the + "size" key and "metadata" key which can be used to provide custom metadata. +* Added ``GuzzleHttp\Stream\BufferStream`` to add support for buffering data, + and when read, shifting data off of the buffer. +* Added ``GuzzleHttp\Stream\NullBuffer`` which can be used as a buffer that + does not actually store any data. +* Added ``GuzzleHttp\Stream\AsyncStream`` to provide support for non-blocking + streams that can be filled by a remote source (e.g., an event-loop). If a + ``drain`` option is provided, the stream can also act as if it is a blocking + stream. + +2.1.0 (2014-08-17) +------------------ + +* Added an InflateStream to inflate gzipped or deflated content. +* Added ``flush`` to stream wrapper. +* Added the ability to easily register the GuzzleStreamWrapper if needed. + +2.0.0 (2014-08-16) +------------------ + +* Deprecated functions.php and moved all of those methods to + ``GuzzleHttp\Streams\Utils``. Use ``GuzzleHttp\Stream\Stream::factory()`` + instead of ``GuzzleHttp\Stream\create()`` to create new streams. +* Added ``flush()`` to ``StreamInterface``. This method is used to flush any + underlying stream write buffers. +* Added ``FnStream`` to easily decorate stream behavior with callables. +* ``Utils::hash`` now throws an exception when the stream cannot seek to 0. + +1.5.1 (2014-09-10) +------------------ + +* Stream metadata is grabbed from the underlying stream each time + ``getMetadata`` is called rather than returning a value from a cache. +* Properly closing all underlying streams when AppendStream is closed. +* Seek functions no longer throw exceptions. +* LazyOpenStream now correctly returns the underlying stream resource when + detached. + +1.5.0 (2014-08-07) +------------------ + +* Added ``Stream\safe_open`` to open stream resources and throw exceptions + instead of raising errors. + +1.4.0 (2014-07-19) +------------------ + +* Added a LazyOpenStream + +1.3.0 (2014-07-15) +------------------ + +* Added an AppendStream to stream over multiple stream one after the other. + +1.2.0 (2014-07-15) +------------------ + +* Updated the ``detach()`` method to return the underlying stream resource or + ``null`` if it does not wrap a resource. +* Multiple fixes for how streams behave when the underlying resource is + detached +* Do not clear statcache when a stream does not have a 'uri' +* Added a fix to LimitStream +* Added a condition to ensure that functions.php can be required multiple times diff --git a/vendor/ezimuel/guzzlestreams/LICENSE b/vendor/ezimuel/guzzlestreams/LICENSE new file mode 100644 index 0000000..71d3b78 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/ezimuel/guzzlestreams/Makefile b/vendor/ezimuel/guzzlestreams/Makefile new file mode 100644 index 0000000..f4d4284 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/Makefile @@ -0,0 +1,19 @@ +all: clean coverage + +release: tag + git push origin --tags + +tag: + chag tag --sign --debug CHANGELOG.rst + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=artifacts/coverage + +view-coverage: + open artifacts/coverage/index.html + +clean: + rm -rf artifacts/* diff --git a/vendor/ezimuel/guzzlestreams/README.rst b/vendor/ezimuel/guzzlestreams/README.rst new file mode 100644 index 0000000..e26afae --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/README.rst @@ -0,0 +1,43 @@ +============== +Guzzle Streams +============== + +**Note:** this is a fork of the original project since it was abandoned. + +The main goal of this fork is to offer support for `elastic/elasticsearch-php `_ +version 7.x. + +## Here the original README + +Provides a simple abstraction over streams of data. + +This library is used in `Guzzle 5 `_, and is +(currently) compatible with the WIP PSR-7. + +Installation +============ + +This package can be installed easily using `Composer `_. +Simply add the following to the composer.json file at the root of your project: + +.. code-block:: javascript + + { + "require": { + "guzzlehttp/streams": "~3.0" + } + } + +Then install your dependencies using ``composer.phar install``. + +Documentation +============= + +The documentation for this package can be found on the main Guzzle website at +http://docs.guzzlephp.org/en/guzzle4/streams.html. + +Testing +======= + +This library is tested using PHPUnit. You'll need to install the dependencies +using `Composer `_ then run ``make test``. diff --git a/vendor/ezimuel/guzzlestreams/composer.json b/vendor/ezimuel/guzzlestreams/composer.json new file mode 100644 index 0000000..1ac0f41 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/composer.json @@ -0,0 +1,33 @@ +{ + "name": "ezimuel/guzzlestreams", + "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", + "homepage": "http://guzzlephp.org/", + "keywords": ["stream", "guzzle"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=7.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~9.0", + "phpstan/phpstan": "^2.1" + }, + "autoload": { + "psr-4": { "GuzzleHttp\\Stream\\": "src/" } + }, + "scripts": { + "test": "make test", + "phpstan": "vendor/bin/phpstan analyse src" + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/AppendStream.php b/vendor/ezimuel/guzzlestreams/src/AppendStream.php new file mode 100644 index 0000000..94bda71 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/AppendStream.php @@ -0,0 +1,220 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->seek(0); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return Utils::copyToString($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream + * + * {@inheritdoc} + */ + public function detach() + { + $this->close(); + $this->detached = true; + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable || $whence !== SEEK_SET) { + return false; + } + + $success = true; + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $stream) { + if (!$stream->seek(0)) { + $success = false; + } + } + + if (!$success) { + return false; + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $this->read(min(8096, $offset - $this->pos)); + } + + return $this->pos == $offset; + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + + while ($remaining > 0) { + // Progress to the next stream if needed. + if ($this->streams[$this->current]->eof()) { + if ($this->current == $total) { + break; + } + $this->current++; + } + $buffer .= $this->streams[$this->current]->read($remaining); + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + return false; + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/AsyncReadStream.php b/vendor/ezimuel/guzzlestreams/src/AsyncReadStream.php new file mode 100644 index 0000000..25ad960 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/AsyncReadStream.php @@ -0,0 +1,207 @@ +isReadable() || !$buffer->isWritable()) { + throw new \InvalidArgumentException( + 'Buffer must be readable and writable' + ); + } + + if (isset($config['size'])) { + $this->size = $config['size']; + } + + static $callables = ['pump', 'drain']; + foreach ($callables as $check) { + if (isset($config[$check])) { + if (!is_callable($config[$check])) { + throw new \InvalidArgumentException( + $check . ' must be callable' + ); + } + $this->{$check} = $config[$check]; + } + } + + $this->hwm = $buffer->getMetadata('hwm'); + + // Cannot drain when there's no high water mark. + if ($this->hwm === null) { + $this->drain = null; + } + + $this->stream = $buffer; + } + + /** + * Factory method used to create new async stream and an underlying buffer + * if no buffer is provided. + * + * This function accepts the same options as AsyncReadStream::__construct, + * but added the following key value pairs: + * + * - buffer: (StreamInterface) Buffer used to buffer data. If none is + * provided, a default buffer is created. + * - hwm: (int) High water mark to use if a buffer is created on your + * behalf. + * - max_buffer: (int) If provided, wraps the utilized buffer in a + * DroppingStream decorator to ensure that buffer does not exceed a given + * length. When exceeded, the stream will begin dropping data. Set the + * max_buffer to 0, to use a NullStream which does not store data. + * - write: (callable) A function that is invoked when data is written + * to the underlying buffer. The function accepts the buffer as the first + * argument, and the data being written as the second. The function MUST + * return the number of bytes that were written or false to let writers + * know to slow down. + * - drain: (callable) See constructor documentation. + * - pump: (callable) See constructor documentation. + * + * @param array $options Associative array of options. + * + * @return array Returns an array containing the buffer used to buffer + * data, followed by the ready to use AsyncReadStream object. + */ + public static function create(array $options = []) + { + $maxBuffer = isset($options['max_buffer']) + ? $options['max_buffer'] + : null; + + if ($maxBuffer === 0) { + $buffer = new NullStream(); + } elseif (isset($options['buffer'])) { + $buffer = $options['buffer']; + } else { + $hwm = isset($options['hwm']) ? $options['hwm'] : 16384; + $buffer = new BufferStream($hwm); + } + + if ($maxBuffer > 0) { + $buffer = new DroppingStream($buffer, $options['max_buffer']); + } + + // Call the on_write callback if an on_write function was provided. + if (isset($options['write'])) { + $onWrite = $options['write']; + $buffer = FnStream::decorate($buffer, [ + 'write' => function ($string) use ($buffer, $onWrite) { + $result = $buffer->write($string); + $onWrite($buffer, $string); + return $result; + } + ]); + } + + return [$buffer, new self($buffer, $options)]; + } + + public function getSize() + { + return $this->size; + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + return false; + } + + public function read($length) + { + if (!$this->needsDrain && $this->drain) { + $this->needsDrain = $this->stream->getSize() >= $this->hwm; + } + + $result = $this->stream->read($length); + + // If we need to drain, then drain when the buffer is empty. + if ($this->needsDrain && $this->stream->getSize() === 0) { + $this->needsDrain = false; + $drainFn = $this->drain; + $drainFn($this->stream); + } + + $resultLen = strlen($result); + + // If a pump was provided, the buffer is still open, and not enough + // data was given, then block until the data is provided. + if ($this->pump && $resultLen < $length) { + $pumpFn = $this->pump; + $result .= $pumpFn($length - $resultLen); + } + + return $result; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/BufferStream.php b/vendor/ezimuel/guzzlestreams/src/BufferStream.php new file mode 100644 index 0000000..0fffbd6 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/BufferStream.php @@ -0,0 +1,138 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function seek($offset, $whence = SEEK_SET) + { + return false; + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + return false; + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/CachingStream.php b/vendor/ezimuel/guzzlestreams/src/CachingStream.php new file mode 100644 index 0000000..1925aae --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/CachingStream.php @@ -0,0 +1,122 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + /** + * {@inheritdoc} + * @throws SeekException When seeking with SEEK_END or when seeking + * past the total size of the buffer stream + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } else { + return false; + } + + // You cannot skip ahead past where you've read from the remote stream + if ($byte > $this->stream->getSize()) { + throw new SeekException( + $this, + $byte, + sprintf('Cannot seek to byte %d when the buffered stream only' + . ' contains %d bytes', $byte, $this->stream->getSize()) + ); + } + + return $this->stream->seek($byte); + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/DroppingStream.php b/vendor/ezimuel/guzzlestreams/src/DroppingStream.php new file mode 100644 index 0000000..56ee80c --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning false when the underlying stream is too large. + if ($diff <= 0) { + return false; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + $this->stream->write(substr($string, 0, $diff)); + + return false; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/Exception/CannotAttachException.php b/vendor/ezimuel/guzzlestreams/src/Exception/CannotAttachException.php new file mode 100644 index 0000000..e631b9f --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/Exception/CannotAttachException.php @@ -0,0 +1,4 @@ +stream = $stream; + $msg = $msg ?: 'Could not seek the stream to position ' . $pos; + parent::__construct($msg); + } + + /** + * @return StreamInterface + */ + public function getStream() + { + return $this->stream; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/FnStream.php b/vendor/ezimuel/guzzlestreams/src/FnStream.php new file mode 100644 index 0000000..6b5872d --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/FnStream.php @@ -0,0 +1,147 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function attach($stream) + { + return call_user_func($this->_fn_attach, $stream); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function seek($offset, $whence = SEEK_SET) + { + return call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/GuzzleStreamWrapper.php b/vendor/ezimuel/guzzlestreams/src/GuzzleStreamWrapper.php new file mode 100644 index 0000000..fc215d2 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/GuzzleStreamWrapper.php @@ -0,0 +1,117 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, false, stream_context_create([ + 'guzzle' => ['stream' => $stream], + ])); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + return $this->stream->seek($offset, $whence); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'r+' => 33206, + 'w' => 33188, + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/InflateStream.php b/vendor/ezimuel/guzzlestreams/src/InflateStream.php new file mode 100644 index 0000000..978af21 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/InflateStream.php @@ -0,0 +1,27 @@ +stream = new Stream($resource); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/LazyOpenStream.php b/vendor/ezimuel/guzzlestreams/src/LazyOpenStream.php new file mode 100644 index 0000000..6242ee7 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/LazyOpenStream.php @@ -0,0 +1,37 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return Stream::factory(Utils::open($this->filename, $this->mode)); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/LimitStream.php b/vendor/ezimuel/guzzlestreams/src/LimitStream.php new file mode 100644 index 0000000..e9fad98 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/LimitStream.php @@ -0,0 +1,161 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + $tell = $this->stream->tell(); + if ($tell === false) { + return false; + } + + return $tell >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + return false; + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + return $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @return self + * @throws SeekException + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if (!$this->stream->seek($offset)) { + if ($current > $offset) { + throw new SeekException($this, $offset); + } else { + $this->stream->read($offset - $current); + } + } + } + + $this->offset = $offset; + + return $this; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + * @return self + */ + public function setLimit($limit) + { + $this->limit = $limit; + + return $this; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } else { + return false; + } + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/MetadataStreamInterface.php b/vendor/ezimuel/guzzlestreams/src/MetadataStreamInterface.php new file mode 100644 index 0000000..c1433ad --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/MetadataStreamInterface.php @@ -0,0 +1,11 @@ +stream->attach($stream); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/NullStream.php b/vendor/ezimuel/guzzlestreams/src/NullStream.php new file mode 100644 index 0000000..aeda6be --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/NullStream.php @@ -0,0 +1,79 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + return Utils::copyToString($this); + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function seek($offset, $whence = SEEK_SET) + { + return false; + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + return false; + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/Stream.php b/vendor/ezimuel/guzzlestreams/src/Stream.php new file mode 100644 index 0000000..81c8041 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/Stream.php @@ -0,0 +1,261 @@ + [ + 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, + 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, + 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a+' => true, + ], + 'write' => [ + 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, + 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, + 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true, + ], + ]; + + /** + * Create a new stream based on the input type. + * + * This factory accepts the same associative array of options as described + * in the constructor. + * + * @param resource|string|StreamInterface $resource Entity body data + * @param array $options Additional options + * + * @return Stream + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function factory($resource = '', array $options = []) + { + $type = gettype($resource); + + if ($type == 'string') { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new self($stream, $options); + } + + if ($type == 'resource') { + return new self($resource, $options); + } + + if ($resource instanceof StreamInterface) { + return $resource; + } + + if ($type == 'object' && method_exists($resource, '__toString')) { + return self::factory((string) $resource, $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + if ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . $type); + } + + /** + * This constructor accepts an associative array of options. + * + * - size: (int) If a read stream would otherwise have an indeterminate + * size, but the size is known due to foreknownledge, then you can + * provide that size, in bytes. + * - metadata: (array) Any additional metadata to return when the metadata + * of the stream is accessed. + * + * @param resource $stream Stream resource to wrap. + * @param array $options Associative array of options. + * + * @throws \InvalidArgumentException if the stream is not a stream resource + */ + public function __construct($stream, $options = []) + { + if (!is_resource($stream)) { + throw new \InvalidArgumentException('Stream must be a resource'); + } + + if (isset($options['size'])) { + $this->size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->attach($stream); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + if (!$this->stream) { + return ''; + } + + $this->seek(0); + + return (string) stream_get_contents($this->stream); + } + + public function getContents() + { + return $this->stream ? stream_get_contents($this->stream) : ''; + } + + public function close() + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + + $this->detach(); + } + + public function detach() + { + $result = $this->stream; + $this->stream = $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function attach($stream) + { + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); + $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); + $this->uri = $this->getMetadata('uri'); + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!$this->stream) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + return !$this->stream || feof($this->stream); + } + + public function tell() + { + return $this->stream ? ftell($this->stream) : false; + } + + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + public function seek($offset, $whence = SEEK_SET) + { + return $this->seekable + ? fseek($this->stream, $offset, $whence) === 0 + : false; + } + + public function read($length) + { + return $this->readable ? fread($this->stream, $length) : false; + } + + public function write($string) + { + // We can't know the size after writing anything + $this->size = null; + + return $this->writable ? fwrite($this->stream, $string) : false; + } + + public function getMetadata($key = null) + { + if (!$this->stream) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/StreamDecoratorTrait.php b/vendor/ezimuel/guzzlestreams/src/StreamDecoratorTrait.php new file mode 100644 index 0000000..0f551d3 --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/StreamDecoratorTrait.php @@ -0,0 +1,144 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + $this->seek(0); + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return Utils::copyToString($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array(array($this->stream, $method), $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function seek($offset, $whence = SEEK_SET) + { + return $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('createStream() not implemented in ' + . get_class($this)); + } +} diff --git a/vendor/ezimuel/guzzlestreams/src/StreamInterface.php b/vendor/ezimuel/guzzlestreams/src/StreamInterface.php new file mode 100644 index 0000000..fd19c6f --- /dev/null +++ b/vendor/ezimuel/guzzlestreams/src/StreamInterface.php @@ -0,0 +1,159 @@ +eof()) { + $buf = $stream->read(1048576); + if ($buf === false) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === false) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; + } + + /** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + */ + public static function copyToStream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 + ) { + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read(1048576))) { + break; + } + } + return; + } + + $bytes = 0; + while (!$source->eof()) { + $buf = $source->read($maxLen - $bytes); + if (!($len = strlen($buf))) { + break; + } + $bytes += $len; + $dest->write($buf); + if ($bytes == $maxLen) { + break; + } + } + } + + /** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws SeekException + */ + public static function hash( + StreamInterface $stream, + $algo, + $rawOutput = false + ) { + $pos = $stream->tell(); + + if ($pos > 0 && !$stream->seek(0)) { + throw new SeekException($stream); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; + } + + /** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * @param string $eol Line ending + * + * @return string|bool + */ + public static function readline(StreamInterface $stream, $maxLength = null, $eol = PHP_EOL) + { + $buffer = ''; + $size = 0; + $negEolLen = -strlen($eol); + + while (!$stream->eof()) { + if (false === ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if (++$size == $maxLength || substr($buffer, $negEolLen) === $eol) { + break; + } + } + + return $buffer; + } + + /** + * Alias of GuzzleHttp\Stream\Stream::factory. + * + * @param mixed $resource Resource to create + * @param array $options Associative array of stream options defined in + * {@see \GuzzleHttp\Stream\Stream::__construct} + * + * @return StreamInterface + * + * @see GuzzleHttp\Stream\Stream::factory + * @see GuzzleHttp\Stream\Stream::__construct + */ + public static function create($resource, array $options = []) + { + return Stream::factory($resource, $options); + } +} diff --git a/vendor/ezimuel/ringphp/.editorconfig b/vendor/ezimuel/ringphp/.editorconfig new file mode 100644 index 0000000..70dabca --- /dev/null +++ b/vendor/ezimuel/ringphp/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[{Makefile,*.mk}] +indent_style = tab diff --git a/vendor/ezimuel/ringphp/.github/workflows/test.yml b/vendor/ezimuel/ringphp/.github/workflows/test.yml new file mode 100644 index 0000000..4dd95a5 --- /dev/null +++ b/vendor/ezimuel/ringphp/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: PHP test + +on: [push, pull_request] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: zip, curl + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + id: composercache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + composer install --prefer-dist + + - name: Unit tests + run: | + composer run-script test + diff --git a/vendor/ezimuel/ringphp/CHANGELOG.md b/vendor/ezimuel/ringphp/CHANGELOG.md new file mode 100644 index 0000000..7808ea5 --- /dev/null +++ b/vendor/ezimuel/ringphp/CHANGELOG.md @@ -0,0 +1,139 @@ +# Changelog + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [1.2.1] - 2022-10-25 + +- Fixed the support of PHP 8.1 with [#7](https://github.com/ezimuel/ringphp/pull/7) and [#8](https://github.com/ezimuel/ringphp/pull/8) +- Fixed the integration with Symfony, adding explicit @return annotations to suppress User Deprecated notices [#5](https://github.com/ezimuel/ringphp/pull/5) + +## [1.2.0] - 2021-11-16 + +### Added + +- Add attribute to avoid Deprecated notice for PHP 8.1 [#4](https://github.com/ezimuel/ringphp/pull/4) +- Add replace guzzlehttp/ringphp in composer [#3](https://github.com/ezimuel/ringphp/pull/3) +- Add .gitattributes file [#2](https://github.com/ezimuel/ringphp/pull/2) + +### Changed + +- Updated to PHPUnit 9 and fixed the unit tests for PHP 8 + [d386b25](https://github.com/ezimuel/ringphp/commit/d386b2597389dafe3b437ab90d115eb092fff109) + +## [1.1.2] - 2020-02-15 + +### Changed + +- Required guzzlestreams 3.0.1+ [0b78f89](https://github.com/ezimuel/ringphp/commit/0b78f89d8e0bb9e380046c31adfa40347e9f663b) + + +## [1.1.1] - 2018-07-31 + +### Fixed + +- `continue` keyword usage on PHP 7.3 + + +## [1.1.0] - 2015-05-19 + +### Added + +- Added `CURL_HTTP_VERSION_2_0` + +### Changed + +- The PHP stream wrapper handler now sets `allow_self_signed` to `false` to + match the cURL handler when `verify` is set to `true` or a certificate file. +- Ensuring that a directory exists before using the `save_to` option. +- Response protocol version is now correctly extracted from a response. + +### Fixed + +- Fixed a bug in which the result of `CurlFactory::retryFailedRewind` did not + return an array. + + +## [1.0.7] - 2015-03-29 + +### Fixed + +- PHP 7 fixes. + + +## [1.0.6] - 2015-02-26 + +### Changed + +- The multi handle of the CurlMultiHandler is now created lazily. + +### Fixed + +- Bug fix: futures now extend from React's PromiseInterface to ensure that they + are properly forwarded down the promise chain. + + +## [1.0.5] - 2014-12-10 + +### Added + +- Adding more error information to PHP stream wrapper exceptions. +- Added digest auth integration test support to test server. + + +## [1.0.4] - 2014-12-01 + +### Added + +- Added support for older versions of cURL that do not have CURLOPT_TIMEOUT_MS. +- Added a fix to the StreamHandler to return a `FutureArrayInterface` when an + +### Changed + +- Setting debug to `false` does not enable debug output. error occurs. + + +## [1.0.3] - 2014-11-03 + +### Fixed + +- Setting the `header` stream option as a string to be compatible with GAE. +- Header parsing now ensures that header order is maintained in the parsed + message. + + +## [1.0.2] - 2014-10-28 + +### Fixed + +- Now correctly honoring a `version` option is supplied in a request. + See https://github.com/guzzle/RingPHP/pull/8 + + +## [1.0.1] - 2014-10-26 + +### Fixed + +- Fixed a header parsing issue with the `CurlHandler` and `CurlMultiHandler` + that caused cURL requests with multiple responses to merge repsonses together + (e.g., requests with digest authentication). + + +## 1.0.0 - 2014-10-12 + +- Initial release + + +[Unreleased]: https://github.com/guzzle/RingPHP/compare/1.1.1...HEAD +[1.1.1]: https://github.com/guzzle/RingPHP/compare/1.1.0...1.1.1 +[1.1.0]: https://github.com/guzzle/RingPHP/compare/1.0.7...1.1.0 +[1.0.7]: https://github.com/guzzle/RingPHP/compare/1.0.6...1.0.7 +[1.0.6]: https://github.com/guzzle/RingPHP/compare/1.0.5...1.0.6 +[1.0.5]: https://github.com/guzzle/RingPHP/compare/1.0.4...1.0.5 +[1.0.4]: https://github.com/guzzle/RingPHP/compare/1.0.3...1.0.4 +[1.0.3]: https://github.com/guzzle/RingPHP/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/guzzle/RingPHP/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/guzzle/RingPHP/compare/1.0.0...1.0.1 diff --git a/vendor/ezimuel/ringphp/LICENSE b/vendor/ezimuel/ringphp/LICENSE new file mode 100644 index 0000000..71d3b78 --- /dev/null +++ b/vendor/ezimuel/ringphp/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/ezimuel/ringphp/Makefile b/vendor/ezimuel/ringphp/Makefile new file mode 100644 index 0000000..21c812e --- /dev/null +++ b/vendor/ezimuel/ringphp/Makefile @@ -0,0 +1,46 @@ +all: clean coverage docs + +docs: + cd docs && make html + +view-docs: + open docs/_build/html/index.html + +start-server: stop-server + node tests/Client/server.js &> /dev/null & + +stop-server: + @PID=$(shell ps axo pid,command \ + | grep 'tests/Client/server.js' \ + | grep -v grep \ + | cut -f 1 -d " "\ + ) && [ -n "$$PID" ] && kill $$PID || true + +test: start-server + vendor/bin/phpunit $(TEST) + $(MAKE) stop-server + +coverage: start-server + vendor/bin/phpunit --coverage-html=build/artifacts/coverage $(TEST) + $(MAKE) stop-server + +view-coverage: + open build/artifacts/coverage/index.html + +clean: + rm -rf build/artifacts/* + cd docs && make clean + +tag: + $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) + @echo Tagging $(TAG) + chag update -m '$(TAG) ()' + git add -A + git commit -m '$(TAG) release' + chag tag + +perf: start-server + php tests/perf.php + $(MAKE) stop-server + +.PHONY: docs diff --git a/vendor/ezimuel/ringphp/README.md b/vendor/ezimuel/ringphp/README.md new file mode 100644 index 0000000..2fd8324 --- /dev/null +++ b/vendor/ezimuel/ringphp/README.md @@ -0,0 +1,48 @@ +RingPHP +======= + +[![Build status](https://github.com/ezimuel/ringphp/workflows/PHP%20test/badge.svg)](https://github.com/ezimuel/ringphp/actions) [![Latest Stable Version](https://poser.pugx.org/ezimuel/ringphp/v/stable)](https://packagist.org/packages/ezimuel/ringphp) + +**Note:** this is a fork of the original project since it was abandoned. + +Provides a simple API and specification that abstracts away the details of HTTP +into a single PHP function. RingPHP be used to power HTTP clients and servers +through a PHP function that accepts a request hash and returns a response hash +that is fulfilled using a [promise](https://github.com/reactphp/promise), +allowing RingPHP to support both synchronous and asynchronous workflows. + +By abstracting the implementation details of different HTTP clients and +servers, RingPHP allows you to utilize pluggable HTTP clients and servers +without tying your application to a specific implementation. + +```php +require 'vendor/autoload.php'; + +use GuzzleHttp\Ring\Client\CurlHandler; + +$handler = new CurlHandler(); +$response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => [ + 'host' => ['www.google.com'], + 'x-foo' => ['baz'] + ] +]); + +$response->then(function (array $response) { + echo $response['status']; +}); + +$response->wait(); +``` + +RingPHP is inspired by Clojure's [Ring](https://github.com/ring-clojure/ring), +which, in turn, was inspired by Python's WSGI and Ruby's Rack. RingPHP is +utilized as the handler layer in [Guzzle](https://guzzlephp.org) 5.0+ to send +HTTP requests. + +Documentation +------------- + +See https://ringphp.readthedocs.io/en/latest/ for the full online documentation. diff --git a/vendor/ezimuel/ringphp/composer.json b/vendor/ezimuel/ringphp/composer.json new file mode 100644 index 0000000..6958f33 --- /dev/null +++ b/vendor/ezimuel/ringphp/composer.json @@ -0,0 +1,46 @@ +{ + "name": "ezimuel/ringphp", + "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.4.0", + "ezimuel/guzzlestreams": "^3.0.1 || ^4.0.0", + "react/promise": "^2.0 || ^3.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~9.0" + }, + "replace": { + "guzzlehttp/ringphp": "self.version" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Ring\\": "tests/" + } + }, + "scripts": { + "test": "make test", + "test-ci": "make coverage" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/vendor/ezimuel/ringphp/phpunit.xml.dist b/vendor/ezimuel/ringphp/phpunit.xml.dist new file mode 100644 index 0000000..5edbc93 --- /dev/null +++ b/vendor/ezimuel/ringphp/phpunit.xml.dist @@ -0,0 +1,9 @@ + + + + + tests + + + diff --git a/vendor/ezimuel/ringphp/src/Client/ClientUtils.php b/vendor/ezimuel/ringphp/src/Client/ClientUtils.php new file mode 100644 index 0000000..27d5fe7 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Client/ClientUtils.php @@ -0,0 +1,74 @@ +getDefaultOptions($request, $headers); + $this->applyMethod($request, $options); + + if (isset($request['client'])) { + $this->applyHandlerOptions($request, $options); + } + + $this->applyHeaders($request, $options); + unset($options['_headers']); + + // Add handler options from the request's configuration options + if (isset($request['client']['curl'])) { + $options = $this->applyCustomCurlOptions( + $request['client']['curl'], + $options + ); + } + + if (!$handle) { + $handle = curl_init(); + } + + $body = $this->getOutputBody($request, $options); + curl_setopt_array($handle, $options); + + return [$handle, &$headers, $body]; + } + + /** + * Creates a response hash from a cURL result. + * + * @param callable $handler Handler that was used. + * @param array $request Request that sent. + * @param array $response Response hash to update. + * @param array $headers Headers received during transfer. + * @param resource $body Body fopen response. + * + * @return array + */ + public static function createResponse( + callable $handler, + array $request, + array $response, + array $headers, + $body + ) { + if (isset($response['transfer_stats']['url'])) { + $response['effective_url'] = $response['transfer_stats']['url']; + } + + if (!empty($headers)) { + $startLine = explode(' ', array_shift($headers), 3); + $headerList = Core::headersFromLines($headers); + $response['headers'] = $headerList; + $response['version'] = isset($startLine[0]) ? substr($startLine[0], 5) : null; + $response['status'] = isset($startLine[1]) ? (int) $startLine[1] : null; + $response['reason'] = isset($startLine[2]) ? $startLine[2] : null; + $response['body'] = $body; + Core::rewindBody($response); + } + + return !empty($response['curl']['errno']) || !isset($response['status']) + ? self::createErrorResponse($handler, $request, $response) + : $response; + } + + private static function createErrorResponse( + callable $handler, + array $request, + array $response + ) { + static $connectionErrors = [ + CURLE_OPERATION_TIMEOUTED => true, + CURLE_COULDNT_RESOLVE_HOST => true, + CURLE_COULDNT_CONNECT => true, + CURLE_SSL_CONNECT_ERROR => true, + CURLE_GOT_NOTHING => true, + ]; + + // Retry when nothing is present or when curl failed to rewind. + if (!isset($response['err_message']) + && (empty($response['curl']['errno']) + || $response['curl']['errno'] == 65) + ) { + return self::retryFailedRewind($handler, $request, $response); + } + + $message = isset($response['err_message']) + ? $response['err_message'] + : sprintf('cURL error %s: %s', + $response['curl']['errno'], + isset($response['curl']['error']) + ? $response['curl']['error'] + : 'See http://curl.haxx.se/libcurl/c/libcurl-errors.html'); + + $error = isset($response['curl']['errno']) + && isset($connectionErrors[$response['curl']['errno']]) + ? new ConnectException($message) + : new RingException($message); + + return $response + [ + 'status' => null, + 'reason' => null, + 'body' => null, + 'headers' => [], + 'error' => $error, + ]; + } + + private function getOutputBody(array $request, array &$options) + { + // Determine where the body of the response (if any) will be streamed. + if (isset($options[CURLOPT_WRITEFUNCTION])) { + return $request['client']['save_to']; + } + + if (isset($options[CURLOPT_FILE])) { + return $options[CURLOPT_FILE]; + } + + if ($request['http_method'] != 'HEAD') { + // Create a default body if one was not provided + return $options[CURLOPT_FILE] = fopen('php://temp', 'w+'); + } + + return null; + } + + private function getDefaultOptions(array $request, array &$headers) + { + $url = Core::url($request); + $startingResponse = false; + + $options = [ + '_headers' => $request['headers'], + CURLOPT_CUSTOMREQUEST => $request['http_method'], + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => false, + CURLOPT_HEADER => false, + CURLOPT_CONNECTTIMEOUT => 150, + CURLOPT_HEADERFUNCTION => function ($ch, $h) use (&$headers, &$startingResponse) { + $value = trim($h); + if ($value === '') { + $startingResponse = true; + } elseif ($startingResponse) { + $startingResponse = false; + $headers = [$value]; + } else { + $headers[] = $value; + } + return strlen($h); + }, + ]; + + if (isset($request['version'])) { + if ($request['version'] == 2.0) { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; + } else if ($request['version'] == 1.1) { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; + } else { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; + } + } + + if (defined('CURLOPT_PROTOCOLS')) { + $options[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; + } + + return $options; + } + + private function applyMethod(array $request, array &$options) + { + if (isset($request['body'])) { + $this->applyBody($request, $options); + return; + } + + switch ($request['http_method']) { + case 'PUT': + case 'POST': + // See http://tools.ietf.org/html/rfc7230#section-3.3.2 + if (!Core::hasHeader($request, 'Content-Length')) { + $options[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + break; + case 'HEAD': + $options[CURLOPT_NOBODY] = true; + unset( + $options[CURLOPT_WRITEFUNCTION], + $options[CURLOPT_READFUNCTION], + $options[CURLOPT_FILE], + $options[CURLOPT_INFILE] + ); + } + } + + private function applyBody(array $request, array &$options) + { + $contentLength = Core::firstHeader($request, 'Content-Length'); + $size = $contentLength !== null ? (int) $contentLength : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [client][curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || + isset($request['client']['curl']['body_as_string']) || + is_string($request['body']) + ) { + $options[CURLOPT_POSTFIELDS] = Core::body($request); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $options); + $this->removeHeader('Transfer-Encoding', $options); + } else { + $options[CURLOPT_UPLOAD] = true; + if ($size !== null) { + // Let cURL handle setting the Content-Length header + $options[CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $options); + } + $this->addStreamingBody($request, $options); + } + + // If the Expect header is not present, prevent curl from adding it + if (!Core::hasHeader($request, 'Expect')) { + $options[CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!Core::hasHeader($request, 'Content-Type')) { + $options[CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function addStreamingBody(array $request, array &$options) + { + $body = $request['body']; + + if ($body instanceof StreamInterface) { + $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + return (string) $body->read($length); + }; + if (!isset($options[CURLOPT_INFILESIZE])) { + if ($size = $body->getSize()) { + $options[CURLOPT_INFILESIZE] = $size; + } + } + } elseif (is_resource($body)) { + $options[CURLOPT_INFILE] = $body; + } elseif ($body instanceof \Iterator) { + $buf = ''; + $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body, &$buf) { + if ($body->valid()) { + $buf .= $body->current(); + $body->next(); + } + $result = (string) substr($buf, 0, $length); + $buf = substr($buf, $length); + return $result; + }; + } else { + throw new \InvalidArgumentException('Invalid request body provided'); + } + } + + private function applyHeaders(array $request, array &$options) + { + foreach ($options['_headers'] as $name => $values) { + foreach ($values as $value) { + $options[CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + + // Remove the Accept header if one was not set + if (!Core::hasHeader($request, 'Accept')) { + $options[CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Takes an array of curl options specified in the 'curl' option of a + * request's configuration array and maps them to CURLOPT_* options. + * + * This method is only called when a request has a 'curl' config setting. + * + * @param array $config Configuration array of custom curl option + * @param array $options Array of existing curl options + * + * @return array Returns a new array of curl options + */ + private function applyCustomCurlOptions(array $config, array $options) + { + $curlOptions = []; + foreach ($config as $key => $value) { + if (is_int($key)) { + $curlOptions[$key] = $value; + } + } + + return $curlOptions + $options; + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader($name, array &$options) + { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + /** + * Applies an array of request client options to a the options array. + * + * This method uses a large switch rather than double-dispatch to save on + * high overhead of calling functions in PHP. + */ + private function applyHandlerOptions(array $request, array &$options) + { + foreach ($request['client'] as $key => $value) { + switch ($key) { + // Violating PSR-4 to provide more room. + case 'verify': + + if ($value === false) { + unset($options[CURLOPT_CAINFO]); + $options[CURLOPT_SSL_VERIFYHOST] = 0; + $options[CURLOPT_SSL_VERIFYPEER] = false; + continue 2; + } + + $options[CURLOPT_SSL_VERIFYHOST] = 2; + $options[CURLOPT_SSL_VERIFYPEER] = true; + + if (is_string($value)) { + $options[CURLOPT_CAINFO] = $value; + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL CA bundle not found: $value" + ); + } + } + break; + + case 'decode_content': + + if ($value === false) { + continue 2; + } + + $accept = Core::firstHeader($request, 'Accept-Encoding'); + if ($accept) { + $options[CURLOPT_ENCODING] = $accept; + } else { + $options[CURLOPT_ENCODING] = ''; + // Don't let curl send the header over the wire + $options[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + break; + + case 'save_to': + + if (is_string($value)) { + if (!is_dir(dirname($value))) { + throw new \RuntimeException(sprintf( + 'Directory %s does not exist for save_to value of %s', + dirname($value), + $value + )); + } + $value = new LazyOpenStream($value, 'w+'); + } + + if ($value instanceof StreamInterface) { + $options[CURLOPT_WRITEFUNCTION] = + function ($ch, $write) use ($value) { + return $value->write($write); + }; + } elseif (is_resource($value)) { + $options[CURLOPT_FILE] = $value; + } else { + throw new \InvalidArgumentException('save_to must be a ' + . 'GuzzleHttp\Stream\StreamInterface or resource'); + } + break; + + case 'timeout': + + if (defined('CURLOPT_TIMEOUT_MS')) { + $options[CURLOPT_TIMEOUT_MS] = $value * 1000; + } else { + $options[CURLOPT_TIMEOUT] = $value; + } + break; + + case 'connect_timeout': + + if (defined('CURLOPT_CONNECTTIMEOUT_MS')) { + $options[CURLOPT_CONNECTTIMEOUT_MS] = $value * 1000; + } else { + $options[CURLOPT_CONNECTTIMEOUT] = $value; + } + break; + + case 'proxy': + + if (!is_array($value)) { + $options[CURLOPT_PROXY] = $value; + } elseif (isset($request['scheme'])) { + $scheme = $request['scheme']; + if (isset($value[$scheme])) { + $options[CURLOPT_PROXY] = $value[$scheme]; + } + } + break; + + case 'cert': + + if (is_array($value)) { + $options[CURLOPT_SSLCERTPASSWD] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL certificate not found: {$value}" + ); + } + + $options[CURLOPT_SSLCERT] = $value; + break; + + case 'ssl_key': + + if (is_array($value)) { + $options[CURLOPT_SSLKEYPASSWD] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL private key not found: {$value}" + ); + } + + $options[CURLOPT_SSLKEY] = $value; + break; + + case 'progress': + + if (!is_callable($value)) { + throw new \InvalidArgumentException( + 'progress client option must be callable' + ); + } + + $options[CURLOPT_NOPROGRESS] = false; + $options[CURLOPT_PROGRESSFUNCTION] = + function () use ($value) { + $args = func_get_args(); + // PHP 5.5 pushed the handle onto the start of the args + if (is_resource($args[0])) { + array_shift($args); + } + call_user_func_array($value, $args); + }; + break; + + case 'debug': + + if ($value) { + $options[CURLOPT_STDERR] = Core::getDebugResource($value); + $options[CURLOPT_VERBOSE] = true; + } + break; + } + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + */ + private static function retryFailedRewind( + callable $handler, + array $request, + array $response + ) { + // If there is no body, then there is some other kind of issue. This + // is weird and should probably never happen. + if (!isset($request['body'])) { + $response['err_message'] = 'No response was received for a request ' + . 'with no body. This could mean that you are saturating your ' + . 'network.'; + return self::createErrorResponse($handler, $request, $response); + } + + if (!Core::rewindBody($request)) { + $response['err_message'] = 'The connection unexpectedly failed ' + . 'without providing an error. The request would have been ' + . 'retried, but attempting to rewind the request body failed.'; + return self::createErrorResponse($handler, $request, $response); + } + + // Retry no more than 3 times before giving up. + if (!isset($request['curl']['retries'])) { + $request['curl']['retries'] = 1; + } elseif ($request['curl']['retries'] == 2) { + $response['err_message'] = 'The cURL request was retried 3 times ' + . 'and did no succeed. cURL was unable to rewind the body of ' + . 'the request and subsequent retries resulted in the same ' + . 'error. Turn on the debug option to see what went wrong. ' + . 'See https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createErrorResponse($handler, $request, $response); + } else { + $request['curl']['retries']++; + } + + return $handler($request); + } +} diff --git a/vendor/ezimuel/ringphp/src/Client/CurlHandler.php b/vendor/ezimuel/ringphp/src/Client/CurlHandler.php new file mode 100644 index 0000000..4115c49 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Client/CurlHandler.php @@ -0,0 +1,140 @@ +handles = $this->ownedHandles = []; + $this->factory = isset($options['handle_factory']) + ? $options['handle_factory'] + : new CurlFactory(); + $this->maxHandles = isset($options['max_handles']) + ? $options['max_handles'] + : 5; + } + + public function __destruct() + { + if (PHP_VERSION_ID >= 80000) { + return; + } + foreach ($this->handles as $handle) { + if (is_resource($handle)) { + curl_close($handle); + } + } + } + + /** + * @param array $request + * + * @return CompletedFutureArray + */ + public function __invoke(array $request) + { + return new CompletedFutureArray( + $this->_invokeAsArray($request) + ); + } + + /** + * @internal + * + * @param array $request + * + * @return array + */ + public function _invokeAsArray(array $request) + { + $factory = $this->factory; + + // Ensure headers are by reference. They're updated elsewhere. + $result = $factory($request, $this->checkoutEasyHandle()); + $h = $result[0]; + $hd =& $result[1]; + $bd = $result[2]; + Core::doSleep($request); + curl_exec($h); + $response = ['transfer_stats' => curl_getinfo($h)]; + $response['curl']['error'] = curl_error($h); + $response['curl']['errno'] = curl_errno($h); + $response['transfer_stats'] = array_merge($response['transfer_stats'], $response['curl']); + $this->releaseEasyHandle($h); + + return CurlFactory::createResponse([$this, '_invokeAsArray'], $request, $response, $hd, $bd); + } + + private function checkoutEasyHandle() + { + // Find an unused handle in the cache + if (false !== ($key = array_search(false, $this->ownedHandles, true))) { + $this->ownedHandles[$key] = true; + return $this->handles[$key]; + } + + // Add a new handle + $handle = curl_init(); + $id = (int) $handle; + $this->handles[$id] = $handle; + $this->ownedHandles[$id] = true; + + return $handle; + } + + private function releaseEasyHandle($handle) + { + $id = (int) $handle; + if (count($this->ownedHandles) > $this->maxHandles) { + if (PHP_VERSION_ID < 80000) { + curl_close($this->handles[$id]); + } + unset($this->handles[$id], $this->ownedHandles[$id]); + } else { + // curl_reset doesn't clear these out for some reason + static $unsetValues = [ + CURLOPT_HEADERFUNCTION => null, + CURLOPT_WRITEFUNCTION => null, + CURLOPT_READFUNCTION => null, + CURLOPT_PROGRESSFUNCTION => null, + ]; + curl_setopt_array($handle, $unsetValues); + curl_reset($handle); + $this->ownedHandles[$id] = false; + } + } +} diff --git a/vendor/ezimuel/ringphp/src/Client/CurlMultiHandler.php b/vendor/ezimuel/ringphp/src/Client/CurlMultiHandler.php new file mode 100644 index 0000000..8a83444 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Client/CurlMultiHandler.php @@ -0,0 +1,252 @@ +_mh = $options['mh']; + } + $this->factory = isset($options['handle_factory']) + ? $options['handle_factory'] : new CurlFactory(); + $this->selectTimeout = isset($options['select_timeout']) + ? $options['select_timeout'] : 1; + $this->maxHandles = isset($options['max_handles']) + ? $options['max_handles'] : 100; + } + + public function __get($name) + { + if ($name === '_mh') { + return $this->_mh = curl_multi_init(); + } + + throw new \BadMethodCallException(); + } + + public function __destruct() + { + // Finish any open connections before terminating the script. + if ($this->handles) { + $this->execute(); + } + + if (isset($this->_mh)) { + curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(array $request) + { + $factory = $this->factory; + $result = $factory($request); + $entry = [ + 'request' => $request, + 'response' => [], + 'handle' => $result[0], + 'headers' => &$result[1], + 'body' => $result[2], + 'deferred' => new Deferred(), + ]; + + $id = (int) $result[0]; + + $future = new FutureArray( + $entry['deferred']->promise(), + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest($entry); + + // Transfer outstanding requests if there are too many open handles. + if (count($this->handles) >= $this->maxHandles) { + $this->execute(); + } + + return $future; + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute() + { + do { + + if ($this->active && + curl_multi_select($this->_mh, $this->selectTimeout) === -1 + ) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + usleep(250); + } + + // Add any delayed futures if needed. + if ($this->delays) { + $this->addDelays(); + } + + do { + $mrc = curl_multi_exec($this->_mh, $this->active); + } while ($mrc === CURLM_CALL_MULTI_PERFORM); + + $this->processMessages(); + + // If there are delays but no transfers, then sleep for a bit. + if (!$this->active && $this->delays) { + usleep(500); + } + + } while ($this->active || $this->handles); + } + + private function addRequest(array &$entry) + { + $id = (int) $entry['handle']; + $this->handles[$id] = $entry; + + // If the request is a delay, then add the reques to the curl multi + // pool only after the specified delay. + if (isset($entry['request']['client']['delay'])) { + $this->delays[$id] = microtime(true) + ($entry['request']['client']['delay'] / 1000); + } elseif (empty($entry['request']['future'])) { + curl_multi_add_handle($this->_mh, $entry['handle']); + } else { + curl_multi_add_handle($this->_mh, $entry['handle']); + // "lazy" futures are only sent once the pool has many requests. + if ($entry['request']['future'] !== 'lazy') { + do { + $mrc = curl_multi_exec($this->_mh, $this->active); + } while ($mrc === CURLM_CALL_MULTI_PERFORM); + $this->processMessages(); + } + } + } + + private function removeProcessed($id) + { + if (isset($this->handles[$id])) { + curl_multi_remove_handle( + $this->_mh, + $this->handles[$id]['handle'] + ); + if (PHP_VERSION_ID < 80000) { + curl_close($this->handles[$id]['handle']); + } + unset($this->handles[$id], $this->delays[$id]); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id) + { + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['handle']; + unset($this->delays[$id], $this->handles[$id]); + curl_multi_remove_handle($this->_mh, $handle); + if (PHP_VERSION_ID < 80000) { + curl_close($handle); + } + return true; + } + + private function addDelays() + { + $currentTime = microtime(true); + + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['handle'] + ); + } + } + } + + private function processMessages() + { + while ($done = curl_multi_info_read($this->_mh)) { + $id = (int) $done['handle']; + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + $entry['response']['transfer_stats'] = curl_getinfo($done['handle']); + + if ($done['result'] !== CURLM_OK) { + $entry['response']['curl']['errno'] = $done['result']; + $entry['response']['curl']['error'] = curl_error($done['handle']); + } + + $result = CurlFactory::createResponse( + $this, + $entry['request'], + $entry['response'], + $entry['headers'], + $entry['body'] + ); + + $this->removeProcessed($id); + $entry['deferred']->resolve($result); + } + } +} diff --git a/vendor/ezimuel/ringphp/src/Client/Middleware.php b/vendor/ezimuel/ringphp/src/Client/Middleware.php new file mode 100644 index 0000000..6fa7318 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Client/Middleware.php @@ -0,0 +1,58 @@ +result = $result; + } + + public function __invoke(array $request) + { + Core::doSleep($request); + $response = is_callable($this->result) + ? call_user_func($this->result, $request) + : $this->result; + + if (is_array($response)) { + $response = new CompletedFutureArray($response + [ + 'status' => null, + 'body' => null, + 'headers' => [], + 'reason' => null, + 'effective_url' => null, + ]); + } elseif (!$response instanceof FutureArrayInterface) { + throw new \InvalidArgumentException( + 'Response must be an array or FutureArrayInterface. Found ' + . Core::describeType($request) + ); + } + + return $response; + } +} diff --git a/vendor/ezimuel/ringphp/src/Client/StreamHandler.php b/vendor/ezimuel/ringphp/src/Client/StreamHandler.php new file mode 100644 index 0000000..4bacec1 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Client/StreamHandler.php @@ -0,0 +1,414 @@ +options = $options; + } + + public function __invoke(array $request) + { + $url = Core::url($request); + Core::doSleep($request); + + try { + // Does not support the expect header. + $request = Core::removeHeader($request, 'Expect'); + $stream = $this->createStream($url, $request); + return $this->createResponse($request, $url, $stream); + } catch (RingException $e) { + return $this->createErrorResponse($url, $e); + } + } + + private function createResponse(array $request, $url, $stream) + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = null; + $parts = explode(' ', array_shift($hdrs), 3); + $response = [ + 'version' => substr($parts[0], 5), + 'status' => $parts[1], + 'reason' => isset($parts[2]) ? $parts[2] : null, + 'headers' => Core::headersFromLines($hdrs), + 'effective_url' => $url, + ]; + + $stream = $this->checkDecode($request, $response, $stream); + + // If not streaming, then drain the response into a stream. + if (empty($request['client']['stream'])) { + $dest = isset($request['client']['save_to']) + ? $request['client']['save_to'] + : fopen('php://temp', 'r+'); + $stream = $this->drain($stream, $dest); + } + + $response['body'] = $stream; + + return new CompletedFutureArray($response); + } + + private function checkDecode(array $request, array $response, $stream) + { + // Automatically decode responses when instructed. + if (!empty($request['client']['decode_content'])) { + switch (Core::firstHeader($response, 'Content-Encoding', true)) { + case 'gzip': + case 'deflate': + $stream = new InflateStream(Stream::factory($stream)); + break; + } + } + + return $stream; + } + + /** + * Drains the stream into the "save_to" client option. + * + * @param resource $stream + * @param string|resource|StreamInterface $dest + * + * @return Stream + * @throws \RuntimeException when the save_to option is invalid. + */ + private function drain($stream, $dest) + { + if (is_resource($stream)) { + if (!is_resource($dest)) { + $stream = Stream::factory($stream); + } else { + stream_copy_to_stream($stream, $dest); + fclose($stream); + rewind($dest); + return $dest; + } + } + + // Stream the response into the destination stream + $dest = is_string($dest) + ? new Stream(Utils::open($dest, 'r+')) + : Stream::factory($dest); + + Utils::copyToStream($stream, $dest); + $dest->seek(0); + $stream->close(); + + return $dest; + } + + /** + * Creates an error response for the given stream. + * + * @param string $url + * @param RingException $e + * + * @return array + */ + private function createErrorResponse($url, RingException $e) + { + // Determine if the error was a networking error. + $message = $e->getMessage(); + + // This list can probably get more comprehensive. + if (strpos($message, 'getaddrinfo') // DNS lookup failed + || strpos($message, 'Connection refused') + ) { + $e = new ConnectException($e->getMessage(), 0, $e); + } + + return new CompletedFutureArray([ + 'status' => null, + 'body' => null, + 'headers' => [], + 'effective_url' => $url, + 'error' => $e + ]); + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = null; + set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + $resource = $callback(); + restore_error_handler(); + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . PHP_EOL; + } + } + throw new RingException(trim($message)); + } + + return $resource; + } + + private function createStream($url, array $request) + { + static $methods; + if (!$methods) { + $methods = array_flip(get_class_methods(__CLASS__)); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ((!isset($request['version']) || $request['version'] == '1.1') + && !Core::hasHeader($request, 'Connection') + ) { + $request['headers']['Connection'] = ['close']; + } + + // Ensure SSL is verified by default + if (!isset($request['client']['verify'])) { + $request['client']['verify'] = true; + } + + $params = []; + $options = $this->getDefaultOptions($request); + + if (isset($request['client'])) { + foreach ($request['client'] as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $options, $value, $params); + } + } + } + + return $this->createStreamResource( + $url, + $request, + $options, + $this->createContext($request, $options, $params) + ); + } + + private function getDefaultOptions(array $request) + { + $headers = ""; + foreach ($request['headers'] as $name => $value) { + foreach ((array) $value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request['http_method'], + 'header' => $headers, + 'protocol_version' => isset($request['version']) ? $request['version'] : 1.1, + 'ignore_errors' => true, + 'follow_location' => 0, + ], + ]; + + $body = Core::body($request); + if (isset($body)) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!Core::hasHeader($request, 'Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = rtrim($context['http']['header']); + + return $context; + } + + private function add_proxy(array $request, &$options, $value, &$params) + { + if (!is_array($value)) { + $options['http']['proxy'] = $value; + } else { + $scheme = isset($request['scheme']) ? $request['scheme'] : 'http'; + if (isset($value[$scheme])) { + $options['http']['proxy'] = $value[$scheme]; + } + } + } + + private function add_timeout(array $request, &$options, $value, &$params) + { + $options['http']['timeout'] = $value; + } + + private function add_verify(array $request, &$options, $value, &$params) + { + if ($value === true) { + // PHP 5.6 or greater will find the system cert by default. When + // < 5.6, use the Guzzle bundled cacert. + if (PHP_VERSION_ID < 50600) { + $options['ssl']['cafile'] = ClientUtils::getDefaultCaBundle(); + } + } elseif (is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!file_exists($value)) { + throw new RingException("SSL CA bundle not found: $value"); + } + } elseif ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['allow_self_signed'] = true; + return; + } else { + throw new RingException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + private function add_cert(array $request, &$options, $value, &$params) + { + if (is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new RingException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + private function add_progress(array $request, &$options, $value, &$params) + { + $fn = function ($code, $_1, $_2, $_3, $transferred, $total) use ($value) { + if ($code == STREAM_NOTIFY_PROGRESS) { + $value($total, $transferred, null, null); + } + }; + + // Wrap the existing function if needed. + $params['notification'] = isset($params['notification']) + ? Core::callArray([$params['notification'], $fn]) + : $fn; + } + + private function add_debug(array $request, &$options, $value, &$params) + { + if ($value === false) { + return; + } + + static $map = [ + STREAM_NOTIFY_CONNECT => 'CONNECT', + STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + STREAM_NOTIFY_PROGRESS => 'PROGRESS', + STREAM_NOTIFY_FAILURE => 'FAILURE', + STREAM_NOTIFY_COMPLETED => 'COMPLETED', + STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + + static $args = ['severity', 'message', 'message_code', + 'bytes_transferred', 'bytes_max']; + + $value = Core::getDebugResource($value); + $ident = $request['http_method'] . ' ' . Core::url($request); + $fn = function () use ($ident, $value, $map, $args) { + $passed = func_get_args(); + $code = array_shift($passed); + fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (array_filter($passed) as $i => $v) { + fwrite($value, $args[$i] . ': "' . $v . '" '); + } + fwrite($value, "\n"); + }; + + // Wrap the existing function if needed. + $params['notification'] = isset($params['notification']) + ? Core::callArray([$params['notification'], $fn]) + : $fn; + } + + private function applyCustomOptions(array $request, array &$options) + { + if (!isset($request['client']['stream_context'])) { + return; + } + + if (!is_array($request['client']['stream_context'])) { + throw new RingException('stream_context must be an array'); + } + + $options = array_replace_recursive( + $options, + $request['client']['stream_context'] + ); + } + + private function createContext(array $request, array $options, array $params) + { + $this->applyCustomOptions($request, $options); + return $this->createResource( + function () use ($request, $options, $params) { + return stream_context_create($options, $params); + }, + $request, + $options + ); + } + + private function createStreamResource( + $url, + array $request, + array $options, + $context + ) { + return $this->createResource( + function () use ($url, $context) { + if (false === strpos($url, 'http')) { + trigger_error("URL is invalid: {$url}", E_USER_WARNING); + return null; + } + $resource = fopen($url, 'r', null, $context); + $this->lastHeaders = $http_response_header; + return $resource; + }, + $request, + $options + ); + } +} diff --git a/vendor/ezimuel/ringphp/src/Core.php b/vendor/ezimuel/ringphp/src/Core.php new file mode 100644 index 0000000..fd9554b --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Core.php @@ -0,0 +1,364 @@ + $value) { + if (!strcasecmp($name, $header)) { + $result = array_merge($result, $value); + } + } + } + + return $result; + } + + /** + * Gets a header value from a message as a string or null + * + * This method searches through the "headers" key of a message for a header + * using a case-insensitive search. The lines of the header are imploded + * using commas into a single string return value. + * + * @param array $message Request or response hash. + * @param string $header Header to retrieve + * + * @return string|null Returns the header string if found, or null if not. + */ + public static function header($message, $header) + { + $match = self::headerLines($message, $header); + return $match ? implode(', ', $match) : null; + } + + /** + * Returns the first header value from a message as a string or null. If + * a header line contains multiple values separated by a comma, then this + * function will return the first value in the list. + * + * @param array $message Request or response hash. + * @param string $header Header to retrieve + * + * @return string|null Returns the value as a string if found. + */ + public static function firstHeader($message, $header) + { + if (!empty($message['headers'])) { + foreach ($message['headers'] as $name => $value) { + if (!strcasecmp($name, $header)) { + // Return the match itself if it is a single value. + $pos = strpos($value[0], ','); + return $pos ? substr($value[0], 0, $pos) : $value[0]; + } + } + } + + return null; + } + + /** + * Returns true if a message has the provided case-insensitive header. + * + * @param array $message Request or response hash. + * @param string $header Header to check + * + * @return bool + */ + public static function hasHeader($message, $header) + { + if (!empty($message['headers'])) { + foreach ($message['headers'] as $name => $value) { + if (!strcasecmp($name, $header)) { + return true; + } + } + } + + return false; + } + + /** + * Parses an array of header lines into an associative array of headers. + * + * @param array $lines Header lines array of strings in the following + * format: "Name: Value" + * @return array + */ + public static function headersFromLines($lines) + { + $headers = []; + + foreach ($lines as $line) { + $parts = explode(':', $line, 2); + $headers[trim($parts[0])][] = isset($parts[1]) + ? trim($parts[1]) + : null; + } + + return $headers; + } + + /** + * Removes a header from a message using a case-insensitive comparison. + * + * @param array $message Message that contains 'headers' + * @param string $header Header to remove + * + * @return array + */ + public static function removeHeader(array $message, $header) + { + if (isset($message['headers'])) { + foreach (array_keys($message['headers']) as $key) { + if (!strcasecmp($header, $key)) { + unset($message['headers'][$key]); + } + } + } + + return $message; + } + + /** + * Replaces any existing case insensitive headers with the given value. + * + * @param array $message Message that contains 'headers' + * @param string $header Header to set. + * @param array $value Value to set. + * + * @return array + */ + public static function setHeader(array $message, $header, array $value) + { + $message = self::removeHeader($message, $header); + $message['headers'][$header] = $value; + + return $message; + } + + /** + * Creates a URL string from a request. + * + * If the "url" key is present on the request, it is returned, otherwise + * the url is built up based on the scheme, host, uri, and query_string + * request values. + * + * @param array $request Request to get the URL from + * + * @return string Returns the request URL as a string. + * @throws \InvalidArgumentException if no Host header is present. + */ + public static function url(array $request) + { + if (isset($request['url'])) { + return $request['url']; + } + + $uri = (isset($request['scheme']) + ? $request['scheme'] : 'http') . '://'; + + if ($host = self::header($request, 'host')) { + $uri .= $host; + } else { + throw new \InvalidArgumentException('No Host header was provided'); + } + + if (isset($request['uri'])) { + $uri .= $request['uri']; + } + + if (isset($request['query_string'])) { + $uri .= '?' . $request['query_string']; + } + + return $uri; + } + + /** + * Reads the body of a message into a string. + * + * @param array|FutureArrayInterface $message Array containing a "body" key + * + * @return null|string Returns the body as a string or null if not set. + * @throws \InvalidArgumentException if a request body is invalid. + */ + public static function body($message) + { + if (!isset($message['body'])) { + return null; + } + + if ($message['body'] instanceof StreamInterface) { + return (string) $message['body']; + } + + switch (gettype($message['body'])) { + case 'string': + return $message['body']; + case 'resource': + return stream_get_contents($message['body']); + case 'object': + if ($message['body'] instanceof \Iterator) { + return implode('', iterator_to_array($message['body'])); + } elseif (method_exists($message['body'], '__toString')) { + return (string) $message['body']; + } + default: + throw new \InvalidArgumentException('Invalid request body: ' + . self::describeType($message['body'])); + } + } + + /** + * Rewind the body of the provided message if possible. + * + * @param array $message Message that contains a 'body' field. + * + * @return bool Returns true on success, false on failure + */ + public static function rewindBody($message) + { + if ($message['body'] instanceof StreamInterface) { + return $message['body']->seek(0); + } + + if ($message['body'] instanceof \Generator) { + return false; + } + + if ($message['body'] instanceof \Iterator) { + $message['body']->rewind(); + return true; + } + + if (is_resource($message['body'])) { + return rewind($message['body']); + } + + return is_string($message['body']) + || (is_object($message['body']) + && method_exists($message['body'], '__toString')); + } + + /** + * Debug function used to describe the provided value type and class. + * + * @param mixed $input + * + * @return string Returns a string containing the type of the variable and + * if a class is provided, the class name. + */ + public static function describeType($input) + { + switch (gettype($input)) { + case 'object': + return 'object(' . get_class($input) . ')'; + case 'array': + return 'array(' . count($input) . ')'; + default: + ob_start(); + var_dump($input); + // normalize float vs double + return str_replace('double(', 'float(', rtrim(ob_get_clean())); + } + } + + /** + * Sleep for the specified amount of time specified in the request's + * ['client']['delay'] option if present. + * + * This function should only be used when a non-blocking sleep is not + * possible. + * + * @param array $request Request to sleep + */ + public static function doSleep(array $request) + { + if (isset($request['client']['delay'])) { + usleep($request['client']['delay'] * 1000); + } + } + + /** + * Returns a proxied future that modifies the dereferenced value of another + * future using a promise. + * + * @param FutureArrayInterface $future Future to wrap with a new future + * @param callable $onFulfilled Invoked when the future fulfilled + * @param callable $onRejected Invoked when the future rejected + * @param callable $onProgress Invoked when the future progresses + * + * @return FutureArray + */ + public static function proxy( + FutureArrayInterface $future, + ?callable $onFulfilled = null, + ?callable $onRejected = null, + ?callable $onProgress = null + ) { + return new FutureArray( + $future->then($onFulfilled, $onRejected, $onProgress), + [$future, 'wait'], + [$future, 'cancel'] + ); + } + + /** + * Returns a debug stream based on the provided variable. + * + * @param mixed $value Optional value + * + * @return resource + */ + public static function getDebugResource($value = null) + { + if (is_resource($value)) { + return $value; + } elseif (defined('STDOUT')) { + return STDOUT; + } else { + return fopen('php://output', 'w'); + } + } +} diff --git a/vendor/ezimuel/ringphp/src/Exception/CancelledException.php b/vendor/ezimuel/ringphp/src/Exception/CancelledException.php new file mode 100644 index 0000000..95b353a --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Exception/CancelledException.php @@ -0,0 +1,7 @@ +wrappedPromise = $promise; + $this->waitfn = $wait; + $this->cancelfn = $cancel; + } + + /** + * @return mixed + */ + public function wait() + { + if (!$this->isRealized) { + $this->addShadow(); + if (!$this->isRealized && $this->waitfn) { + $this->invokeWait(); + } + if (!$this->isRealized) { + $this->error = new RingException('Waiting did not resolve future'); + } + } + + if ($this->error) { + throw $this->error; + } + + return $this->result; + } + + /** + * @return PromiseInterface + */ + public function promise() + { + return $this->wrappedPromise; + } + + /** + * @return PromiseInterface + */ + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null, + ?callable $onProgress = null + ) { + return $this->wrappedPromise->then($onFulfilled, $onRejected, $onProgress); + } + + public function cancel(): void + { + if (!$this->isRealized) { + $cancelfn = $this->cancelfn; + $this->waitfn = $this->cancelfn = null; + $this->isRealized = true; + $this->error = new CancelledFutureAccessException(); + if ($cancelfn) { + $cancelfn($this); + } + } + } + + private function addShadow() + { + // Get the result and error when the promise is resolved. Note that + // calling this function might trigger the resolution immediately. + $this->wrappedPromise->then( + function ($value) { + $this->isRealized = true; + $this->result = $value; + $this->waitfn = $this->cancelfn = null; + }, + function ($error) { + $this->isRealized = true; + $this->error = $error; + $this->waitfn = $this->cancelfn = null; + } + ); + } + + private function invokeWait() + { + try { + $wait = $this->waitfn; + $this->waitfn = null; + $wait(); + } catch (\Exception $e) { + // Defer can throw to reject. + $this->error = $e; + $this->isRealized = true; + } + } +} diff --git a/vendor/ezimuel/ringphp/src/Future/CompletedFutureArray.php b/vendor/ezimuel/ringphp/src/Future/CompletedFutureArray.php new file mode 100644 index 0000000..52ba4a9 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Future/CompletedFutureArray.php @@ -0,0 +1,67 @@ +result[$offset]); + } + + #[\ReturnTypeWillChange] + /** + * @return mixed + */ + public function offsetGet($offset) + { + return $this->result[$offset]; + } + + #[\ReturnTypeWillChange] + /** + * @return void + */ + public function offsetSet($offset, $value) + { + $this->result[$offset] = $value; + } + + #[\ReturnTypeWillChange] + /** + * @return void + */ + public function offsetUnset($offset) + { + unset($this->result[$offset]); + } + + #[\ReturnTypeWillChange] + /** + * @return int + */ + public function count() + { + return count($this->result); + } + + #[\ReturnTypeWillChange] + /** + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->result); + } +} diff --git a/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php b/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php new file mode 100644 index 0000000..75f4aab --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php @@ -0,0 +1,68 @@ +result = $result; + $this->error = $e; + } + + /** + * @return mixed + */ + public function wait() + { + if ($this->error) { + throw $this->error; + } + + return $this->result; + } + + public function cancel(): void + {} + + /** + * @return PromiseInterface + */ + public function promise() + { + if (!$this->cachedPromise) { + $this->cachedPromise = $this->error + ? reject($this->error) + : resolve($this->result); + } + + return $this->cachedPromise; + } + + /** + * @return PromiseInterface + */ + public function then( + ?callable $onFulfilled = null, + ?callable $onRejected = null + ) { + return $this->promise()->then($onFulfilled, $onRejected); + } +} diff --git a/vendor/ezimuel/ringphp/src/Future/FutureArray.php b/vendor/ezimuel/ringphp/src/Future/FutureArray.php new file mode 100644 index 0000000..cb6af69 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Future/FutureArray.php @@ -0,0 +1,65 @@ +_value[$offset]); + } + + #[\ReturnTypeWillChange] + /** + * @return mixed + */ + public function offsetGet($offset) + { + return $this->_value[$offset]; + } + + #[\ReturnTypeWillChange] + /** + * @return void + */ + public function offsetSet($offset, $value) + { + $this->_value[$offset] = $value; + } + + #[\ReturnTypeWillChange] + /** + * @return void + */ + public function offsetUnset($offset) + { + unset($this->_value[$offset]); + } + + #[\ReturnTypeWillChange] + /** + * @return int + */ + public function count() + { + return count($this->_value); + } + + #[\ReturnTypeWillChange] + /** + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->_value); + } +} diff --git a/vendor/ezimuel/ringphp/src/Future/FutureArrayInterface.php b/vendor/ezimuel/ringphp/src/Future/FutureArrayInterface.php new file mode 100644 index 0000000..58f5f73 --- /dev/null +++ b/vendor/ezimuel/ringphp/src/Future/FutureArrayInterface.php @@ -0,0 +1,11 @@ +_value = $this->wait(); + } +} diff --git a/vendor/opensearch-project/opensearch-php/.whitesource b/vendor/opensearch-project/opensearch-php/.whitesource new file mode 100644 index 0000000..e34827b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/.whitesource @@ -0,0 +1,22 @@ +{ + "scanSettings": { + "configMode": "AUTO", + "configExternalURL": "", + "projectToken": "", + "baseBranches": [] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff", + "useMendCheckNames": true + }, + "issueSettings": { + "minSeverityLevel": "LOW", + "issueType": "DEPENDENCY" + }, + "remediateSettings": { + "workflowRules": { + "enabled": true + } + } +} \ No newline at end of file diff --git a/vendor/opensearch-project/opensearch-php/LICENSE b/vendor/opensearch-project/opensearch-php/LICENSE new file mode 100644 index 0000000..1b9d182 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/LICENSE @@ -0,0 +1,13 @@ +This software is licensed under the Apache License, version 2.0 by the OpenSearch Contributors. + +This software also includes certain Elastic software that can be used under the Apache License, Version 2.0 +( or (http://www.apache.org/licenses/LICENSE-2.0)) +or the GNU Lesser General Public License, Version 2.1 +( or (https://www.gnu.org/licenses/lgpl-2.1.html)) + +Election of Apache 2.0. + +For the avoidance of doubt, the OpenSearch Contributors (i) elect to use only the Apache License, Version 2.0 for all +software where a choice of Apache License, Version 2.0 and GNU Lesser General Public License, Version 2.1 is +made available and (ii) elect to use only the Apache License, Version 2.0 on modifications of the software +by OpenSearch Contributors. diff --git a/vendor/opensearch-project/opensearch-php/LICENSE-APACHE b/vendor/opensearch-project/opensearch-php/LICENSE-APACHE new file mode 100644 index 0000000..f49a4e1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/vendor/opensearch-project/opensearch-php/LICENSE-LGPL b/vendor/opensearch-project/opensearch-php/LICENSE-LGPL new file mode 100644 index 0000000..a6f981c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/LICENSE-LGPL @@ -0,0 +1,459 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + [This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your + freedom to share and change it. By contrast, the GNU General Public + Licenses are intended to guarantee your freedom to share and change + free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some + specially designated software packages--typically libraries--of the + Free Software Foundation and other authors who decide to use it. You + can use it too, but we suggest you first think carefully about whether + this license or the ordinary General Public License is the better + strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, + not price. Our General Public Licenses are designed to make sure that + you have the freedom to distribute copies of free software (and charge + for this service if you wish); that you receive source code or can get + it if you want it; that you can change the software and use pieces of + it in new free programs; and that you are informed that you can do + these things. + + To protect your rights, we need to make restrictions that forbid + distributors to deny you these rights or to ask you to surrender these + rights. These restrictions translate to certain responsibilities for + you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis + or for a fee, you must give the recipients all the rights that we gave + you. You must make sure that they, too, receive or can get the source + code. If you link other code with the library, you must provide + complete object files to the recipients, so that they can relink them + with the library after making changes to the library and recompiling + it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the + library, and (2) we offer you this license, which gives you legal + permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that + there is no warranty for the free library. Also, if the library is + modified by someone else and passed on, the recipients should know + that what they have is not the original version, so that the original + author's reputation will not be affected by problems that might be + introduced by others. + + Finally, software patents pose a constant threat to the existence of + any free program. We wish to make sure that a company cannot + effectively restrict the users of a free program by obtaining a + restrictive license from a patent holder. Therefore, we insist that + any patent license obtained for a version of the library must be + consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the + ordinary GNU General Public License. This license, the GNU Lesser + General Public License, applies to certain designated libraries, and + is quite different from the ordinary General Public License. We use + this license for certain libraries in order to permit linking those + libraries into non-free programs. + + When a program is linked with a library, whether statically or using + a shared library, the combination of the two is legally speaking a + combined work, a derivative of the original library. The ordinary + General Public License therefore permits such linking only if the + entire combination fits its criteria of freedom. The Lesser General + Public License permits more lax criteria for linking other code with + the library. + + We call this license the "Lesser" General Public License because it + does Less to protect the user's freedom than the ordinary General + Public License. It also provides other free software developers Less + of an advantage over competing non-free programs. These disadvantages + are the reason we use the ordinary General Public License for many + libraries. However, the Lesser license provides advantages in certain + special circumstances. + + For example, on rare occasions, there may be a special need to + encourage the widest possible use of a certain library, so that it becomes + a de-facto standard. To achieve this, non-free programs must be + allowed to use the library. A more frequent case is that a free + library does the same job as widely used non-free libraries. In this + case, there is little to gain by limiting the free library to free + software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free + programs enables a greater number of people to use a large body of + free software. For example, permission to use the GNU C Library in + non-free programs enables many more people to use the whole GNU + operating system, as well as its variant, the GNU/Linux operating + system. + + Although the Lesser General Public License is Less protective of the + users' freedom, it does ensure that the user of a program that is + linked with the Library has the freedom and the wherewithal to run + that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and + modification follow. Pay close attention to the difference between a + "work based on the library" and a "work that uses the library". The + former contains code derived from the library, whereas the latter must + be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other + program which contains a notice placed by the copyright holder or + other authorized party saying it may be distributed under the terms of + this Lesser General Public License (also called "this License"). + Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data + prepared so as to be conveniently linked with application programs + (which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work + which has been distributed under these terms. A "work based on the + Library" means either the Library or any derivative work under + copyright law: that is to say, a work containing the Library or a + portion of it, either verbatim or with modifications and/or translated + straightforwardly into another language. (Hereinafter, translation is + included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for + making modifications to it. For a library, complete source code means + all the source code for all modules it contains, plus any associated + interface definition files, plus the scripts used to control compilation + and installation of the library. + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of + running a program using the Library is not restricted, and output from + such a program is covered only if its contents constitute a work based + on the Library (independent of the use of the Library in a tool for + writing it). Whether that is true depends on what the Library does + and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's + complete source code as you receive it, in any medium, provided that + you conspicuously and appropriately publish on each copy an + appropriate copyright notice and disclaimer of warranty; keep intact + all the notices that refer to this License and to the absence of any + warranty; and distribute a copy of this License along with the + Library. + + You may charge a fee for the physical act of transferring a copy, + and you may at your option offer warranty protection in exchange for a + fee. + + 2. You may modify your copy or copies of the Library or any portion + of it, thus forming a work based on the Library, and copy and + distribute such modifications or work under the terms of Section 1 + above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Library, + and can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based + on the Library, the distribution of the whole must be on the terms of + this License, whose permissions for other licensees extend to the + entire whole, and thus to each and every part regardless of who wrote + it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Library. + + In addition, mere aggregation of another work not based on the Library + with the Library (or with a work based on the Library) on a volume of + a storage or distribution medium does not bring the other work under + the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public + License instead of this License to a given copy of the Library. To do + this, you must alter all the notices that refer to this License, so + that they refer to the ordinary GNU General Public License, version 2, + instead of to this License. (If a newer version than version 2 of the + ordinary GNU General Public License has appeared, then you can specify + that version instead if you wish.) Do not make any other change in + these notices. + + Once this change is made in a given copy, it is irreversible for + that copy, so the ordinary GNU General Public License applies to all + subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of + the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or + derivative of it, under Section 2) in object code or executable form + under the terms of Sections 1 and 2 above provided that you accompany + it with the complete corresponding machine-readable source code, which + must be distributed under the terms of Sections 1 and 2 above on a + medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy + from a designated place, then offering equivalent access to copy the + source code from the same place satisfies the requirement to + distribute the source code, even though third parties are not + compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the + Library, but is designed to work with the Library by being compiled or + linked with it, is called a "work that uses the Library". Such a + work, in isolation, is not a derivative work of the Library, and + therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library + creates an executable that is a derivative of the Library (because it + contains portions of the Library), rather than a "work that uses the + library". The executable is therefore covered by this License. + Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file + that is part of the Library, the object code for the work may be a + derivative work of the Library even though the source code is not. + Whether this is true is especially significant if the work can be + linked without the Library, or if the work is itself a library. The + threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data + structure layouts and accessors, and small macros and small inline + functions (ten lines or less in length), then the use of the object + file is unrestricted, regardless of whether it is legally a derivative + work. (Executables containing this object code plus portions of the + Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may + distribute the object code for the work under the terms of Section 6. + Any executables containing that work also fall under Section 6, + whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or + link a "work that uses the Library" with the Library to produce a + work containing portions of the Library, and distribute that work + under terms of your choice, provided that the terms permit + modification of the work for the customer's own use and reverse + engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the + Library is used in it and that the Library and its use are covered by + this License. You must supply a copy of this License. If the work + during execution displays copyright notices, you must include the + copyright notice for the Library among them, as well as a reference + directing the user to the copy of this License. Also, you must do one + of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the + Library" must include any data and utility programs needed for + reproducing the executable from it. However, as a special exception, + the materials to be distributed need not include anything that is + normally distributed (in either source or binary form) with the major + components (compiler, kernel, and so on) of the operating system on + which the executable runs, unless that component itself accompanies + the executable. + + It may happen that this requirement contradicts the license + restrictions of other proprietary libraries that do not normally + accompany the operating system. Such a contradiction means you cannot + use both them and the Library together in an executable that you + distribute. + + 7. You may place library facilities that are a work based on the + Library side-by-side in a single library together with other library + facilities not covered by this License, and distribute such a combined + library, provided that the separate distribution of the work based on + the Library and of the other library facilities is otherwise + permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute + the Library except as expressly provided under this License. Any + attempt otherwise to copy, modify, sublicense, link with, or + distribute the Library is void, and will automatically terminate your + rights under this License. However, parties who have received copies, + or rights, from you under this License will not have their licenses + terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Library or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Library (or any work based on the + Library), you indicate your acceptance of this License to do so, and + all its terms and conditions for copying, distributing or modifying + the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the + Library), the recipient automatically receives a license from the + original licensor to copy, distribute, link with or modify the Library + subject to these terms and conditions. You may not impose any further + restrictions on the recipients' exercise of the rights granted herein. + You are not responsible for enforcing compliance by third parties with + this License. + + 11. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot + distribute so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you + may not distribute the Library at all. For example, if a patent + license would not permit royalty-free redistribution of the Library by + all those who receive copies directly or indirectly through you, then + the only way you could satisfy both it and this License would be to + refrain entirely from distribution of the Library. + + If any portion of this section is held invalid or unenforceable under any + particular circumstance, the balance of the section is intended to apply, + and the section as a whole is intended to apply in other circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system which is + implemented by public license practices. Many people have made + generous contributions to the wide range of software distributed + through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is willing + to distribute software through any other system and a licensee cannot + impose that choice. + + This section is intended to make thoroughly clear what is believed to + be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Library under this License may add + an explicit geographical distribution limitation excluding those countries, + so that distribution is permitted only in or among countries not thus + excluded. In such case, this License incorporates the limitation as if + written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new + versions of the Lesser General Public License from time to time. + Such new versions will be similar in spirit to the present version, + but may differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the Library + specifies a version number of this License which applies to it and + "any later version", you have the option of following the terms and + conditions either of that version or of any later version published by + the Free Software Foundation. If the Library does not specify a + license version number, you may choose any version ever published by + the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free + programs whose distribution conditions are incompatible with these, + write to the author to ask for permission. For software which is + copyrighted by the Free Software Foundation, write to the Free + Software Foundation; we sometimes make exceptions for this. Our + decision will be guided by the two goals of preserving the free status + of all derivatives of our free software and of promoting the sharing + and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. + EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE + LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME + THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY + AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU + FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE + LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING + RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A + FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF + SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/vendor/opensearch-project/opensearch-php/NOTICE b/vendor/opensearch-project/opensearch-php/NOTICE new file mode 100644 index 0000000..4cdb9f1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/NOTICE @@ -0,0 +1,44 @@ +This software is licensed under the Apache 2.0 by the OpenSearch Contributors. + +Election of Apache 2.0. + +For the avoidance of doubt, the OpenSearch Contributors +(i) elect to use only the Apache License, Version 2.0 for all software where a + choice of Apache License, Version 2.0 and GNU Lesser General Public License, Version 2.1 is made available and +(ii) elect to use only the Apache License, Version 2.0 on modifications of the software by OpenSearch Contributors. + +This software includes certain Elastic software that included the following in the NOTICE file +located here: https://github.com/elastic/elasticsearch-php/blob/master/NOTICE + +Apache v2.0 Notice: + Copyright 2013-2014 Elasticsearch + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +LGPL v2.1 Notice: + Copyright (C) 2013-2014 Elasticsearch + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA \ No newline at end of file diff --git a/vendor/opensearch-project/opensearch-php/OpenSearch.svg b/vendor/opensearch-project/opensearch-php/OpenSearch.svg new file mode 100644 index 0000000..bd4ae0f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/OpenSearch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/opensearch-project/opensearch-php/README.md b/vendor/opensearch-project/opensearch-php/README.md new file mode 100644 index 0000000..4310ec7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/README.md @@ -0,0 +1,49 @@ +![OpenSearch logo](OpenSearch.svg) + +- [Welcome!](#welcome) +- [Project Resources](#project-resources) +- [Code of Conduct](#code-of-conduct) +- [Sample code](#sample-code) +- [Compatibility with OpenSearch](#compatibility-with-opensearch) +- [License](#license) +- [Copyright](#copyright) + +## Welcome! + +**opensearch-php** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/) of elasticsearch-php licensed under the [Apache v2.0 License](LICENSE). For more information, see [opensearch.org](https://opensearch.org/). + +## Project Resources + +* [Project Website](https://opensearch.org/) +* [User Guide](USER_GUIDE.md) +* [Samples](samples) +* [Developer Guide](DEVELOPER_GUIDE.md) +* [Downloads](https://opensearch.org/downloads/). +* [Documentation](https://docs.opensearch.org/latest/) +* Need help? Try [Forums](https://forum.opensearch.org/) +* [Project Principles](https://opensearch.org/#principles) +* [Contributing to OpenSearch](CONTRIBUTING.md) +* [Maintainer Responsibilities](MAINTAINERS.md) +* [Release Management](RELEASING.md) +* [Admin Responsibilities](ADMINS.md) +* [Security](SECURITY.md) + +## Code of Conduct + +This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments. + +## Sample code + +See [Sample Code](USER_GUIDE.md). + +## Compatibility with OpenSearch + +See [Compatibility](COMPATIBILITY.md). + +## License + +This project is licensed under the [Apache v2.0 License](LICENSE). + +## Copyright + +Copyright OpenSearch Contributors. See [NOTICE](NOTICE) for details. diff --git a/vendor/opensearch-project/opensearch-php/SECURITY.md b/vendor/opensearch-project/opensearch-php/SECURITY.md new file mode 100644 index 0000000..261a60f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/SECURITY.md @@ -0,0 +1,3 @@ +## Reporting a Vulnerability + +If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue. diff --git a/vendor/opensearch-project/opensearch-php/UPGRADING.md b/vendor/opensearch-project/opensearch-php/UPGRADING.md new file mode 100644 index 0000000..adf80cc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/UPGRADING.md @@ -0,0 +1,63 @@ +- [Upgrading OpenSearch PHP Client](#upgrading-opensearch-php-client) + - [Upgrading to \>= 2.4.0](#upgrading-to--240) + - [PSR-18 HTTP Client Interfaces](#psr-18-http-client-interfaces) + - [Configuring Guzzle HTTP Client in 2.4.x](#configuring-guzzle-http-client-in-24x) + - [Configuring Symfony HTTP Client in 2.4.x](#configuring-symfony-http-client-in-24x) + +# Upgrading OpenSearch PHP Client + +## Upgrading to >= 2.4.0 + +The openseach-php library removes the hard-coded dependency on the [Guzzle HTTP client](https://docs.guzzlephp.org/en/stable/#) and switches to the following PSR interfaces: + +- [PSR-7 HTTP message interfaces](https://www.php-fig.org/psr/psr-7/) +- [PSR-17 HTTP Factories](https://www.php-fig.org/psr/psr-17/) +- [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/) + +You can continue to use Guzzle, but will need to configure it as a PSR-18 HTTP Client. + +### PSR-18 HTTP Client Interfaces + +Starting with opensearch-php 2.4.0 you can use any PSR-18 compatible HTTP client. + +To simplify creating a Client, we provide two factories to create PSR-18 HTTP clients for Guzzle and Symfony HTTP clients since opensearch-php 2.5.0. + +### Configuring Guzzle HTTP Client in 2.4.x + +To configure Guzzle as a PSR HTTP Client with the similar configuration to opensearch-php 1.x you can use the following example: + +Ensure the Guzzle packages are installed via composer: + +```php +composer require guzzlehttp/guzzle +``` + +```php +$client = (new \OpenSearch\GuzzleClientFactory())->create([ + 'base_uri' => 'https://localhost:9200', + 'auth' => ['admin', getenv('OPENSEARCH_PASSWORD')], + 'verify' => false, +]); + +// Send a request to the 'info' endpoint. +$info = $client->info(); +``` + +### Configuring Symfony HTTP Client in 2.4.x + +You can configure [Symfony HTTP Client](https://symfony.com/doc/current/http_client.html) as a PSR HTTP Client using the following example: + +```php +composer require symfony/http-client +``` + +```php +$client = (new \OpenSearch\SymfonyClientFactory())->create([ + 'base_uri' => 'https://localhost:9200', + 'auth_basic' => ['admin', getenv('OPENSEARCH_PASSWORD')], + 'verify_peer' => false, +]); + +// Send a request to the 'info' endpoint. +$info = $client->info(); +``` diff --git a/vendor/opensearch-project/opensearch-php/bin/console b/vendor/opensearch-project/opensearch-php/bin/console new file mode 100755 index 0000000..49dbc8a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/bin/console @@ -0,0 +1,13 @@ +#!/usr/bin/env php +addCommand(new GenerateEndpointsCommand()); +$app->addCommand(new UpdateChangelogCommand()); +$app->run(); diff --git a/vendor/opensearch-project/opensearch-php/composer.json b/vendor/opensearch-project/opensearch-php/composer.json new file mode 100644 index 0000000..027dffa --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/composer.json @@ -0,0 +1,114 @@ +{ + "name": "opensearch-project/opensearch-php", + "description": "PHP Client for OpenSearch", + "keywords": [ + "search", + "client", + "opensearch", + "elasticsearch" + ], + "type": "library", + "license": [ + "Apache-2.0", + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Elastic" + }, + { + "name": "OpenSearch Contributors" + } + ], + "require": { + "php": "^8.2", + "ext-json": ">=1.3.7", + "ext-curl": "*", + "ezimuel/ringphp": "^1.4.0", + "php-http/discovery": "^1.20", + "psr/http-client": "^1.0.3", + "psr/http-client-implementation": "*", + "psr/http-factory": "^1.1.0", + "psr/http-factory-implementation": "*", + "psr/http-message": "^2.0", + "psr/http-message-implementation": "*", + "psr/log": "^3.0.2", + "symfony/yaml": "^v6.4.26|^7.3.5|^v8.0.0" + }, + "require-dev": { + "ext-zip": "*", + "aws/aws-sdk-php": "^3.359.8", + "colinodell/psr-testlogger": "^1.3.1", + "friendsofphp/php-cs-fixer": "^v3.89.1", + "guzzlehttp/psr7": "^2.8.0", + "mockery/mockery": "^1.6.12", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.32", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "phpstan/phpstan-mockery": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.4.2", + "phpunit/phpunit": "^10.5.58", + "react/promise": "^v3.3", + "symfony/console": "v6.4.31|^7.4.3|^8.0.3", + "symfony/finder": "^v6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client": "^6.4.31|^7.4.3|^v8.0.3", + "symfony/http-client-contracts": "^v3.6.0|^v8.0.3", + "twig/twig": "^3.0" + }, + "suggest": { + "monolog/monolog": "Allows for client-level logging and tracing", + "aws/aws-sdk-php": "Required (^3.0.0) in order to use the AWS Signing Client Decorator", + "guzzlehttp/psr7": "Required (^2.7) in order to use the Guzzle HTTP client", + "symfony/http-client": "Required (^6.4|^7.0|^8.0) in order to use the Symfony HTTP client" + }, + "autoload": { + "psr-4": { + "OpenSearch\\": "src/OpenSearch/" + } + }, + "autoload-dev": { + "psr-4": { + "OpenSearch\\Tests\\": "tests/", + "OpenSearch\\Util\\": "util/" + } + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "php-http/discovery": true, + "phpstan/extension-installer": true + } + }, + "scripts": { + "php-cs": [ + "php-cs-fixer fix" + ], + "phpstan": [ + "phpstan analyse --no-progress" + ], + "unit": [ + "phpunit --exclude-group integration" + ], + "integration": [ + "phpunit --group integration" + ], + "integration-min": [ + "phpunit --group integration-min" + ], + "phpunit": [ + "phpunit" + ], + "apigen": [ + "rm -f apigen", + "curl -L https://github.com/ApiGen/ApiGen/releases/download/v7.0.0-alpha.4/apigen.phar -o apigen", + "chmod +x apigen", + "./apigen src --output docs", + "rm -f apigen" + ], + "generate-api": [ + "php bin/console app:generate-endpoints", + "composer run php-cs", + "php bin/console app:update-changelog" + ] + } +} diff --git a/vendor/opensearch-project/opensearch-php/lychee.toml b/vendor/opensearch-project/opensearch-php/lychee.toml new file mode 100644 index 0000000..1bb5419 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/lychee.toml @@ -0,0 +1,6 @@ +exclude_path = ["vendor"] +accept = ["200","403","429"] +exclude = [ + "https://localhost:9200", + "^mailto:", +] diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientDecorator.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientDecorator.php new file mode 100644 index 0000000..1240dcf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientDecorator.php @@ -0,0 +1,45 @@ +headers as $name => $value) { + $request = $request->withHeader($name, $value); + } + + if (empty($request->getHeaderLine('Host'))) { + throw new \RuntimeException('Missing Host header.'); + } + + $request = $request->withHeader('x-amz-content-sha256', hash('sha256', (string) $request->getBody())); + $request = $this->signer->signRequest($request, $this->credentials); + return $this->inner->sendRequest($request); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientFactory.php new file mode 100644 index 0000000..f31cb16 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Aws/SigningClientFactory.php @@ -0,0 +1,115 @@ + $options + * The AWS auth options. + */ + public function create(ClientInterface $innerClient, array $options): ClientInterface + { + if (!isset($options['host'])) { + throw new \InvalidArgumentException('The host option is required.'); + } + + // Get the credentials. + $provider = $this->getCredentialProvider($options); + $promise = $provider(); + try { + $credentials = $promise->wait(); + } catch (CredentialsException $e) { + $this->logger?->error('Failed to get AWS credentials: @message', ['@message' => $e->getMessage()]); + $credentials = new Credentials('', ''); + } + + // Get the signer. + $signer = $this->getSigner($options); + + return new SigningClientDecorator($innerClient, $credentials, $signer, ['host' => $options['host']]); + } + + /** + * Gets the credential provider. + * + * @param array $options + * The options array. + */ + protected function getCredentialProvider(array $options): CredentialProvider|\Closure|null|callable + { + // Check for a provided credential provider. + if ($this->provider) { + return $this->provider; + } + + // Check for provided access key and secret. + if (isset($options['credentials'])) { + return CredentialProvider::fromCredentials( + new Credentials( + $options['credentials']['access_key'] ?? '', + $options['credentials']['secret_key'] ?? '', + $options['credentials']['session_token'] ?? null, + ) + ); + } + + // Fallback to the default provider. + return CredentialProvider::defaultProvider(); + } + + /** + * Gets the request signer. + * + * @param array $options + * The options. + */ + protected function getSigner(array $options): SignatureInterface + { + if ($this->signer) { + return $this->signer; + } + + if (!isset($options['region'])) { + throw new \InvalidArgumentException('The region option is required.'); + } + + $service = $options['service'] ?? 'es'; + + if (!in_array($service, self::ALLOWED_SERVICES, true)) { + throw new \InvalidArgumentException('The service option must be either "es" or "aoss".'); + } + + return new SignatureV4($service, $options['region'], $options); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php new file mode 100644 index 0000000..7640bf7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php @@ -0,0 +1,2257 @@ +transport = $transport; + // @phpstan-ignore new.deprecated + $this->httpTransport = new LegacyTransportWrapper($transport); + } else { + $this->httpTransport = $transport; + } + + if (is_callable($endpointFactory)) { + @trigger_error('Passing a callable as the $endpointFactory param in ' . __METHOD__ . ' is deprecated in 2.4.0 and will be removed in 3.0.0. Pass an instance of \OpenSearch\EndpointFactoryInterface instead.', E_USER_DEPRECATED); + $endpoints = $endpointFactory; + // @phpstan-ignore new.deprecated + $endpointFactory = new LegacyEndpointFactory($endpointFactory); + } else { + if ($endpointFactory === null) { + $endpointFactory = new EndpointFactory(); + } + $endpoints = function ($c) use ($endpointFactory) { + @trigger_error('The $endpoints property is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); + }; + } + + // @phpstan-ignore property.deprecated + $this->endpoints = $endpoints; + $this->endpointFactory = $endpointFactory; + // @phpstan-ignore new.deprecated, property.deprecated + $this->asyncSearch = new AsyncSearchNamespace($transport, $this->endpointFactory); + $this->asynchronousSearch = new AsynchronousSearchNamespace($transport, $this->endpointFactory); + $this->cat = new CatNamespace($transport, $this->endpointFactory); + $this->cluster = new ClusterNamespace($transport, $this->endpointFactory); + $this->danglingIndices = new DanglingIndicesNamespace($transport, $this->endpointFactory); + // @phpstan-ignore new.deprecated, property.deprecated + $this->dataFrameTransformDeprecated = new DataFrameTransformDeprecatedNamespace($transport, $this->endpointFactory); + $this->flowFramework = new FlowFrameworkNamespace($transport, $this->endpointFactory); + $this->geospatial = new GeospatialNamespace($transport, $this->endpointFactory); + $this->indices = new IndicesNamespace($transport, $this->endpointFactory); + $this->ingest = new IngestNamespace($transport, $this->endpointFactory); + $this->ingestion = new IngestionNamespace($transport, $this->endpointFactory); + $this->insights = new InsightsNamespace($transport, $this->endpointFactory); + $this->ism = new IsmNamespace($transport, $this->endpointFactory); + $this->knn = new KnnNamespace($transport, $this->endpointFactory); + $this->list = new ListNamespace($transport, $this->endpointFactory); + $this->ltr = new LtrNamespace($transport, $this->endpointFactory); + $this->ml = new MlNamespace($transport, $this->endpointFactory); + // @phpstan-ignore new.deprecated, property.deprecated + $this->monitoring = new MonitoringNamespace($transport, $this->endpointFactory); + $this->neural = new NeuralNamespace($transport, $this->endpointFactory); + $this->nodes = new NodesNamespace($transport, $this->endpointFactory); + $this->notifications = new NotificationsNamespace($transport, $this->endpointFactory); + $this->observability = new ObservabilityNamespace($transport, $this->endpointFactory); + $this->ppl = new PplNamespace($transport, $this->endpointFactory); + $this->query = new QueryNamespace($transport, $this->endpointFactory); + $this->remoteStore = new RemoteStoreNamespace($transport, $this->endpointFactory); + $this->replication = new ReplicationNamespace($transport, $this->endpointFactory); + $this->rollups = new RollupsNamespace($transport, $this->endpointFactory); + $this->searchPipeline = new SearchPipelineNamespace($transport, $this->endpointFactory); + $this->searchRelevance = new SearchRelevanceNamespace($transport, $this->endpointFactory); + // @phpstan-ignore new.deprecated, property.deprecated + $this->searchableSnapshots = new SearchableSnapshotsNamespace($transport, $this->endpointFactory); + $this->security = new SecurityNamespace($transport, $this->endpointFactory); + $this->securityAnalytics = new SecurityAnalyticsNamespace($transport, $this->endpointFactory); + $this->sm = new SmNamespace($transport, $this->endpointFactory); + $this->snapshot = new SnapshotNamespace($transport, $this->endpointFactory); + $this->sql = new SqlNamespace($transport, $this->endpointFactory); + // @phpstan-ignore new.deprecated, property.deprecated + $this->ssl = new SslNamespace($transport, $this->endpointFactory); + $this->tasks = new TasksNamespace($transport, $this->endpointFactory); + $this->transforms = new TransformsNamespace($transport, $this->endpointFactory); + $this->ubi = new UbiNamespace($transport, $this->endpointFactory); + $this->wlm = new WlmNamespace($transport, $this->endpointFactory); + + $this->registeredNamespaces = $registeredNamespaces; + } + + /** + * Allows to perform multiple index/update/delete operations in a single request. + * + * @param array{index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, pipeline?: string, refresh?: mixed, require_alias?: bool, routing?: string, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the data stream, index, or index alias to perform bulk actions on. + * - _source: `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude from the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - pipeline: ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. + * - require_alias: If `true`, the request's actions must target an index alias. (Default: false) + * - routing: A custom value used to route operations to a specific shard. + * - timeout: Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The operation definition and data (action-data pairs), separated by newlines (Required) + * @return array + */ + public function bulk(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Bulk::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to perform multiple index/update/delete operations using request response streaming. + * + * @param array{index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, batch_interval?: string, batch_size?: int, pipeline?: string, refresh?: mixed, require_alias?: bool, routing?: mixed, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the data stream, index, or index alias to perform bulk actions on. + * - _source: `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude from the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - batch_interval: Specifies for how long bulk operations should be accumulated into a batch before sending the batch to data nodes. + * - batch_size: Specifies how many bulk operations should be accumulated into a batch before sending the batch to data nodes. + * - pipeline: ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. + * - require_alias: If `true`, the request's actions must target an index alias. (Default: false) + * - routing: A custom value used to route operations to a specific shard. + * - timeout: Period each action waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The operation definition and data (action-data pairs), separated by newlines (Required) + * @return array + */ + public function bulkStream(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(BulkStream::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Explicitly clears the search context for a scroll. + * + * @param array{scroll_id?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - scroll_id: A comma-separated list of scroll IDs to clear. To clear all scroll IDs, use `_all`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: A comma-separated list of scroll IDs to clear if none was specified using the `scroll_id` parameter + * @return array + */ + public function clearScroll(array $params = []) + { + $scroll_id = $this->extractArgument($params, 'scroll_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ClearScroll::class); + $endpoint->setParams($params); + $endpoint->setScrollId($scroll_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns number of documents matching a query. + * + * @param array{index?: mixed, allow_no_indices?: bool, analyze_wildcard?: bool, analyzer?: string, default_operator?: mixed, df?: string, expand_wildcards?: mixed, ignore_throttled?: bool, ignore_unavailable?: bool, lenient?: bool, min_score?: int|float, preference?: string, q?: string, routing?: mixed, terminate_after?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. This parameter can only be used when the `q` query string parameter is specified. (Default: false) + * - analyzer: Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. + * - default_operator: The default operator for query string query: `AND` or `OR`. This parameter can only be used when the `q` query string parameter is specified. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. + * - expand_wildcards: + * - ignore_throttled: If `true`, concrete, expanded or aliased indexes are ignored when frozen. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + * - min_score: Sets the minimum `_score` value that documents must have to be included in the result. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - q: Query in the Lucene query string syntax. + * - routing: A custom value used to route operations to a specific shard. + * - terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Query to restrict the results specified with the Query DSL (optional) + * @return array + */ + public function count(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Count::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates point in time context. + * + * @param array{index?: mixed, allow_partial_pit_creation?: bool, expand_wildcards?: mixed, keep_alive?: string, preference?: string, routing?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * - allow_partial_pit_creation: Allow if point in time can be created with partial failures. + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - keep_alive: Specify the keep alive for point in time. + * - preference: Specify the node or shard the operation should be performed on. (Default: random) + * - routing: A comma-separated list of specific routing values. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function createPit(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(CreatePit::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Removes a document from the index. + * + * @param array{id?: string, index?: string, if_primary_term?: int, if_seq_no?: int, refresh?: mixed, routing?: mixed, timeout?: string, version?: int, version_type?: mixed, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The unique identifier for the document. (Required) + * - index: Name of the target index. + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. + * - routing: A custom value used to route operations to a specific shard. + * - timeout: Period to wait for active shards. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type: `external`, `external_gte`. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function delete(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Deletes all active point in time searches. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteAllPits(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteAllPits::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Deletes documents matching the provided query. + * + * @param array{index?: mixed, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, allow_no_indices?: bool, analyze_wildcard?: bool, analyzer?: string, conflicts?: mixed, default_operator?: mixed, df?: string, expand_wildcards?: mixed, from?: int, ignore_unavailable?: bool, lenient?: bool, max_docs?: int, preference?: string, q?: string, refresh?: mixed, request_cache?: bool, requests_per_second?: int|float, routing?: mixed, scroll?: string, scroll_size?: int, search_timeout?: string, search_type?: mixed, size?: int, slices?: mixed, sort?: mixed, stats?: mixed, terminate_after?: int, timeout?: string, version?: bool, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: List of fields to exclude from the returned `_source` field. + * - _source_includes: List of fields to extract and return from the `_source` field. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. (Default: false) + * - analyzer: Analyzer to use for the query string. + * - conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. + * - default_operator: The default operator for query string query: `AND` or `OR`. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - from: Starting offset. (Default: 0) + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + * - max_docs: Maximum number of documents to process. Defaults to all documents. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - q: Query in the Lucene query string syntax. + * - refresh: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. + * - request_cache: If `true`, the request cache is used for this request. Defaults to the index-level setting. + * - requests_per_second: The throttle for this request in sub-requests per second. (Default: 0) + * - routing: A custom value used to route operations to a specific shard. + * - scroll: Period to retain the search context for scrolling. + * - scroll_size: Size of the scroll request that powers the operation. (Default: 100) + * - search_timeout: Explicit timeout for each search request. Defaults to no timeout. + * - search_type: The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. + * - size: Deprecated, use `max_docs` instead. + * - slices: The number of slices this task should be divided into. + * - sort: A comma-separated list of : pairs. + * - stats: Specific `tag` of the request for logging and statistical purposes. + * - terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indexes across multiple data tiers. + * - timeout: Period each deletion request waits for active shards. + * - version: If `true`, returns the document version as part of a hit. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: If `true`, the request blocks until the operation is complete. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition using the Query DSL (Required) + * @return array + */ + public function deleteByQuery(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteByQuery::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Changes the number of requests per second for a particular Delete By Query operation. + * + * @param array{task_id?: string, requests_per_second?: int|float, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - task_id: The ID for the task. + * - requests_per_second: The throttle for this request in sub-requests per second. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteByQueryRethrottle(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteByQueryRethrottle::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes one or more point in time searches based on the IDs passed. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The point-in-time ids to be deleted + * @return array + */ + public function deletePit(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DeletePit::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a script. + * + * @param array{id?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Identifier for the stored script or search template. (Required) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteScript(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteScript::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about whether a document exists in an index. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, preference?: string, realtime?: bool, refresh?: mixed, routing?: mixed, stored_fields?: mixed, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Identifier of the document. (Required) + * - index: A comma-separated list of data streams, indexes, and aliases. Supports wildcards (`*`). + * - _source: `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude in the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - realtime: If `true`, the request is real time as opposed to near real time. + * - refresh: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. + * - routing: Target the specified primary shard. + * - stored_fields: List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to false. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type: `external`, `external_gte`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function exists(array $params = []): bool + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(Exists::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns information about whether a document source exists in an index. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, preference?: string, realtime?: bool, refresh?: mixed, routing?: mixed, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Identifier of the document. (Required) + * - index: A comma-separated list of data streams, indexes, and aliases. Supports wildcards (`*`). + * - _source: `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude in the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - realtime: If `true`, the request is real time as opposed to near real time. + * - refresh: If `true`, OpenSearch refreshes all shards involved in the delete by query after the request completes. + * - routing: Target the specified primary shard. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type: `external`, `external_gte`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsSource(array $params = []): bool + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsSource::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns information about why a specific document matches (or doesn't match) a query. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, analyze_wildcard?: bool, analyzer?: string, default_operator?: mixed, df?: string, lenient?: bool, preference?: string, q?: string, routing?: mixed, stored_fields?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: Defines the document ID. (Required) + * - index: Index names used to limit the request. Only a single index name can be provided to this parameter. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude from the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. (Default: false) + * - analyzer: Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. + * - default_operator: The default operator for query string query: `AND` or `OR`. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. (Default: _all) + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - q: Query in the Lucene query string syntax. + * - routing: A custom value used to route operations to a specific shard. + * - stored_fields: A comma-separated list of stored fields to return in the response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The query definition using the Query DSL + * @return array + */ + public function explain(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns the information about the capabilities of fields among multiple indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, fields?: mixed, ignore_unavailable?: bool, include_unmapped?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indexes, omit this parameter or use * or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. + * - expand_wildcards: The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - fields: A comma-separated list of fields to retrieve capabilities for. Wildcard (`*`) expressions are supported. + * - ignore_unavailable: If `true`, missing or closed indexes are not included in the response. + * - include_unmapped: If `true`, unmapped fields are included in the response. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: An index filter specified with the Query DSL + * @return array + */ + public function fieldCaps(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(FieldCaps::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns a document. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, preference?: string, realtime?: bool, refresh?: mixed, routing?: mixed, stored_fields?: mixed, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The unique identifier of the document. (Required) + * - index: The name of the index containing the document. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude in the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - realtime: If `true`, the request is real time as opposed to near real time. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search. If `false`, do nothing with refreshes. + * - routing: Target the specified primary shard. + * - stored_fields: List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to false. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type: `internal`, `external`, `external_gte`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Lists all active point in time searches. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllPits(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAllPits::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns a script. + * + * @param array{id?: string, cluster_manager_timeout?: string, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Identifier for the stored script or search template. (Required) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Specify timeout for connection to master + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getScript(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetScript::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns all script contexts. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getScriptContext(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetScriptContext::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns available script types, languages and contexts. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getScriptLanguages(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetScriptLanguages::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns the source of a document. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, preference?: string, realtime?: bool, refresh?: mixed, routing?: mixed, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The unique identifier of the document. (Required) + * - index: The name of the index containing the document. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude in the response. + * - _source_includes: A comma-separated list of source fields to include in the response. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - realtime: Boolean) If `true`, the request is real time as opposed to near real time. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search. If `false`, do nothing with refreshes. + * - routing: Target the specified primary shard. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type. One of `internal`, `external`, `external_gte`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSource(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetSource::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates a document in an index. + * + * @param array{index?: string, id?: string, if_primary_term?: int, if_seq_no?: int, op_type?: mixed, pipeline?: string, refresh?: mixed, require_alias?: bool, routing?: mixed, timeout?: string, version?: int, version_type?: mixed, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the data stream or index to target. + * - id: The unique identifier for the document. (Required) + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - op_type: Set to create to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. Same as using the `/_create` endpoint. Valid values: `index`, `create`. If document id is specified, it defaults to `index`. Otherwise, it defaults to `create`. + * - pipeline: ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. + * - refresh: If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. + * - require_alias: If `true`, the destination must be an index alias. (Default: false) + * - routing: A custom value used to route operations to a specific shard. + * - timeout: Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + * - version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. + * - version_type: The specific version type: `external`, `external_gte`. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The document (Required) + * @return array + */ + public function index(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Index::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns basic information about the cluster. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function info(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Info::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Allows to get multiple documents in one request. + * + * @param array{index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, preference?: string, realtime?: bool, refresh?: mixed, routing?: mixed, stored_fields?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. + * - _source_includes: A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - realtime: If `true`, the request is real time as opposed to near real time. + * - refresh: If `true`, the request refreshes relevant shards before retrieving documents. + * - routing: A custom value used to route operations to a specific shard. + * - stored_fields: If `true`, retrieves the document fields stored in the index rather than the document `_source`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. (Required) + * @return array + */ + public function mget(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Mget::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to execute several search operations in one request. + * + * @param array{index?: mixed, allow_partial_results?: bool, ccs_minimize_roundtrips?: bool, max_concurrent_searches?: int, max_concurrent_shard_requests?: int, pre_filter_shard_size?: int, rest_total_hits_as_int?: bool, search_type?: mixed, typed_keys?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and index aliases to search. + * - allow_partial_results: Specifies whether to return partial results if there are shard request timeouts or shard failures (Default: true) + * - ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating node and remote clusters are minimized for cross-cluster search requests. (Default: true) + * - max_concurrent_searches: Maximum number of concurrent searches the multi search API can execute. + * - max_concurrent_shard_requests: Maximum number of concurrent shard requests that each sub-search request executes per node. (Default: 5) + * - pre_filter_shard_size: Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. + * - rest_total_hits_as_int: If `true`, `hits.total` are returned as an integer in the response. Defaults to false, which returns an object. (Default: false) + * - search_type: Indicates whether global term and document frequencies should be used when scoring returned documents. + * - typed_keys: Specifies whether aggregation and suggester names should be prefixed by their respective types in the response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The request definitions (metadata-search request definition pairs), separated by newlines (Required) + * @return array + */ + public function msearch(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Msearch::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to execute several search template operations in one request. + * + * @param array{index?: mixed, ccs_minimize_roundtrips?: bool, max_concurrent_searches?: int, rest_total_hits_as_int?: bool, search_type?: mixed, typed_keys?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*`. + * - ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. (Default: true) + * - max_concurrent_searches: Maximum number of concurrent searches the API can run. + * - rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. (Default: false) + * - search_type: The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. + * - typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The request definitions (metadata-search request definition pairs), separated by newlines (Required) + * @return array + */ + public function msearchTemplate(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(MsearchTemplate::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns multiple termvectors in one request. + * + * @param array{index?: string, field_statistics?: bool, fields?: mixed, ids?: mixed, offsets?: bool, payloads?: bool, positions?: bool, preference?: string, realtime?: bool, routing?: mixed, term_statistics?: bool, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index that contains the document. + * - field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. (Default: true) + * - fields: + * - ids: A comma-separated list of documents IDs. You must provide either the `docs` field in the request body or specify `ids` as a query parameter or in the request body. + * - offsets: If `true`, the response includes term offsets. (Default: true) + * - payloads: If `true`, the response includes term payloads. (Default: true) + * - positions: If `true`, the response includes term positions. (Default: true) + * - preference: Specifies the node or shard on which the operation should be performed. See [preference query parameter]({{site.url}}{{site.baseurl}}/api-reference/search-apis/search/#the-preference-query-parameter) for a list of available options. By default the requests are routed randomly to available shard copies (primary or replica), with no guarantee of consistency across repeated queries. + * - realtime: If `true`, the request is real time as opposed to near real time. (Default: true) + * - routing: A custom value used to route operations to a specific shard. + * - term_statistics: If `true`, the response includes term frequency and document frequency. (Default: false) + * - version: If `true`, returns the document version as part of a hit. + * - version_type: The specific version type. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. + * @return array + */ + public function mtermvectors(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(MTermVectors::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns whether the cluster is running. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function ping(array $params = []): bool + { // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(Ping::class); + $endpoint->setParams($params); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Creates or updates a script. + * + * @param array{id?: string, context?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: Identifier for the stored script or search template. Must be unique within the cluster. (Required) + * - context: Context in which the script or search template should run. To prevent errors, the API immediately compiles the script or template in this context. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The document (Required) + * @return array + */ + public function putScript(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $context = $this->extractArgument($params, 'context'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutScript::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setContext($context); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to evaluate the quality of ranked search results over a set of typical search queries. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, search_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indexes in a cluster, omit this parameter or use `_all` or `*`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - ignore_unavailable: If `true`, missing or closed indexes are not included in the response. + * - search_type: Search operation type + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (Required) + * @return array + */ + public function rankEval(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RankEval::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to copy documents from one index to another, optionally filtering the sourcedocuments by a query, changing the destination index settings, or fetching thedocuments from a remote cluster. + * + * @param array{max_docs?: int, refresh?: mixed, requests_per_second?: int|float, require_alias?: bool, scroll?: string, slices?: mixed, timeout?: string, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - max_docs: Maximum number of documents to process. By default, all documents. + * - refresh: If `true`, the request refreshes affected shards to make this operation visible to search. + * - requests_per_second: The throttle for this request in sub-requests per second. Defaults to no throttle. (Default: 0) + * - require_alias: + * - scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. + * - slices: The number of slices this task should be divided into. Defaults to 1 slice, meaning the task isn't sliced into subtasks. + * - timeout: Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: If `true`, the request blocks until the operation is complete. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition using the Query DSL and the prototype for the index request. (Required) + * @return array + */ + public function reindex(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Reindex::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Changes the number of requests per second for a particular reindex operation. + * + * @param array{task_id?: string, requests_per_second?: int|float, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - task_id: Identifier for the task. + * - requests_per_second: The throttle for this request in sub-requests per second. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function reindexRethrottle(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(ReindexRethrottle::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition template and its parameters. + * @return array + */ + public function renderSearchTemplate(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RenderSearchTemplate::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows an arbitrary script to be executed and a result to be returned. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The script to execute + * @return array + */ + public function scriptsPainlessExecute(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ScriptsPainlessExecute::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to retrieve a large numbers of results from a single search request. + * + * @param array{scroll_id?: string, rest_total_hits_as_int?: bool, scroll?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - scroll_id: The scroll ID for scrolled search + * - rest_total_hits_as_int: If `true`, the API response's `hit.total` property is returned as an integer. If `false`, the API response's `hit.total` property is returned as an object. (Default: false) + * - scroll: Period to retain the search context for scrolling. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function scroll(array $params = []) + { + $scroll_id = $this->extractArgument($params, 'scroll_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Scroll::class); + $endpoint->setParams($params); + $endpoint->setScrollId($scroll_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns results matching a query. + * + * @param array{index?: mixed, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, allow_no_indices?: bool, allow_partial_search_results?: bool, analyze_wildcard?: bool, analyzer?: string, batched_reduce_size?: int, cancel_after_time_interval?: string, ccs_minimize_roundtrips?: bool, default_operator?: mixed, df?: string, docvalue_fields?: mixed, expand_wildcards?: mixed, explain?: bool, from?: int, ignore_throttled?: bool, ignore_unavailable?: bool, include_named_queries_score?: bool, lenient?: bool, max_concurrent_shard_requests?: int, phase_took?: bool, pre_filter_shard_size?: int, preference?: string, q?: string, request_cache?: bool, rest_total_hits_as_int?: bool, routing?: mixed, scroll?: string, search_pipeline?: string, search_type?: mixed, seq_no_primary_term?: bool, size?: int, sort?: mixed, stats?: mixed, stored_fields?: mixed, suggest_field?: string, suggest_mode?: mixed, suggest_size?: int, suggest_text?: string, terminate_after?: int, timeout?: string, track_scores?: bool, track_total_hits?: mixed, typed_keys?: bool, verbose_pipeline?: bool, version?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams and indexes, omit this parameter or use `*` or `_all`. + * - _source: Indicates which source fields are returned for matching documents. These fields are returned in the `hits._source` property of the search response. Valid values are: `true` to return the entire document source; `false` to not return the document source; `` to return the source fields that are specified as a comma-separated list (supports wildcard (`*`) patterns). + * - _source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. + * - _source_includes: A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - allow_partial_search_results: If `true`, returns partial results if there are shard request timeouts or shard failures. If `false`, returns an error with no partial results. (Default: true) + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. This parameter can only be used when the q query string parameter is specified. (Default: false) + * - analyzer: Analyzer to use for the query string. This parameter can only be used when the q query string parameter is specified. + * - batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. (Default: 512) + * - cancel_after_time_interval: The time after which the search request will be canceled. Request-level parameter takes precedence over `cancel_after_time_interval` cluster setting. + * - ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. (Default: true) + * - default_operator: The default operator for query string query: AND or OR. This parameter can only be used when the `q` query string parameter is specified. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified. + * - docvalue_fields: A comma-separated list of fields to return as the docvalue representation for each hit. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - explain: If `true`, returns detailed information about score computation as part of a hit. + * - from: Starting document offset. Needs to be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. (Default: 0) + * - ignore_throttled: If `true`, concrete, expanded or aliased indexes will be ignored when frozen. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - include_named_queries_score: Indicates whether `hit.matched_queries` should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) (Default: false) + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can only be used when the `q` query string parameter is specified. + * - max_concurrent_shard_requests: Defines the number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. (Default: 5) + * - phase_took: Indicates whether to return phase-level `took` time values in the response. (Default: false) + * - pre_filter_shard_size: Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: the request targets more than 128 shards; the request targets one or more read-only index; the primary sort of the query targets an indexed field. + * - preference: Nodes and shards used for the search. By default, OpenSearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: `_only_local` to run the search only on shards on the local node; `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method; `_only_nodes:,` to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; `_shards:,` to run the search only on the specified shards; `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. (Default: random) + * - q: Query in the Lucene query string syntax using query parameter search. Query parameter searches do not support the full OpenSearch Query DSL but are handy for testing. + * - request_cache: If `true`, the caching of search results is enabled for requests where `size` is `0`. Defaults to index level settings. + * - rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. (Default: false) + * - routing: A custom value used to route operations to a specific shard. + * - scroll: Period to retain the search context for scrolling. See Scroll search results. By default, this value cannot exceed `1d` (24 hours). You can change this limit using the `search.max_keep_alive` cluster-level setting. + * - search_pipeline: Customizable sequence of processing stages applied to search queries. + * - search_type: How distributed term frequencies are calculated for relevance scoring. + * - seq_no_primary_term: If `true`, returns sequence number and primary term of the last modification of each hit. + * - size: Defines the number of hits to return. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. (Default: 10) + * - sort: A comma-separated list of : pairs. + * - stats: Specific `tag` of the request for logging and statistical purposes. + * - stored_fields: A comma-separated list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the `_source` parameter defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response. + * - suggest_field: Specifies which field to use for suggestions. + * - suggest_mode: Specifies the suggest mode. This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. (Options: always, missing, popular) + * - suggest_size: Number of suggestions to return. This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. + * - suggest_text: The source text for which the suggestions should be returned. This parameter can only be used when the `suggest_field` and `suggest_text` query string parameters are specified. + * - terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indexes across multiple data tiers. If set to `0` (default), the query does not terminate early. + * - timeout: Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. + * - track_scores: If `true`, calculate and return document scores, even if the scores are not used for sorting. + * - track_total_hits: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. + * - typed_keys: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. + * - verbose_pipeline: Enables or disables verbose mode for the search pipeline. When verbose mode is enabled, detailed information about each processor in the search pipeline is included in the search response. This includes the processor name, execution status, input, output, and time taken for processing. This parameter is primarily intended for debugging purposes, allowing users to track how data flows and transforms through the search pipeline. + * - version: If `true`, returns document version as part of a hit. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition using the Query DSL + * @return array + */ + public function search(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Search::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about the indexes and shards that a search request would be executed against. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, local?: bool, preference?: string, routing?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Returns the indexes and shards that a search request would be executed against. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - routing: A custom value used to route operations to a specific shard. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchShards(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchShards::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param array{index?: mixed, allow_no_indices?: bool, ccs_minimize_roundtrips?: bool, expand_wildcards?: mixed, explain?: bool, ignore_throttled?: bool, ignore_unavailable?: bool, phase_took?: bool, preference?: string, profile?: bool, rest_total_hits_as_int?: bool, routing?: mixed, scroll?: string, search_pipeline?: string, search_type?: mixed, typed_keys?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. (Default: true) + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - explain: If `true`, the response includes additional details about score computation as part of a hit. + * - ignore_throttled: If `true`, specified concrete, expanded, or aliased indexes are not included in the response when throttled. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - phase_took: Indicates whether to return phase-level `took` time values in the response. (Default: false) + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - profile: If `true`, the query execution is profiled. + * - rest_total_hits_as_int: If `true`, `hits.total` are rendered as an integer in the response. (Default: false) + * - routing: A custom value used to route operations to a specific shard. + * - scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. + * - search_pipeline: Customizable sequence of processing stages applied to search queries. + * - search_type: The type of the search operation. + * - typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition template and its parameters. (Required) + * @return array + */ + public function searchTemplate(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchTemplate::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information and statistics about terms in the fields of a particular document. + * + * @param array{index?: string, id?: string, field_statistics?: bool, fields?: mixed, offsets?: bool, payloads?: bool, positions?: bool, preference?: string, realtime?: bool, routing?: mixed, term_statistics?: bool, version?: int, version_type?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index containing the document. + * - id: The unique identifier of the document. (Required) + * - field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. (Default: true) + * - fields: + * - offsets: If `true`, the response includes term offsets. (Default: true) + * - payloads: If `true`, the response includes term payloads. (Default: true) + * - positions: If `true`, the response includes term positions. (Default: true) + * - preference: Specifies the node or shard on which the operation should be performed. See [preference query parameter]({{site.url}}{{site.baseurl}}/api-reference/search-apis/search/#the-preference-query-parameter) for a list of available options. By default the requests are routed randomly to available shard copies (primary or replica), with no guarantee of consistency across repeated queries. + * - realtime: If `true`, the request is real time as opposed to near real time. (Default: true) + * - routing: A custom value used to route operations to a specific shard. + * - term_statistics: If `true`, the response includes term frequency and document frequency. (Default: false) + * - version: If `true`, returns the document version as part of a hit. + * - version_type: The specific version type. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Define parameters and or supply a document to get termvectors for. See documentation. + * @return array + */ + public function termvectors(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(TermVectors::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates a document with a script or partial document. + * + * @param array{id?: string, index?: string, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, if_primary_term?: int, if_seq_no?: int, lang?: string, refresh?: mixed, require_alias?: bool, retry_on_conflict?: int, routing?: mixed, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: Document ID (Required) + * - index: The name of the index + * - _source: Set to `false` to disable source retrieval. You can also specify a comma-separated list of the fields you want to retrieve. + * - _source_excludes: Specify the source fields you want to exclude. + * - _source_includes: Specify the source fields you want to retrieve. + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - lang: The script language. (Default: painless) + * - refresh: If 'true', OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. + * - require_alias: If `true`, the destination must be an index alias. (Default: false) + * - retry_on_conflict: Specify how many times should the operation be retried when a conflict occurs. (Default: 0) + * - routing: A custom value used to route operations to a specific shard. + * - timeout: Period to wait for dynamic mapping updates and active shards. This guarantees OpenSearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operations. Set to 'all' or any positive integer up to the total number of shards in the index (number_of_replicas+1). Defaults to 1 meaning the primary shard. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The request definition requires either `script` or partial `doc` (Required) + * @return array + */ + public function update(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Update::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Performs an update on every document in the index without changing the source,for example to pick up a mapping change. + * + * @param array{index?: mixed, _source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, allow_no_indices?: bool, analyze_wildcard?: bool, analyzer?: string, conflicts?: mixed, default_operator?: mixed, df?: string, expand_wildcards?: mixed, from?: int, ignore_unavailable?: bool, lenient?: bool, max_docs?: int, pipeline?: string, preference?: string, q?: string, refresh?: mixed, request_cache?: bool, requests_per_second?: int|float, routing?: mixed, scroll?: string, scroll_size?: int, search_timeout?: string, search_type?: mixed, size?: int, slices?: mixed, sort?: mixed, stats?: mixed, terminate_after?: int, timeout?: string, version?: bool, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`. + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: List of fields to exclude from the returned `_source` field. + * - _source_includes: List of fields to extract and return from the `_source` field. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. (Default: false) + * - analyzer: Analyzer to use for the query string. + * - conflicts: What to do if update by query hits version conflicts: `abort` or `proceed`. + * - default_operator: The default operator for query string query: `AND` or `OR`. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - from: Starting offset. (Default: 0) + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + * - max_docs: Maximum number of documents to process. Defaults to all documents. + * - pipeline: ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. + * - preference: Specifies the node or shard the operation should be performed on. Random by default. (Default: random) + * - q: Query in the Lucene query string syntax. + * - refresh: If `true`, OpenSearch refreshes affected shards to make the operation visible to search. + * - request_cache: If `true`, the request cache is used for this request. + * - requests_per_second: The throttle for this request in sub-requests per second. (Default: 0) + * - routing: A custom value used to route operations to a specific shard. + * - scroll: Period to retain the search context for scrolling. + * - scroll_size: Size of the scroll request that powers the operation. (Default: 100) + * - search_timeout: Explicit timeout for each search request. + * - search_type: The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`. + * - size: Deprecated, use `max_docs` instead. + * - slices: The number of slices this task should be divided into. + * - sort: A comma-separated list of : pairs. + * - stats: Specific `tag` of the request for logging and statistical purposes. + * - terminate_after: Maximum number of documents to collect for each shard. If a query reaches this limit, OpenSearch terminates the query early. OpenSearch collects documents before sorting. Use with caution. OpenSearch applies this parameter to each shard handling the request. When possible, let OpenSearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indexes across multiple data tiers. + * - timeout: Period each update request waits for the following operations: dynamic mapping updates, waiting for active shards. + * - version: If `true`, returns the document version as part of a hit. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: If `true`, the request blocks until the operation is complete. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The search definition using the Query DSL + * @return array + */ + public function updateByQuery(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateByQuery::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Changes the number of requests per second for a particular Update By Query operation. + * + * @param array{task_id?: string, requests_per_second?: int|float, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - task_id: The ID for the task. + * - requests_per_second: The throttle for this request in sub-requests per second. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function updateByQueryRethrottle(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateByQueryRethrottle::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Proxy function to createPointInTime() to prevent BC break. + * This API will be removed in a future version. Use 'createPit' API instead. + */ + public function createPointInTime(array $params = []) + { + return $this->createPit($params); + } + /** + * Creates a new document in the index.Returns a 409 response when a document with a same ID already exists in the index. + * + * $params['id'] = (string) Unique identifier for the document. (Required) + * $params['index'] = (string) Name of the data stream or index to target. If the target doesn’t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If the target doesn’t exist and doesn’t match a data stream template, this request creates the index. (Required) + * $params['pipeline'] = (string) ID of the pipeline to use to preprocess incoming documents.If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.If a final pipeline is configured it will always run, regardless of the value of this parameter. + * $params['refresh'] = (enum) If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes.Valid values: `true`, `false`, `wait_for`. (Options = true,false,wait_for) + * $params['routing'] = (string) Custom value used to route operations to a specific shard. + * $params['timeout'] = (string) Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. + * $params['version'] = (number) Explicit version number for concurrency control.The specified version must match the current version of the document for the request to succeed. + * $params['version_type'] = (enum) Specific version type: `external`, `external_gte`. (Options = internal,external,external_gte,force) + * $params['wait_for_active_shards'] = (any) The number of shard copies that must be active before proceeding with the operation.Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['body'] = (array) The document (Required) + * + * @param array $params Associative array of parameters + * @return array + */ + public function create(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $id ? + $this->endpointFactory->getEndpoint(Create::class) + : $this->endpointFactory->getEndpoint(Index::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to deletePointInTime() to prevent BC break. + * This API will be removed in a future version. Use 'deletePit' API instead. + */ + public function deletePointInTime(array $params = []) + { + return $this->deletePit($params); + } + /** + * Returns the asyncSearch namespace + * + * @deprecated in 2.4.2 and will be removed in 3.0.0. + */ + public function asyncSearch(): AsyncSearchNamespace + { + @trigger_error(__METHOD__ . '() is deprecated since 2.4.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $this->asyncSearch; + } + /** + * Returns the asynchronousSearch namespace + */ + public function asynchronousSearch(): AsynchronousSearchNamespace + { + return $this->asynchronousSearch; + } + /** + * Returns the cat namespace + */ + public function cat(): CatNamespace + { + return $this->cat; + } + /** + * Returns the cluster namespace + */ + public function cluster(): ClusterNamespace + { + return $this->cluster; + } + /** + * Returns the danglingIndices namespace + */ + public function danglingIndices(): DanglingIndicesNamespace + { + return $this->danglingIndices; + } + /** + * Returns the dataFrameTransformDeprecated namespace + * + * @deprecated in 2.4.2 and will be removed in 3.0.0. + */ + public function dataFrameTransformDeprecated(): DataFrameTransformDeprecatedNamespace + { + @trigger_error(__METHOD__ . '() is deprecated since 2.4.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $this->dataFrameTransformDeprecated; + } + /** + * Returns the flowFramework namespace + */ + public function flowFramework(): FlowFrameworkNamespace + { + return $this->flowFramework; + } + /** + * Returns the geospatial namespace + */ + public function geospatial(): GeospatialNamespace + { + return $this->geospatial; + } + /** + * Returns the indices namespace + */ + public function indices(): IndicesNamespace + { + return $this->indices; + } + /** + * Returns the ingest namespace + */ + public function ingest(): IngestNamespace + { + return $this->ingest; + } + /** + * Returns the ingestion namespace + */ + public function ingestion(): IngestionNamespace + { + return $this->ingestion; + } + /** + * Returns the insights namespace + */ + public function insights(): InsightsNamespace + { + return $this->insights; + } + /** + * Returns the ism namespace + */ + public function ism(): IsmNamespace + { + return $this->ism; + } + /** + * Returns the knn namespace + */ + public function knn(): KnnNamespace + { + return $this->knn; + } + /** + * Returns the list namespace + */ + public function list(): ListNamespace + { + return $this->list; + } + /** + * Returns the ltr namespace + */ + public function ltr(): LtrNamespace + { + return $this->ltr; + } + /** + * Returns the ml namespace + */ + public function ml(): MlNamespace + { + return $this->ml; + } + /** + * Returns the monitoring namespace + * + * @deprecated in 2.4.2 and will be removed in 3.0.0. + */ + public function monitoring(): MonitoringNamespace + { + @trigger_error(__METHOD__ . '() is deprecated since 2.4.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $this->monitoring; + } + /** + * Returns the neural namespace + */ + public function neural(): NeuralNamespace + { + return $this->neural; + } + /** + * Returns the nodes namespace + */ + public function nodes(): NodesNamespace + { + return $this->nodes; + } + /** + * Returns the notifications namespace + */ + public function notifications(): NotificationsNamespace + { + return $this->notifications; + } + /** + * Returns the observability namespace + */ + public function observability(): ObservabilityNamespace + { + return $this->observability; + } + /** + * Returns the ppl namespace + */ + public function ppl(): PplNamespace + { + return $this->ppl; + } + /** + * Returns the query namespace + */ + public function query(): QueryNamespace + { + return $this->query; + } + /** + * Returns the remoteStore namespace + */ + public function remoteStore(): RemoteStoreNamespace + { + return $this->remoteStore; + } + /** + * Returns the replication namespace + */ + public function replication(): ReplicationNamespace + { + return $this->replication; + } + /** + * Returns the rollups namespace + */ + public function rollups(): RollupsNamespace + { + return $this->rollups; + } + /** + * Returns the searchPipeline namespace + */ + public function searchPipeline(): SearchPipelineNamespace + { + return $this->searchPipeline; + } + /** + * Returns the searchRelevance namespace + */ + public function searchRelevance(): SearchRelevanceNamespace + { + return $this->searchRelevance; + } + /** + * Returns the searchableSnapshots namespace + * + * @deprecated in 2.4.2 and will be removed in 3.0.0. + */ + public function searchableSnapshots(): SearchableSnapshotsNamespace + { + @trigger_error(__METHOD__ . '() is deprecated since 2.4.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $this->searchableSnapshots; + } + /** + * Returns the security namespace + */ + public function security(): SecurityNamespace + { + return $this->security; + } + /** + * Returns the securityAnalytics namespace + */ + public function securityAnalytics(): SecurityAnalyticsNamespace + { + return $this->securityAnalytics; + } + /** + * Returns the sm namespace + */ + public function sm(): SmNamespace + { + return $this->sm; + } + /** + * Returns the snapshot namespace + */ + public function snapshot(): SnapshotNamespace + { + return $this->snapshot; + } + /** + * Returns the sql namespace + */ + public function sql(): SqlNamespace + { + return $this->sql; + } + /** + * Returns the ssl namespace + * + * @deprecated in 2.4.2 and will be removed in 3.0.0. + */ + public function ssl(): SslNamespace + { + @trigger_error(__METHOD__ . '() is deprecated since 2.4.2 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $this->ssl; + } + /** + * Returns the tasks namespace + */ + public function tasks(): TasksNamespace + { + return $this->tasks; + } + /** + * Returns the transforms namespace + */ + public function transforms(): TransformsNamespace + { + return $this->transforms; + } + /** + * Returns the ubi namespace + */ + public function ubi(): UbiNamespace + { + return $this->ubi; + } + /** + * Returns the wlm namespace + */ + public function wlm(): WlmNamespace + { + return $this->wlm; + } + + /** + * Gets the endpoint factory. + */ + protected function getEndpointFactory(): EndpointFactoryInterface + { + return $this->endpointFactory; + } + + /** + * Catchall for registered namespaces + * + * @return object + * @throws \BadMethodCallException if the namespace cannot be found + */ + public function __call(string $name, array $arguments) + { + if (isset($this->registeredNamespaces[$name])) { + return $this->registeredNamespaces[$name]; + } + throw new \BadMethodCallException("Namespace [$name] not found"); + } + + /** + * Extract an argument from the array of parameters + * + * @return null|mixed + */ + public function extractArgument(array &$params, string $arg) + { + if (array_key_exists($arg, $params) === true) { + $value = $params[$arg]; + $value = (is_object($value) && !is_iterable($value)) ? + (array) $value : + $value; + unset($params[$arg]); + return $value; + } else { + return null; + } + } + + /** + * Send a raw request to the cluster. + * + * @throws \Psr\Http\Client\ClientExceptionInterface + * @throws \OpenSearch\Exception\HttpExceptionInterface + */ + public function request( + string $method, + string $uri, + array $attributes = [] + ): iterable|string|null { + $params = $attributes['params'] ?? []; + $body = $attributes['body'] ?? null; + $options = $attributes['options'] ?? []; + + return $this->httpTransport->sendRequest($method, $uri, $params, $body, $options['headers'] ?? []); + } + + /** + * Send a request for an endpoint. + * + * @throws \Psr\Http\Client\ClientExceptionInterface + * @throws \OpenSearch\Exception\HttpExceptionInterface + */ + private function performRequest(AbstractEndpoint $endpoint): iterable|string|null + { + return $this->httpTransport->sendRequest( + $endpoint->getMethod(), + $endpoint->getURI(), + $endpoint->getParams(), + $endpoint->getBody(), + $endpoint->getOptions() + ); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientBuilder.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientBuilder.php new file mode 100644 index 0000000..e65fdbf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientBuilder.php @@ -0,0 +1,861 @@ + true + ]; + + /** + * @var array|null + */ + private $hosts; + + /** + * @var array + */ + private $connectionParams; + + /** + * @var int|null + */ + private $retries; + + /** + * @var null|callable + */ + private $sigV4CredentialProvider; + + /** + * @var null|string + */ + private $sigV4Region; + + /** + * @var null|string + */ + private $sigV4Service; + + /** + * @var bool + */ + private $sniffOnStart = false; + + /** + * @var null|array + */ + private $sslCert; + + /** + * @var null|array + */ + private $sslKey; + + /** + * @var null|bool|string + */ + private $sslVerification; + + /** + * @var bool + */ + private $includePortInHostHeader = false; + + /** + * @var string|null + */ + private $basicAuthentication = null; + + /** + * Create an instance of ClientBuilder + */ + public static function create(): ClientBuilder + { + return new self(); + } + + /** + * Can supply first param to Client::__construct() when invoking manually or with dependency injection + */ + public function getTransport(): Transport + { + return $this->transport; + } + + /** + * Can supply second param to Client::__construct() when invoking manually or with dependency injection + * + * @deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\ClientBuilder::getEndpointFactory() instead. + */ + public function getEndpoint(): callable + { + @trigger_error(__METHOD__ . '() is deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\ClientBuilder::getEndpointFactory() instead.', E_USER_DEPRECATED); + return fn ($c) => $this->endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); + } + + /** + * Can supply third param to Client::__construct() when invoking manually or with dependency injection + * + * @return NamespaceBuilderInterface[] + */ + public function getRegisteredNamespacesBuilders(): array + { + return $this->registeredNamespacesBuilders; + } + + /** + * Build a new client from the provided config. Hash keys + * should correspond to the method name e.g. ['connectionPool'] + * corresponds to setConnectionPool(). + * + * Missing keys will use the default for that setting if applicable + * + * Unknown keys will throw an exception by default, but this can be silenced + * by setting `quiet` to true + * + * @param array $config + * @param bool $quiet False if unknown settings throw exception, true to silently + * ignore unknown settings + * @throws Common\Exceptions\RuntimeException + */ + public static function fromConfig(array $config, bool $quiet = false): Client + { + $builder = new self(); + foreach ($config as $key => $value) { + $method = in_array($key, self::ALLOWED_METHODS_FROM_CONFIG, true) ? $key : "set$key"; + $reflection = new ReflectionClass($builder); + if ($reflection->hasMethod($method)) { + $func = $reflection->getMethod($method); + if ($func->getNumberOfParameters() > 1) { + $builder->$method(...$value); + } else { + $builder->$method($value); + } + unset($config[$key]); + } + } + + if ($quiet === false && count($config) > 0) { + $unknown = implode(array_keys($config)); + throw new RuntimeException("Unknown parameters provided: $unknown"); + } + return $builder->build(); + } + + /** + * Get the default handler + * + * @param array $multiParams + * @param array $singleParams + * @throws \RuntimeException + */ + public static function defaultHandler(array $multiParams = [], array $singleParams = []): callable + { + $future = null; + if (extension_loaded('curl')) { + $config = array_merge([ 'mh' => curl_multi_init() ], $multiParams); + if (function_exists('curl_reset')) { + $default = new CurlHandler($singleParams); + $future = new CurlMultiHandler($config); + } else { + $default = new CurlMultiHandler($config); + } + } else { + throw new \RuntimeException('OpenSearch-PHP requires cURL, or a custom HTTP handler.'); + } + + return $future ? Middleware::wrapFuture($default, $future) : $default; + } + + /** + * Get the multi handler for async (CurlMultiHandler) + * + * @throws \RuntimeException + */ + public static function multiHandler(array $params = []): CurlMultiHandler + { + if (function_exists('curl_multi_init')) { + return new CurlMultiHandler(array_merge([ 'mh' => curl_multi_init() ], $params)); + } + + throw new \RuntimeException('CurlMulti handler requires cURL.'); + } + + /** + * Get the handler instance (CurlHandler) + * + * @throws \RuntimeException + */ + public static function singleHandler(): CurlHandler + { + if (function_exists('curl_reset')) { + return new CurlHandler(); + } + + throw new \RuntimeException('CurlSingle handler requires cURL.'); + } + + /** + * Set connection Factory + * + * @param ConnectionFactoryInterface $connectionFactory + */ + public function setConnectionFactory(ConnectionFactoryInterface $connectionFactory): ClientBuilder + { + $this->connectionFactory = $connectionFactory; + + return $this; + } + + /** + * Set the connection pool (default is StaticNoPingConnectionPool) + * + * @param AbstractConnectionPool|string $connectionPool + * @param array $args + * @throws \InvalidArgumentException + */ + public function setConnectionPool($connectionPool, array $args = []): ClientBuilder + { + if (is_string($connectionPool)) { + $this->connectionPool = $connectionPool; + $this->connectionPoolArgs = $args; + } elseif (is_object($connectionPool)) { + $this->connectionPool = $connectionPool; + } else { + throw new InvalidArgumentException("Serializer must be a class path or instantiated object extending AbstractConnectionPool"); + } + + return $this; + } + + /** + * Set the endpoint + * + * @param callable $endpoint + * + * @deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\ClientBuilder::setEndpointFactory() instead. + */ + public function setEndpoint(callable $endpoint): ClientBuilder + { + @trigger_error(__METHOD__ . '() is deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\ClientBuilder::setEndpointFactory() instead.', E_USER_DEPRECATED); + $this->endpointFactory = new LegacyEndpointFactory($endpoint); + + return $this; + } + + public function setEndpointFactory(EndpointFactoryInterface $endpointFactory): ClientBuilder + { + $this->endpointFactory = $endpointFactory; + return $this; + } + + /** + * Register namespace + * + * @param NamespaceBuilderInterface $namespaceBuilder + */ + public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder): ClientBuilder + { + $this->registeredNamespacesBuilders[] = $namespaceBuilder; + + return $this; + } + + /** + * Set the transport + * + * @param Transport $transport + */ + public function setTransport(Transport $transport): ClientBuilder + { + $this->transport = $transport; + + return $this; + } + + /** + * Set the HTTP handler (cURL is default) + * + * @param mixed $handler + */ + public function setHandler($handler): ClientBuilder + { + $this->handler = $handler; + + return $this; + } + + /** + * Set the PSR-3 Logger + * + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): ClientBuilder + { + $this->logger = $logger; + + return $this; + } + + /** + * Set the PSR-3 tracer + * + * @param LoggerInterface $tracer + */ + public function setTracer(LoggerInterface $tracer): ClientBuilder + { + $this->tracer = $tracer; + + return $this; + } + + /** + * Set the serializer + * + * @param \OpenSearch\Serializers\SerializerInterface|string $serializer + */ + public function setSerializer($serializer): ClientBuilder + { + $this->parseStringOrObject($serializer, $this->serializer, 'SerializerInterface'); + + return $this; + } + + /** + * Set the hosts (nodes) + * + * @param array $hosts + */ + public function setHosts(array $hosts): ClientBuilder + { + $this->hosts = $hosts; + + return $this; + } + + /** + * Set Basic access authentication + * + * @see https://en.wikipedia.org/wiki/Basic_access_authentication + * @param string $username + * @param string $password + * + * @throws AuthenticationConfigException + */ + public function setBasicAuthentication(string $username, string $password): ClientBuilder + { + $this->basicAuthentication = $username.':'.$password; + + return $this; + } + + /** + * Set connection parameters + * + * @param array $params + */ + public function setConnectionParams(array $params): ClientBuilder + { + $this->connectionParams = $params; + + return $this; + } + + /** + * Set number or retries (default is equal to number of nodes) + * + * @param int $retries + */ + public function setRetries(int $retries): ClientBuilder + { + $this->retries = $retries; + + return $this; + } + + /** + * Set the selector algorithm + * + * @param \OpenSearch\ConnectionPool\Selectors\SelectorInterface|string $selector + */ + public function setSelector($selector): ClientBuilder + { + $this->parseStringOrObject($selector, $this->selector, 'SelectorInterface'); + + return $this; + } + + /** + * Set the credential provider for SigV4 request signing. The value provider should be a + * callable object that will return + * + * @param callable|bool|array|CredentialsInterface|null $credentialProvider + */ + public function setSigV4CredentialProvider($credentialProvider): ClientBuilder + { + if ($credentialProvider !== null && $credentialProvider !== false) { + $this->sigV4CredentialProvider = $this->normalizeCredentialProvider($credentialProvider); + } + + return $this; + } + + /** + * Set the region for SigV4 signing. + * + * @param string|null $region + */ + public function setSigV4Region($region): ClientBuilder + { + $this->sigV4Region = $region; + + return $this; + } + + /** + * Set the service for SigV4 signing. + * + * @param string|null $service + */ + public function setSigV4Service($service): ClientBuilder + { + $this->sigV4Service = $service; + + return $this; + } + + /** + * Set sniff on start + * + * @param bool $sniffOnStart enable or disable sniff on start + */ + + public function setSniffOnStart(bool $sniffOnStart): ClientBuilder + { + $this->sniffOnStart = $sniffOnStart; + + return $this; + } + + /** + * Set SSL certificate + * + * @param string $cert The name of a file containing a PEM formatted certificate. + * @param string $password if the certificate requires a password + */ + public function setSSLCert(string $cert, ?string $password = null): ClientBuilder + { + $this->sslCert = [$cert, $password]; + + return $this; + } + + /** + * Set SSL key + * + * @param string $key The name of a file containing a private SSL key + * @param string $password if the private key requires a password + */ + public function setSSLKey(string $key, ?string $password = null): ClientBuilder + { + $this->sslKey = [$key, $password]; + + return $this; + } + + /** + * Set SSL verification + * + * @param bool|string $value + */ + public function setSSLVerification($value = true): ClientBuilder + { + $this->sslVerification = $value; + + return $this; + } + + /** + * Include the port in Host header + * + * @see https://github.com/elastic/elasticsearch-php/issues/993 + */ + public function includePortInHostHeader(bool $enable): ClientBuilder + { + $this->includePortInHostHeader = $enable; + + return $this; + } + + /** + * Build and returns the Client object + */ + public function build(): Client + { + $this->buildLoggers(); + + if (is_null($this->handler)) { + $this->handler = ClientBuilder::defaultHandler(); + } + + if (!is_null($this->sigV4CredentialProvider)) { + if (is_null($this->sigV4Region)) { + throw new RuntimeException("A region must be supplied for SigV4 request signing."); + } + + if (is_null($this->sigV4Service)) { + $this->setSigV4Service("es"); + } + + $this->handler = new SigV4Handler($this->sigV4Region, $this->sigV4Service, $this->sigV4CredentialProvider, $this->handler); + } + + $sslOptions = null; + if (isset($this->sslKey)) { + $sslOptions['ssl_key'] = $this->sslKey; + } + if (isset($this->sslCert)) { + $sslOptions['cert'] = $this->sslCert; + } + if (isset($this->sslVerification)) { + $sslOptions['verify'] = $this->sslVerification; + } + + if (!is_null($sslOptions)) { + $sslHandler = function (callable $handler, array $sslOptions) { + return function (array $request) use ($handler, $sslOptions) { + // Add our custom headers + foreach ($sslOptions as $key => $value) { + $request['client'][$key] = $value; + } + + // Send the request using the handler and return the response. + return $handler($request); + }; + }; + $this->handler = $sslHandler($this->handler, $sslOptions); + } + + if (is_null($this->serializer)) { + $this->serializer = new SmartSerializer(); + } elseif (is_string($this->serializer)) { + $this->serializer = new $this->serializer(); + } + + $this->connectionParams['client']['port_in_header'] = $this->includePortInHostHeader; + + if (! is_null($this->basicAuthentication)) { + if (isset($this->connectionParams['client']['curl']) === false) { + $this->connectionParams['client']['curl'] = []; + } + + $this->connectionParams['client']['curl'] += [ + CURLOPT_HTTPAUTH => CURLAUTH_BASIC, + CURLOPT_USERPWD => $this->basicAuthentication + ]; + } + + if (is_null($this->connectionFactory)) { + // Make sure we are setting Content-Type and Accept (unless the user has explicitly + // overridden it + if (! isset($this->connectionParams['client']['headers'])) { + $this->connectionParams['client']['headers'] = []; + } + if (! isset($this->connectionParams['client']['headers']['Content-Type'])) { + $this->connectionParams['client']['headers']['Content-Type'] = ['application/json']; + } + if (! isset($this->connectionParams['client']['headers']['Accept'])) { + $this->connectionParams['client']['headers']['Accept'] = ['application/json']; + } + + $this->connectionFactory = new ConnectionFactory($this->handler, $this->connectionParams, $this->serializer, $this->logger, $this->tracer); + } + + if (is_null($this->hosts)) { + $this->hosts = $this->getDefaultHost(); + } + + if (is_null($this->selector)) { + $this->selector = new RoundRobinSelector(); + } elseif (is_string($this->selector)) { + $this->selector = new $this->selector(); + } + + $this->buildTransport(); + + if (is_null($this->endpointFactory)) { + $this->endpointFactory = new EndpointFactory($this->serializer); + } + + $registeredNamespaces = []; + foreach ($this->registeredNamespacesBuilders as $builder) { + /** + * @var NamespaceBuilderInterface $builder + */ + $registeredNamespaces[$builder->getName()] = $builder->getObject($this->transport, $this->serializer); + } + + return $this->instantiate($this->transport, $this->endpointFactory, $registeredNamespaces); + } + + protected function instantiate(Transport $transport, EndpointFactoryInterface $endpointFactory, array $registeredNamespaces): Client + { + return new Client($transport, $endpointFactory, $registeredNamespaces); + } + + private function buildLoggers(): void + { + if (is_null($this->logger)) { + $this->logger = new NullLogger(); + } + + if (is_null($this->tracer)) { + $this->tracer = new NullLogger(); + } + } + + private function buildTransport(): void + { + $connections = $this->buildConnectionsFromHosts($this->hosts); + + if (is_string($this->connectionPool)) { + $this->connectionPool = new $this->connectionPool( + $connections, + $this->selector, + $this->connectionFactory, + $this->connectionPoolArgs + ); + } + + if (is_null($this->retries)) { + $this->retries = count($connections); + } + + if (is_null($this->transport)) { + $this->transport = new Transport($this->retries, $this->connectionPool, $this->logger, $this->sniffOnStart); + } + } + + private function parseStringOrObject($arg, &$destination, $interface): void + { + if (is_string($arg)) { + $destination = new $arg(); + } elseif (is_object($arg)) { + $destination = $arg; + } else { + throw new InvalidArgumentException("Serializer must be a class path or instantiated object implementing $interface"); + } + } + + private function getDefaultHost(): array + { + return ['localhost:9200']; + } + + /** + * @return ConnectionInterface[] + * @throws RuntimeException + */ + private function buildConnectionsFromHosts(array $hosts): array + { + $connections = []; + foreach ($hosts as $host) { + if (is_string($host)) { + $host = $this->prependMissingScheme($host); + $host = $this->extractURIParts($host); + } elseif (is_array($host)) { + $host = $this->normalizeExtendedHost($host); + } else { + $this->logger->error("Could not parse host: ".print_r($host, true)); + throw new RuntimeException("Could not parse host: ".print_r($host, true)); + } + + $connections[] = $this->connectionFactory->create($host); + } + + return $connections; + } + + /** + * @throws RuntimeException + */ + private function normalizeExtendedHost(array $host): array + { + if (isset($host['host']) === false) { + $this->logger->error("Required 'host' was not defined in extended format: ".print_r($host, true)); + throw new RuntimeException("Required 'host' was not defined in extended format: ".print_r($host, true)); + } + + if (isset($host['scheme']) === false) { + $host['scheme'] = 'http'; + } + if (isset($host['port']) === false) { + $host['port'] = 9200; + } + return $host; + } + + /** + * @throws InvalidArgumentException + */ + private function extractURIParts(string $host): array + { + $parts = parse_url($host); + + if ($parts === false) { + throw new InvalidArgumentException(sprintf('Could not parse URI: "%s"', $host)); + } + + if (isset($parts['port']) !== true) { + $parts['port'] = 9200; + } + + return $parts; + } + + private function prependMissingScheme(string $host): string + { + if (!preg_match("/^https?:\/\//", $host)) { + $host = 'http://' . $host; + } + + return $host; + } + + private function normalizeCredentialProvider($provider): ?callable + { + if ($provider === null || $provider === false) { + return null; + } + + if (is_callable($provider)) { + return $provider; + } + + SigV4Handler::assertDependenciesInstalled(); + + if ($provider === true) { + return CredentialProvider::defaultProvider(); + } + + if ($provider instanceof CredentialsInterface) { + return CredentialProvider::fromCredentials($provider); + } elseif (is_array($provider) && isset($provider['key']) && isset($provider['secret'])) { + return CredentialProvider::fromCredentials( + new Credentials( + $provider['key'], + $provider['secret'], + isset($provider['token']) ? $provider['token'] : null, + isset($provider['expires']) ? $provider['expires'] : null + ) + ); + } + + throw new InvalidArgumentException('Credentials must be an instance of Aws\Credentials\CredentialsInterface, an' + . ' associative array that contains "key", "secret", and an optional "token" key-value pairs, a credentials' + . ' provider function, or true.'); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientFactoryInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientFactoryInterface.php new file mode 100644 index 0000000..23f44c3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ClientFactoryInterface.php @@ -0,0 +1,17 @@ + $options + * The options to use when creating the client. The options are specific to the HTTP client implementation. + */ + public function create(array $options): Client; +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Common/EmptyLogger.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Common/EmptyLogger.php new file mode 100644 index 0000000..84a3c2f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Common/EmptyLogger.php @@ -0,0 +1,47 @@ + + */ + protected $connectionPoolParams; + + /** + * @var ConnectionFactoryInterface + */ + protected $connectionFactory; + + /** + * Constructor + * + * @param ConnectionInterface[] $connections The Connections to choose from + * @param SelectorInterface $selector A Selector instance to perform the selection logic for the available connections + * @param ConnectionFactoryInterface $factory ConnectionFactory instance + * @param array $connectionPoolParams + */ + public function __construct(array $connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, array $connectionPoolParams) + { + $paramList = array('connections', 'selector', 'connectionPoolParams'); + foreach ($paramList as $param) { + if (isset($$param) === false) { + throw new InvalidArgumentException('`' . $param . '` parameter must not be null'); + } + } + + if (isset($connectionPoolParams['randomizeHosts']) === true + && $connectionPoolParams['randomizeHosts'] === true + ) { + shuffle($connections); + } + + $this->connections = $connections; + $this->seedConnections = $connections; + $this->selector = $selector; + $this->connectionPoolParams = $connectionPoolParams; + $this->connectionFactory = $factory; + } + + abstract public function nextConnection(bool $force = false): ConnectionInterface; + + abstract public function scheduleCheck(): void; +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php new file mode 100644 index 0000000..542c8b0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php @@ -0,0 +1,37 @@ +current % count($connections)]; + + $this->current += 1; + + return $returnConnection; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php new file mode 100644 index 0000000..37a654a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php @@ -0,0 +1,40 @@ +current]->isAlive()) { + return $connections[$this->current]; + } + + $this->currentCounter += 1; + $this->current = $this->currentCounter % count($connections); + + return $connections[$this->current]; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php new file mode 100644 index 0000000..fe59830 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php @@ -0,0 +1,55 @@ + $connectionPoolParams + */ + public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) + { + parent::__construct($connections, $selector, $factory, $connectionPoolParams); + } + + public function nextConnection(bool $force = false): ConnectionInterface + { + return $this->selector->select($this->connections); + } + + public function scheduleCheck(): void + { + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php new file mode 100644 index 0000000..5c5d99d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php @@ -0,0 +1,189 @@ + $connectionPoolParams + */ + public function __construct( + $connections, + SelectorInterface $selector, + ConnectionFactoryInterface $factory, + $connectionPoolParams + ) { + parent::__construct($connections, $selector, $factory, $connectionPoolParams); + + $this->setConnectionPoolParams($connectionPoolParams); + $this->nextSniff = time() + $this->sniffingInterval; + } + + public function nextConnection(bool $force = false): ConnectionInterface + { + $this->sniff($force); + + $size = count($this->connections); + while ($size--) { + /** + * @var Connection $connection + */ + $connection = $this->selector->select($this->connections); + if ($connection->isAlive() === true || $connection->ping() === true) { + return $connection; + } + } + + if ($force === true) { + throw new NoNodesAvailableException("No alive nodes found in your cluster"); + } + + return $this->nextConnection(true); + } + + public function scheduleCheck(): void + { + $this->nextSniff = -1; + } + + private function sniff(bool $force = false): void + { + if ($force === false && $this->nextSniff > time()) { + return; + } + + $total = count($this->connections); + + while ($total--) { + /** + * @var Connection $connection + */ + $connection = $this->selector->select($this->connections); + + if ($connection->isAlive() xor $force) { + continue; + } + + if ($this->sniffConnection($connection) === true) { + return; + } + } + + if ($force === true) { + return; + } + + foreach ($this->seedConnections as $connection) { + /** + * @var Connection $connection + */ + if ($this->sniffConnection($connection) === true) { + return; + } + } + } + + private function sniffConnection(Connection $connection): bool + { + try { + $response = $connection->sniff(); + } catch (OperationTimeoutException $exception) { + return false; + } + + $nodes = $this->parseClusterState($response); + + if (count($nodes) === 0) { + return false; + } + + $this->connections = []; + + foreach ($nodes as $node) { + $nodeDetails = [ + 'host' => $node['host'], + 'port' => $node['port'], + ]; + $this->connections[] = $this->connectionFactory->create($nodeDetails); + } + + $this->nextSniff = time() + $this->sniffingInterval; + + return true; + } + + /** + * @return list + */ + private function parseClusterState($nodeInfo): array + { + $pattern = '/([^:]*):(\d+)/'; + $hosts = []; + + foreach ($nodeInfo['nodes'] as $node) { + if (isset($node['http']) === true && isset($node['http']['publish_address']) === true) { + if (preg_match($pattern, $node['http']['publish_address'], $match) === 1) { + $hosts[] = [ + 'host' => $match[1], + 'port' => (int)$match[2], + ]; + } + } + } + + return $hosts; + } + + /** + * @param array $connectionPoolParams + */ + private function setConnectionPoolParams(array $connectionPoolParams): void + { + $this->sniffingInterval = (int)($connectionPoolParams['sniffingInterval'] ?? 300); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticConnectionPool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticConnectionPool.php new file mode 100644 index 0000000..9aa740d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticConnectionPool.php @@ -0,0 +1,113 @@ + $connectionPoolParams + */ + public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) + { + parent::__construct($connections, $selector, $factory, $connectionPoolParams); + $this->scheduleCheck(); + } + + public function nextConnection(bool $force = false): ConnectionInterface + { + $skipped = []; + + $total = count($this->connections); + while ($total--) { + /** + * @var Connection $connection + */ + $connection = $this->selector->select($this->connections); + if ($connection->isAlive() === true) { + return $connection; + } + + if ($this->readyToRevive($connection) === true) { + if ($connection->ping() === true) { + return $connection; + } + } else { + $skipped[] = $connection; + } + } + + // All "alive" nodes failed, force pings on "dead" nodes + foreach ($skipped as $connection) { + if ($connection->ping() === true) { + return $connection; + } + } + + throw new NoNodesAvailableException("No alive nodes found in your cluster"); + } + + public function scheduleCheck(): void + { + foreach ($this->connections as $connection) { + $connection->markDead(); + } + } + + private function readyToRevive(Connection $connection): bool + { + $timeout = min( + $this->pingTimeout * pow(2, $connection->getPingFailures()), + $this->maxPingTimeout + ); + + if ($connection->getLastPing() + $timeout < time()) { + return true; + } else { + return false; + } + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php new file mode 100644 index 0000000..42d634c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php @@ -0,0 +1,96 @@ + $connectionPoolParams + */ + public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) + { + parent::__construct($connections, $selector, $factory, $connectionPoolParams); + } + + public function nextConnection(bool $force = false): ConnectionInterface + { + $total = count($this->connections); + while ($total--) { + /** + * @var Connection $connection +*/ + $connection = $this->selector->select($this->connections); + if ($connection->isAlive() === true) { + return $connection; + } + + if ($this->readyToRevive($connection) === true) { + return $connection; + } + } + + throw new NoNodesAvailableException("No alive nodes found in your cluster"); + } + + public function scheduleCheck(): void + { + } + + private function readyToRevive(Connection $connection): bool + { + $timeout = min( + $this->pingTimeout * pow(2, $connection->getPingFailures()), + $this->maxPingTimeout + ); + + if ($connection->getLastPing() + $timeout < time()) { + return true; + } else { + return false; + } + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php new file mode 100644 index 0000000..7deac75 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php @@ -0,0 +1,794 @@ +> + */ + protected $headers = []; + + /** + * @var bool + */ + protected $isAlive = false; + + /** + * @var float + */ + private $pingTimeout = 1; //TODO expose this + + /** + * @var int + */ + private $lastPing = 0; + + /** + * @var int + */ + private $failedPings = 0; + + /** + * @var mixed[] + */ + private $lastRequest = array(); + + /** + * @var string + */ + private $OSVersion = null; + + /** + * @param array{host: string, port?: int, scheme?: string, user?: string, pass?: string, path?: string} $hostDetails + * @param array{client?: array{headers?: array>, curl?: array}} $connectionParams + */ + public function __construct( + callable $handler, + array $hostDetails, + array $connectionParams, + SerializerInterface $serializer, + LoggerInterface $log, + LoggerInterface $trace + ) { + if (isset($hostDetails['port']) !== true) { + $hostDetails['port'] = 9200; + } + + if (isset($hostDetails['scheme'])) { + $this->transportSchema = $hostDetails['scheme']; + } + + // Only Set the Basic if API Key is not set and setBasicAuthentication was not called prior + if (isset($connectionParams['client']['headers']['Authorization']) === false + && isset($connectionParams['client']['curl'][CURLOPT_HTTPAUTH]) === false + && isset($hostDetails['user']) + && isset($hostDetails['pass']) + ) { + $connectionParams['client']['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_BASIC; + $connectionParams['client']['curl'][CURLOPT_USERPWD] = $hostDetails['user'].':'.$hostDetails['pass']; + } + + $connectionParams['client']['curl'][CURLOPT_PORT] = $hostDetails['port']; + + if (isset($connectionParams['client']['headers'])) { + $this->headers = $connectionParams['client']['headers']; + unset($connectionParams['client']['headers']); + } + + // Add the User-Agent using the format: / (metadata-values) + $this->headers['User-Agent'] = [sprintf( + 'opensearch-php/%s (%s %s; PHP %s)', + Client::VERSION, + PHP_OS, + $this->getOSVersion(), + PHP_VERSION + )]; + + $host = $hostDetails['host']; + $path = null; + if (isset($hostDetails['path']) === true) { + $path = $hostDetails['path']; + } + $port = $hostDetails['port']; + + $this->host = $host; + $this->path = $path; + $this->port = $port; + $this->log = $log; + $this->trace = $trace; + $this->connectionParams = $connectionParams; + $this->serializer = $serializer; + + $this->handler = $this->wrapHandler($handler); + } + + /** + * @param string $method + * @param string $uri + * @param null|array $params + * @param mixed $body + * @param array $options + * @param Transport|null $transport + * @return mixed + */ + public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null) + { + if ($body !== null) { + $body = $this->serializer->serialize($body); + } + + $headers = $this->headers; + if (isset($options['client']['headers']) && is_array($options['client']['headers'])) { + $headers = array_merge($this->headers, $options['client']['headers']); + } + + $host = $this->host; + if (isset($this->connectionParams['client']['port_in_header']) && $this->connectionParams['client']['port_in_header']) { + $host .= ':' . $this->port; + } + + $request = [ + 'http_method' => $method, + 'scheme' => $this->transportSchema, + 'uri' => $this->getURI($uri, $params), + 'body' => $body, + 'headers' => array_merge( + [ + 'Host' => [$host] + ], + $headers + ) + ]; + + $request = array_replace_recursive($request, $this->connectionParams, $options); + + // RingPHP does not like if client is empty + if (empty($request['client'])) { + unset($request['client']); + } + + $handler = $this->handler; + $future = $handler($request, $this, $transport, $options); + + return $future; + } + + public function getTransportSchema(): string + { + return $this->transportSchema; + } + + public function getLastRequestInfo(): array + { + return $this->lastRequest; + } + + private function wrapHandler(callable $handler): callable + { + return function (array $request, Connection $connection, ?Transport $transport, $options) use ($handler) { + $this->lastRequest = []; + $this->lastRequest['request'] = $request; + + // Send the request using the wrapped handler. + $response = Core::proxy( + $handler($request), + function ($response) use ($connection, $transport, $request, $options) { + $this->lastRequest['response'] = $response; + + if (isset($response['error']) === true) { + if ($response['error'] instanceof ConnectException || $response['error'] instanceof RingException) { + $this->log->warning("Curl exception encountered."); + + $exception = $this->getCurlRetryException($request, $response); + + $this->logRequestFail($request, $response, $exception); + + $node = $connection->getHost(); + $this->log->warning("Marking node $node dead."); + $connection->markDead(); + + // If the transport has not been set, we are inside a Ping or Sniff, + // so we don't want to retrigger retries anyway. + // + // TODO this could be handled better, but we are limited because connectionpools do not + // have access to Transport. Architecturally, all of this needs to be refactored + if (isset($transport) === true) { + $transport->connectionPool->scheduleCheck(); + + $neverRetry = isset($request['client']['never_retry']) ? $request['client']['never_retry'] : false; + $shouldRetry = $transport->shouldRetry($request); + $shouldRetryText = ($shouldRetry) ? 'true' : 'false'; + + $this->log->warning("Retries left? $shouldRetryText"); + if ($shouldRetry && !$neverRetry) { + return $transport->performRequest( + $request['http_method'], + $request['uri'], + [], + $request['body'], + $options + ); + } + } + + $this->log->warning("Out of retries, throwing exception from $node"); + // Only throw if we run out of retries + throw $exception; + } else { + // Something went seriously wrong, bail + $exception = new TransportException($response['error']->getMessage()); + $this->logRequestFail($request, $response, $exception); + throw $exception; + } + } else { + $connection->markAlive(); + + if (isset($response['headers']['Warning'])) { + $this->logWarning($request, $response); + } + if (isset($response['body']) === true) { + $response['body'] = stream_get_contents($response['body']); + $this->lastRequest['response']['body'] = $response['body']; + } + + if ($response['status'] >= 400 && $response['status'] < 500) { + $ignore = $request['client']['ignore'] ?? []; + // Skip 404 if succeeded true in the body (e.g. clear_scroll) + $body = $response['body'] ?? ''; + if (strpos($body, '"succeeded":true') !== false) { + $ignore[] = 404; + } + $this->process4xxError($request, $response, $ignore); + } elseif ($response['status'] >= 500) { + $ignore = $request['client']['ignore'] ?? []; + $this->process5xxError($request, $response, $ignore); + } + + // No error, deserialize + $response['body'] = $this->serializer->deserialize($response['body'], $response['transfer_stats']); + } + $this->logRequestSuccess($request, $response); + + return isset($request['client']['verbose']) && $request['client']['verbose'] === true ? $response : $response['body']; + } + ); + + return $response; + }; + } + + /** + * @param array|null $params + */ + private function getURI(string $uri, ?array $params): string + { + if (isset($params) === true && !empty($params)) { + $params = array_map( + function ($value) { + if ($value === true) { + return 'true'; + } elseif ($value === false) { + return 'false'; + } + + return $value; + }, + $params + ); + + $uri .= '?' . http_build_query($params); + } + + if ($this->path !== null) { + $uri = $this->path . $uri; + } + + return $uri; + } + + /** + * @return array> + */ + public function getHeaders(): array + { + return $this->headers; + } + + public function logWarning(array $request, array $response): void + { + $this->log->warning('Deprecation', $response['headers']['Warning']); + } + + /** + * Log a successful request + * + * @param array $request + * @param array $response + * @return void + */ + public function logRequestSuccess(array $request, array $response): void + { + $port = $request['client']['curl'][CURLOPT_PORT] ?? $response['transfer_stats']['primary_port'] ?? ''; + $uri = $this->addPortInUrl($response['effective_url'], (int) $port); + + $this->log->debug('Request Body', array($request['body'])); + $this->log->info( + 'Request Success:', + array( + 'method' => $request['http_method'], + 'uri' => $uri, + 'port' => $port, + 'headers' => $request['headers'], + 'HTTP code' => $response['status'], + 'duration' => $response['transfer_stats']['total_time'], + ) + ); + $this->log->debug('Response', array($response['body'])); + + // Build the curl command for Trace. + $curlCommand = $this->buildCurlCommand($request['http_method'], $uri, $request['body']); + $this->trace->info($curlCommand); + $this->trace->debug( + 'Response:', + array( + 'response' => $response['body'], + 'method' => $request['http_method'], + 'uri' => $uri, + 'port' => $port, + 'HTTP code' => $response['status'], + 'duration' => $response['transfer_stats']['total_time'], + ) + ); + } + + /** + * Log a failed request + * + * @param array $request + * @param array $response + * @param \Throwable $exception + * + * @return void + */ + public function logRequestFail(array $request, array $response, \Throwable $exception): void + { + $port = $request['client']['curl'][CURLOPT_PORT] ?? $response['transfer_stats']['primary_port'] ?? ''; + $uri = $this->addPortInUrl($response['effective_url'], (int) $port); + + $this->log->debug('Request Body', array($request['body'])); + $this->log->warning( + 'Request Failure:', + array( + 'method' => $request['http_method'], + 'uri' => $uri, + 'port' => $port, + 'headers' => $request['headers'], + 'HTTP code' => $response['status'], + 'duration' => $response['transfer_stats']['total_time'], + 'error' => $exception->getMessage(), + ) + ); + $this->log->warning('Response', array($response['body'])); + + // Build the curl command for Trace. + $curlCommand = $this->buildCurlCommand($request['http_method'], $uri, $request['body']); + $this->trace->info($curlCommand); + $this->trace->debug( + 'Response:', + array( + 'response' => $response, + 'method' => $request['http_method'], + 'uri' => $uri, + 'port' => $port, + 'HTTP code' => $response['status'], + 'duration' => $response['transfer_stats']['total_time'], + ) + ); + } + + public function ping(): bool + { + $options = [ + 'client' => [ + 'timeout' => $this->pingTimeout, + 'never_retry' => true, + 'verbose' => true + ] + ]; + try { + $response = $this->performRequest('HEAD', '/', null, null, $options); + $response = $response->wait(); + } catch (TransportException $exception) { + $this->markDead(); + + return false; + } + + if ($response['status'] === 200) { + $this->markAlive(); + + return true; + } else { + $this->markDead(); + + return false; + } + } + + /** + * @return array|\GuzzleHttp\Ring\Future\FutureArray + */ + public function sniff() + { + $options = [ + 'client' => [ + 'timeout' => $this->pingTimeout, + 'never_retry' => true + ] + ]; + + return $this->performRequest('GET', '/_nodes/', null, null, $options); + } + + public function isAlive(): bool + { + return $this->isAlive; + } + + public function markAlive(): void + { + $this->failedPings = 0; + $this->isAlive = true; + $this->lastPing = time(); + } + + public function markDead(): void + { + $this->isAlive = false; + $this->failedPings += 1; + $this->lastPing = time(); + } + + public function getLastPing(): int + { + return $this->lastPing; + } + + public function getPingFailures(): int + { + return $this->failedPings; + } + + public function getHost(): string + { + return $this->host; + } + + public function getUserPass(): ?string + { + return $this->connectionParams['client']['curl'][CURLOPT_USERPWD] ?? null; + } + + public function getPath(): ?string + { + return $this->path; + } + + /** + * @return int + */ + public function getPort() + { + return $this->port; + } + + protected function getCurlRetryException(array $request, array $response): OpenSearchException + { + $exception = null; + $message = $response['error']->getMessage(); + $exception = new MaxRetriesException($message); + switch ($response['curl']['errno']) { + case 6: + $exception = new CouldNotResolveHostException($message, 0, $exception); + break; + case 7: + $exception = new CouldNotConnectToHost($message, 0, $exception); + break; + case 28: + $exception = new OperationTimeoutException($message, 0, $exception); + break; + } + + return $exception; + } + + /** + * Get the OS version using php_uname if available + * otherwise it returns an empty string + * + * @see https://github.com/elastic/elasticsearch-php/issues/922 + */ + private function getOSVersion(): string + { + if ($this->OSVersion === null) { + $this->OSVersion = strpos(strtolower(ini_get('disable_functions')), 'php_uname') !== false + ? '' + : php_uname("r"); + } + return $this->OSVersion; + } + + /** + * Add the port value in the URL if not present + */ + private function addPortInUrl(string $uri, int $port): string + { + if (strpos($uri, ':', 7) !== false) { + return $uri; + } + return preg_replace('#([^/])/([^/])#', sprintf("$1:%s/$2", $port), $uri, 1); + } + + /** + * Construct a string cURL command + */ + private function buildCurlCommand(string $method, string $url, ?string $body): string + { + if (strpos($url, '?') === false) { + $url .= '?pretty=true'; + } else { + str_replace('?', '?pretty=true', $url); + } + + $curlCommand = 'curl -X' . strtoupper($method); + $curlCommand .= " '" . $url . "'"; + + if (isset($body) === true && $body !== '') { + $curlCommand .= " -d '" . $body . "'"; + } + + return $curlCommand; + } + + /** + * @throws OpenSearchException + */ + private function process4xxError(array $request, array $response, array $ignore): void + { + $statusCode = $response['status']; + + /** + * @var \Exception $exception + */ + $exception = $this->tryDeserialize400Error($response); + + if (array_search($response['status'], $ignore) !== false) { + return; + } + + $responseBody = $this->convertBodyToString($response['body'], $statusCode, $exception); + if ($statusCode === 401) { + $exception = new Unauthorized401Exception($responseBody); + } elseif ($statusCode === 403) { + $exception = new Forbidden403Exception($responseBody); + } elseif ($statusCode === 404) { + $exception = new Missing404Exception($responseBody); + } elseif ($statusCode === 409) { + $exception = new Conflict409Exception($responseBody, $statusCode); + } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { + $exception = new ScriptLangNotSupportedException($responseBody); + } elseif ($statusCode === 408) { + $exception = new RequestTimeout408Exception($responseBody); + } else { + $exception = new BadRequest400Exception($responseBody); + } + + $this->logRequestFail($request, $response, $exception); + + throw $exception; + } + + /** + * @throws OpenSearchException + */ + private function process5xxError(array $request, array $response, array $ignore): void + { + $statusCode = (int) $response['status']; + $responseBody = $response['body']; + + /** + * @var \Exception $exception + */ + $exception = $this->tryDeserialize500Error($response); + + $exceptionText = "[$statusCode Server Exception] ".$exception->getMessage(); + $this->log->error($exceptionText); + $this->log->error($exception->getTraceAsString()); + + if (array_search($statusCode, $ignore) !== false) { + return; + } + + if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { + $exception = new RoutingMissingException($exception->getMessage(), [], 0, $exception); + } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/', $responseBody) === 1) { + $exception = new NoDocumentsToGetException($exception->getMessage(), [], 0, $exception); + } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { + $exception = new NoShardAvailableException($exception->getMessage(), [], 0, $exception); + } else { + $exception = new ServerErrorResponseException( + $this->convertBodyToString($responseBody, $statusCode, $exception), + ); + } + + $this->logRequestFail($request, $response, $exception); + + throw $exception; + } + + private function convertBodyToString($body, int $statusCode, Exception $exception): string + { + if (empty($body)) { + return sprintf( + "Unknown %d error from OpenSearch %s", + $statusCode, + $exception->getMessage() + ); + } + // if body is not string, we convert it so it can be used as Exception message + if (!is_string($body)) { + return json_encode($body); + } + return $body; + } + + private function tryDeserialize400Error(array $response): OpenSearchException + { + return $this->tryDeserializeError($response, BadRequest400Exception::class); + } + + private function tryDeserialize500Error(array $response): OpenSearchException + { + return $this->tryDeserializeError($response, ServerErrorResponseException::class); + } + + private function tryDeserializeError(array $response, string $errorClass): OpenSearchException + { + $error = $this->serializer->deserialize($response['body'], $response['transfer_stats']); + if (is_array($error) === true) { + if (isset($error['error']) === false) { + // <2.0 "i just blew up" nonstructured exception + // $error is an array but we don't know the format, reuse the response body instead + // added json_encode to convert into a string + return new $errorClass(json_encode($response['body']), (int) $response['status']); + } + + // 2.0 structured exceptions + if (is_array($error['error']) && array_key_exists('reason', $error['error']) === true) { + // Try to use root cause first (only grabs the first root cause) + $info = $error['error']['root_cause'][0] ?? $error['error']; + $cause = $info['reason']; + $type = $info['type']; + // added json_encode to convert into a string + $original = new $errorClass(json_encode($response['body']), $response['status']); + + return new $errorClass("$type: $cause", (int) $response['status'], $original); + } + // <2.0 semi-structured exceptions + // added json_encode to convert into a string + $original = new $errorClass(json_encode($response['body']), $response['status']); + + $errorEncoded = $error['error']; + if (is_array($errorEncoded)) { + $errorEncoded = json_encode($errorEncoded); + } + return new $errorClass($errorEncoded, (int) $response['status'], $original); + } + + // if responseBody is not string, we convert it so it can be used as Exception message + $responseBody = $response['body']; + if (!is_string($responseBody)) { + $responseBody = json_encode($responseBody); + } + + // <2.0 "i just blew up" nonstructured exception + return new $errorClass($responseBody); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactory.php new file mode 100644 index 0000000..7aff2cc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactory.php @@ -0,0 +1,87 @@ +>, curl?: array}} $connectionParams + */ + public function __construct(callable $handler, array $connectionParams, SerializerInterface $serializer, LoggerInterface $logger, LoggerInterface $tracer) + { + $this->handler = $handler; + $this->connectionParams = $connectionParams; + $this->logger = $logger; + $this->tracer = $tracer; + $this->serializer = $serializer; + } + + public function create(array $hostDetails): ConnectionInterface + { + if (isset($hostDetails['path'])) { + $hostDetails['path'] = rtrim($hostDetails['path'], '/'); + } + + return new Connection( + $this->handler, + $hostDetails, + $this->connectionParams, + $this->serializer, + $this->logger, + $this->tracer + ); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactoryInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactoryInterface.php new file mode 100644 index 0000000..97b4f04 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/ConnectionFactoryInterface.php @@ -0,0 +1,36 @@ +|null $params + * @param mixed $body + * @return mixed + */ + public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null); +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactory.php new file mode 100644 index 0000000..1b47e59 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactory.php @@ -0,0 +1,57 @@ +serializer = $serializer; + } + + /** + * {@inheritdoc} + */ + public function getEndpoint(string $class): AbstractEndpoint + { + return $this->createEndpoint($class); + } + + private function getSerializer(): SerializerInterface + { + if ($this->serializer === null) { + $this->serializer = new SmartSerializer(); + } + return $this->serializer; + } + + /** + * Creates an endpoint. + * + * @phpstan-template T of AbstractEndpoint + * @phpstan-param class-string $class + * @phpstan-return T + * @throws \ReflectionException + */ + private function createEndpoint(string $class): AbstractEndpoint + { + $reflection = new ReflectionClass($class); + $constructor = $reflection->getConstructor(); + + if ($constructor && $constructor->getParameters()) { + return new $class($this->getSerializer()); + } + return new $class(); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactoryInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactoryInterface.php new file mode 100644 index 0000000..2e481fc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointFactoryInterface.php @@ -0,0 +1,21 @@ + $class + * @phpstan-return T + */ + public function getEndpoint(string $class): AbstractEndpoint; + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointInterface.php new file mode 100644 index 0000000..f29783d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/EndpointInterface.php @@ -0,0 +1,79 @@ + + */ + public function getOptions(): array; + + /** + * Get the index. + */ + public function getIndex(): ?string; + + /** + * Set the index. + * + * @param string|string[]|null $index + * + * @return $this + */ + public function setIndex(string|array|null $index): static; + + /** + * Get the document ID. + * + * @param int|string|null $docID + * + * @return $this + */ + public function setId(int|string|null $docID): static; + + /** + * Get the body of the request. + */ + public function getBody(): string|array|null; + + /** + * Set the body of the request. + * + * @param string|iterable|null $body + */ + public function setBody(string|iterable|null $body): static; + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AbstractEndpoint.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AbstractEndpoint.php new file mode 100644 index 0000000..cc17e31 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AbstractEndpoint.php @@ -0,0 +1,319 @@ +extractOptions($params); + $this->checkUserParams($params); + $params = $this->convertCustom($params); + $this->params = $this->convertArraysToStrings($params); + + $this->checkForDeprecations(); + + return $this; + } + + public function getParams(): array + { + return $this->params; + } + + public function getOptions(): array + { + return $this->options; + } + + public function getIndex(): ?string + { + return $this->index; + } + + /** + * @param string|string[]|null $index + * + * @return $this + */ + public function setIndex($index): static + { + if ($index === null) { + return $this; + } + + if (is_array($index) === true) { + $index = array_filter($index); + $index = array_map('trim', $index); + $index = implode(",", $index); + } + + $this->index = $index; + + return $this; + } + + public function setId(int|string|null $docID): static + { + if ($docID === null) { + return $this; + } + + if (is_int($docID)) { + $docID = (string)$docID; + } + + $this->id = $docID; + + return $this; + } + + public function getBody(): string|array|null + { + return $this->body; + } + + public function setBody(string|iterable|null $body): static + { + $this->body = $body; + + return $this; + } + + protected function getOptionalURI(string $endpoint): string + { + $uri = []; + $uri[] = $this->getOptionalIndex(); + $uri[] = $endpoint; + $uri = array_filter($uri); + + return '/' . implode('/', $uri); + } + + private function getOptionalIndex(): string + { + if (isset($this->index) === true) { + return $this->index; + } else { + return '_all'; + } + } + + /** + * @param array $params + * + * @throws UnexpectedValueException + */ + private function checkUserParams(array $params) + { + if (empty($params)) { + return; //no params, just return. + } + + $whitelist = array_merge( + $this->getParamWhitelist(), + ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'opaqueId'] + ); + + $invalid = array_diff(array_keys($params), $whitelist); + if (count($invalid) > 0) { + sort($invalid); + sort($whitelist); + throw new UnexpectedValueException( + sprintf( + (count($invalid) > 1 ? '"%s" are not valid parameters.' : '"%s" is not a valid parameter.') . ' Allowed parameters are "%s"', + implode('", "', $invalid), + implode('", "', $whitelist) + ) + ); + } + } + + /** + * @param array $params Note: this is passed by-reference! + */ + private function extractOptions(&$params) + { + // Extract out client options, then start transforming + if (isset($params['client']) === true) { + // Check if the opaqueId is populated and add the header + if (isset($params['client']['opaqueId']) === true) { + if (isset($params['client']['headers']) === false) { + $params['client']['headers'] = []; + } + $params['client']['headers']['x-opaque-id'] = [trim($params['client']['opaqueId'])]; + unset($params['client']['opaqueId']); + } + + $this->options['client'] = $params['client']; + unset($params['client']); + } + $ignore = isset($this->options['client']['ignore']) ? $this->options['client']['ignore'] : null; + if (isset($ignore) === true) { + if (is_string($ignore)) { + $this->options['client']['ignore'] = explode(",", $ignore); + } elseif (is_array($ignore)) { + $this->options['client']['ignore'] = $ignore; + } else { + $this->options['client']['ignore'] = [$ignore]; + } + } + } + + /** + * @param array $params + * + * @return array + */ + private function convertCustom(array $params): array + { + if (isset($params['custom']) === true) { + foreach ($params['custom'] as $k => $v) { + $params[$k] = $v; + } + unset($params['custom']); + } + + return $params; + } + + private function convertArraysToStrings(array $params): array + { + foreach ($params as $key => &$value) { + if (!($key === 'client' || $key == 'custom') && is_array($value) === true) { + if ($this->isNestedArray($value) !== true) { + $value = implode(",", $value); + } + } + } + + return $params; + } + + private function isNestedArray(array $a): bool + { + foreach ($a as $v) { + if (is_array($v)) { + return true; + } + } + + return false; + } + + /** + * This function returns all param deprecations also optional with a replacement field + * + * @return array + */ + protected function getParamDeprecation(): array + { + return []; + } + + private function checkForDeprecations(): void + { + $deprecations = $this->getParamDeprecation(); + + if ($deprecations === []) { + return; + } + + $keys = array_keys($this->params); + + foreach ($keys as $key) { + if (array_key_exists($key, $deprecations)) { + $val = $deprecations[$key]; + + $msg = sprintf('The parameter "%s" is deprecated and will be removed without replacement in the next major version', $key); + + if ($val) { + $msg = sprintf('The parameter "%s" is deprecated and will be replaced with parameter "%s" in the next major version', $key, $val); + } + + trigger_error($msg, E_USER_DEPRECATED); + } + } + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Delete.php new file mode 100644 index 0000000..c8a6a1c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Delete.php @@ -0,0 +1,48 @@ +id ?? null; + + if (isset($id)) { + return "/_async_search/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint async_search.delete'); + } + + public function getParamWhitelist(): array + { + return []; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Get.php new file mode 100644 index 0000000..3f6b86c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Get.php @@ -0,0 +1,52 @@ +id ?? null; + + if (isset($id)) { + return "/_async_search/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint async_search.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'wait_for_completion_timeout', + 'keep_alive', + 'typed_keys' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Submit.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Submit.php new file mode 100644 index 0000000..21edf79 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsyncSearch/Submit.php @@ -0,0 +1,99 @@ +index ?? null; + + if (isset($index)) { + return "/$index/_async_search"; + } + return "/_async_search"; + } + + public function getParamWhitelist(): array + { + return [ + 'wait_for_completion_timeout', + 'keep_on_completion', + 'keep_alive', + 'batched_reduce_size', + 'request_cache', + 'analyzer', + 'analyze_wildcard', + 'default_operator', + 'df', + 'explain', + 'stored_fields', + 'docvalue_fields', + 'from', + 'ignore_unavailable', + 'ignore_throttled', + 'allow_no_indices', + 'expand_wildcards', + 'lenient', + 'preference', + 'q', + 'routing', + 'search_type', + 'size', + 'sort', + '_source', + '_source_excludes', + '_source_includes', + 'terminate_after', + 'stats', + 'suggest_field', + 'suggest_mode', + 'suggest_size', + 'suggest_text', + 'timeout', + 'track_scores', + 'track_total_hits', + 'allow_partial_search_results', + 'typed_keys', + 'version', + 'seq_no_primary_term', + 'max_concurrent_shard_requests' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php new file mode 100644 index 0000000..47d332b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Delete.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_asynchronous_search/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php new file mode 100644 index 0000000..6c306ae --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Get.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_asynchronous_search/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php new file mode 100644 index 0000000..c0f8bc1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Search.php @@ -0,0 +1,59 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php new file mode 100644 index 0000000..8b68cb3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/AsynchronousSearch/Stats.php @@ -0,0 +1,45 @@ +serializer = $serializer; + } + + public function getURI(): string + { + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_bulk"; + } + return "/_bulk"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'index', + 'pipeline', + 'refresh', + 'require_alias', + 'routing', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody(string|iterable|null $body): static + { + if (is_null($body)) { + return $this; + } + + if (is_string($body)) { + if (!str_ends_with($body, "\n")) { + $body .= "\n"; + } + $this->body = $body; + return $this; + } + + // Must be an iterable. + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + + return $this; + + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/BulkStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/BulkStream.php new file mode 100644 index 0000000..7383015 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/BulkStream.php @@ -0,0 +1,88 @@ +serializer = $serializer; + } + + public function getURI(): string + { + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_bulk/stream"; + } + return "/_bulk/stream"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'batch_interval', + 'batch_size', + 'pipeline', + 'refresh', + 'require_alias', + 'routing', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody(string|iterable|null $body): static + { + if (is_null($body)) { + return $this; + } + + if (is_string($body)) { + if (!str_ends_with($body, "\n")) { + $body .= "\n"; + } + $this->body = $body; + return $this; + } + + // Must be an iterable. + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + + return $this; + + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Aliases.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Aliases.php new file mode 100644 index 0000000..a636a00 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Aliases.php @@ -0,0 +1,77 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_cat/aliases/$name"; + } + return "/_cat/aliases"; + } + + public function getParamWhitelist(): array + { + return [ + 'expand_wildcards', + 'format', + 'h', + 'help', + 'local', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/AllPitSegments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/AllPitSegments.php new file mode 100644 index 0000000..0330e45 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/AllPitSegments.php @@ -0,0 +1,51 @@ +node_id ? rawurlencode($this->node_id) : null; + if (isset($node_id)) { + return "/_cat/allocation/$node_id"; + } + return "/_cat/allocation"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'local', + 'master_timeout', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ClusterManager.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ClusterManager.php new file mode 100644 index 0000000..cfcd3a2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ClusterManager.php @@ -0,0 +1,64 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Count.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Count.php new file mode 100644 index 0000000..7ae1380 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Count.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/count/$index"; + } + return "/_cat/count"; + } + + public function getParamWhitelist(): array + { + return [ + 'format', + 'h', + 'help', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Fielddata.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Fielddata.php new file mode 100644 index 0000000..1c43227 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Fielddata.php @@ -0,0 +1,77 @@ +fields ? rawurlencode($this->fields) : null; + if (isset($fields)) { + return "/_cat/fielddata/$fields"; + } + return "/_cat/fielddata"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'fields', + 'format', + 'h', + 'help', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setFields($fields): static + { + if (!isset($fields)) { + return $this; + } + if (is_array($fields) === true) { + $fields = implode(",", $fields); + } + $this->fields = rawurlencode($fields); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Health.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Health.php new file mode 100644 index 0000000..47cf0ca --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Health.php @@ -0,0 +1,58 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/indices/$index"; + } + return "/_cat/indices"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'expand_wildcards', + 'format', + 'h', + 'health', + 'help', + 'include_unloaded_segments', + 'local', + 'master_timeout', + 'pri', + 's', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Master.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Master.php new file mode 100644 index 0000000..0f931a9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Master.php @@ -0,0 +1,67 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/NodeAttrs.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/NodeAttrs.php new file mode 100644 index 0000000..80ee692 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/NodeAttrs.php @@ -0,0 +1,64 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Nodes.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Nodes.php new file mode 100644 index 0000000..fbcb24b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Nodes.php @@ -0,0 +1,67 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PendingTasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PendingTasks.php new file mode 100644 index 0000000..8d1f0fa --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PendingTasks.php @@ -0,0 +1,65 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PitSegments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PitSegments.php new file mode 100644 index 0000000..c4646ff --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/PitSegments.php @@ -0,0 +1,61 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Plugins.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Plugins.php new file mode 100644 index 0000000..a58c764 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Plugins.php @@ -0,0 +1,64 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Recovery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Recovery.php new file mode 100644 index 0000000..f33ccc9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Recovery.php @@ -0,0 +1,65 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/recovery/$index"; + } + return "/_cat/recovery"; + } + + public function getParamWhitelist(): array + { + return [ + 'active_only', + 'bytes', + 'detailed', + 'format', + 'h', + 'help', + 'index', + 's', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Repositories.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Repositories.php new file mode 100644 index 0000000..d8b1ec1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Repositories.php @@ -0,0 +1,64 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/SegmentReplication.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/SegmentReplication.php new file mode 100644 index 0000000..fd92e02 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/SegmentReplication.php @@ -0,0 +1,66 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/segment_replication/$index"; + } + return "/_cat/segment_replication"; + } + + public function getParamWhitelist(): array + { + return [ + 'active_only', + 'allow_no_indices', + 'bytes', + 'completed_only', + 'detailed', + 'expand_wildcards', + 'format', + 'h', + 'help', + 'ignore_throttled', + 'ignore_unavailable', + 'index', + 's', + 'shards', + 'time', + 'timeout', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Segments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Segments.php new file mode 100644 index 0000000..3888516 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Segments.php @@ -0,0 +1,68 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/segments/$index"; + } + return "/_cat/segments"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'master_timeout', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Shards.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Shards.php new file mode 100644 index 0000000..8246a04 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Shards.php @@ -0,0 +1,70 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cat/shards/$index"; + } + return "/_cat/shards"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'local', + 'master_timeout', + 's', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Snapshots.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Snapshots.php new file mode 100644 index 0000000..863c40a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Snapshots.php @@ -0,0 +1,85 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_cat/snapshots/$repository"; + } + return "/_cat/snapshots"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'ignore_unavailable', + 'master_timeout', + 'repository', + 's', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRepository($repository): static + { + if (!isset($repository)) { + return $this; + } + if (is_array($repository) === true) { + $repository = implode(",", $repository); + } + $this->repository = rawurlencode($repository); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Tasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Tasks.php new file mode 100644 index 0000000..86d94dc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/Tasks.php @@ -0,0 +1,61 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_cat/templates/$name"; + } + return "/_cat/templates"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'local', + 'master_timeout', + 's', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ThreadPool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ThreadPool.php new file mode 100644 index 0000000..cfe7b29 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cat/ThreadPool.php @@ -0,0 +1,84 @@ +thread_pool_patterns ? rawurlencode($this->thread_pool_patterns) : null; + if (isset($thread_pool_patterns)) { + return "/_cat/thread_pool/$thread_pool_patterns"; + } + return "/_cat/thread_pool"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'local', + 'master_timeout', + 's', + 'size', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setThreadPoolPatterns($thread_pool_patterns): static + { + if (!isset($thread_pool_patterns)) { + return $this; + } + if (is_array($thread_pool_patterns) === true) { + $thread_pool_patterns = implode(",", $thread_pool_patterns); + } + $this->thread_pool_patterns = rawurlencode($thread_pool_patterns); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ClearScroll.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ClearScroll.php new file mode 100644 index 0000000..1a8a6d0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ClearScroll.php @@ -0,0 +1,82 @@ +scroll_id ? rawurlencode($this->scroll_id) : null; + if (isset($scroll_id)) { + @trigger_error('A scroll id can be quite large and should be specified as part of the body', E_USER_DEPRECATED); + } + + if (isset($scroll_id)) { + return "/_search/scroll/$scroll_id"; + } + return "/_search/scroll"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setScrollId($scroll_id): static + { + if (!isset($scroll_id)) { + return $this; + } + if (is_array($scroll_id) === true) { + $scroll_id = implode(",", $scroll_id); + } + $this->scroll_id = rawurlencode($scroll_id); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php new file mode 100644 index 0000000..c25d7f8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php @@ -0,0 +1,63 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php new file mode 100644 index 0000000..7672df2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php @@ -0,0 +1,76 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_component_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.delete_component_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteDecommissionAwareness.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteDecommissionAwareness.php new file mode 100644 index 0000000..3f17a92 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/DeleteDecommissionAwareness.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php new file mode 100644 index 0000000..09d9c2c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php @@ -0,0 +1,76 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_component_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.exists_component_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php new file mode 100644 index 0000000..ce83ab0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php @@ -0,0 +1,79 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_component_template/$name"; + } + return "/_component_template"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'flat_settings', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetDecommissionAwareness.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetDecommissionAwareness.php new file mode 100644 index 0000000..63bd7e7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetDecommissionAwareness.php @@ -0,0 +1,62 @@ +awareness_attribute_name ? rawurlencode($this->awareness_attribute_name) : null; + if (isset($awareness_attribute_name)) { + return "/_cluster/decommission/awareness/$awareness_attribute_name/_status"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.get_decommission_awareness'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setAwarenessAttributeName($awareness_attribute_name): static + { + if (is_null($awareness_attribute_name)) { + return $this; + } + $this->awareness_attribute_name = $awareness_attribute_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetSettings.php new file mode 100644 index 0000000..b5b66c3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetSettings.php @@ -0,0 +1,61 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php new file mode 100644 index 0000000..478922d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php @@ -0,0 +1,62 @@ +attribute ? rawurlencode($this->attribute) : null; + if (isset($attribute)) { + return "/_cluster/routing/awareness/$attribute/weights"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.get_weighted_routing'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setAttribute($attribute): static + { + if (is_null($attribute)) { + return $this; + } + $this->attribute = $attribute; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Health.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Health.php new file mode 100644 index 0000000..b30e645 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Health.php @@ -0,0 +1,73 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_cluster/health/$index"; + } + return "/_cluster/health"; + } + + public function getParamWhitelist(): array + { + return [ + 'awareness_attribute', + 'cluster_manager_timeout', + 'expand_wildcards', + 'level', + 'local', + 'master_timeout', + 'timeout', + 'wait_for_active_shards', + 'wait_for_events', + 'wait_for_no_initializing_shards', + 'wait_for_no_relocating_shards', + 'wait_for_nodes', + 'wait_for_status', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PendingTasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PendingTasks.php new file mode 100644 index 0000000..de7f81c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PendingTasks.php @@ -0,0 +1,59 @@ + 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php new file mode 100644 index 0000000..9b52366 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php @@ -0,0 +1,54 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_component_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.put_component_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'create', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php new file mode 100644 index 0000000..06bb411 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php @@ -0,0 +1,74 @@ +awareness_attribute_name ? rawurlencode($this->awareness_attribute_name) : null; + $awareness_attribute_value = $this->awareness_attribute_value ? rawurlencode($this->awareness_attribute_value) : null; + if (isset($awareness_attribute_name) && isset($awareness_attribute_value)) { + return "/_cluster/decommission/awareness/$awareness_attribute_name/$awareness_attribute_value"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.put_decommission_awareness'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setAwarenessAttributeName($awareness_attribute_name): static + { + if (is_null($awareness_attribute_name)) { + return $this; + } + $this->awareness_attribute_name = $awareness_attribute_name; + + return $this; + } + + public function setAwarenessAttributeValue($awareness_attribute_value): static + { + if (is_null($awareness_attribute_value)) { + return $this; + } + $this->awareness_attribute_value = $awareness_attribute_value; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutSettings.php new file mode 100644 index 0000000..5d435ad --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutSettings.php @@ -0,0 +1,70 @@ +body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php new file mode 100644 index 0000000..f710a91 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php @@ -0,0 +1,72 @@ +attribute ? rawurlencode($this->attribute) : null; + if (isset($attribute)) { + return "/_cluster/routing/awareness/$attribute/weights"; + } + throw new RuntimeException('Missing parameter for the endpoint cluster.put_weighted_routing'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAttribute($attribute): static + { + if (is_null($attribute)) { + return $this; + } + $this->attribute = $attribute; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php new file mode 100644 index 0000000..4341c47 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php @@ -0,0 +1,51 @@ +body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/State.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/State.php new file mode 100644 index 0000000..26de825 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/State.php @@ -0,0 +1,88 @@ +metric ? rawurlencode($this->metric) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($metric) && isset($index)) { + return "/_cluster/state/$metric/$index"; + } + if (isset($metric)) { + return "/_cluster/state/$metric"; + } + return "/_cluster/state"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'flat_settings', + 'ignore_unavailable', + 'local', + 'master_timeout', + 'wait_for_metadata_version', + 'wait_for_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Stats.php new file mode 100644 index 0000000..ba1dc00 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Cluster/Stats.php @@ -0,0 +1,108 @@ +index_metric ? rawurlencode($this->index_metric) : null; + $metric = $this->metric ? rawurlencode($this->metric) : null; + $node_id = $this->node_id ? rawurlencode($this->node_id) : null; + if (isset($metric) && isset($index_metric) && isset($node_id)) { + return "/_cluster/stats/$metric/$index_metric/nodes/$node_id"; + } + if (isset($metric) && isset($node_id)) { + return "/_cluster/stats/$metric/nodes/$node_id"; + } + if (isset($node_id)) { + return "/_cluster/stats/nodes/$node_id"; + } + return "/_cluster/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'flat_settings', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setIndexMetric($index_metric): static + { + if (!isset($index_metric)) { + return $this; + } + if (is_array($index_metric) === true) { + $index_metric = implode(",", $index_metric); + } + $this->index_metric = rawurlencode($index_metric); + + return $this; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Count.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Count.php new file mode 100644 index 0000000..ddd27b6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Count.php @@ -0,0 +1,77 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_count"; + } + return "/_count"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'analyze_wildcard', + 'analyzer', + 'default_operator', + 'df', + 'expand_wildcards', + 'ignore_throttled', + 'ignore_unavailable', + 'lenient', + 'min_score', + 'preference', + 'q', + 'routing', + 'terminate_after', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Create.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Create.php new file mode 100644 index 0000000..3d21d5c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Create.php @@ -0,0 +1,77 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for create'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for create'); + } + $index = rawurlencode($this->index); + + return "/$index/_create/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pipeline', + 'refresh', + 'routing', + 'timeout', + 'version', + 'version_type', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/CreatePit.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/CreatePit.php new file mode 100644 index 0000000..8fff64f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/CreatePit.php @@ -0,0 +1,55 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for create_pit'); + } + $index = rawurlencode($this->index); + + return "/$index/_search/point_in_time"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_partial_pit_creation', + 'expand_wildcards', + 'keep_alive', + 'preference', + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/DeleteDanglingIndex.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/DeleteDanglingIndex.php new file mode 100644 index 0000000..7cb56de --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/DeleteDanglingIndex.php @@ -0,0 +1,77 @@ +index_uuid ? rawurlencode($this->index_uuid) : null; + if (isset($index_uuid)) { + return "/_dangling/$index_uuid"; + } + throw new RuntimeException('Missing parameter for the endpoint dangling_indices.delete_dangling_index'); + } + + public function getParamWhitelist(): array + { + return [ + 'accept_data_loss', + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setIndexUuid($index_uuid): static + { + if (is_null($index_uuid)) { + return $this; + } + $this->index_uuid = $index_uuid; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ImportDanglingIndex.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ImportDanglingIndex.php new file mode 100644 index 0000000..3d95ae8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ImportDanglingIndex.php @@ -0,0 +1,77 @@ +index_uuid ? rawurlencode($this->index_uuid) : null; + if (isset($index_uuid)) { + return "/_dangling/$index_uuid"; + } + throw new RuntimeException('Missing parameter for the endpoint dangling_indices.import_dangling_index'); + } + + public function getParamWhitelist(): array + { + return [ + 'accept_data_loss', + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setIndexUuid($index_uuid): static + { + if (is_null($index_uuid)) { + return $this; + } + $this->index_uuid = $index_uuid; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ListDanglingIndices.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ListDanglingIndices.php new file mode 100644 index 0000000..c4edc36 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DanglingIndices/ListDanglingIndices.php @@ -0,0 +1,51 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.delete_transform'); + } + + public function getParamWhitelist(): array + { + return [ + 'force' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setTransformId($transform_id): DeleteTransform + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransform.php new file mode 100644 index 0000000..98daa32 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransform.php @@ -0,0 +1,63 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id"; + } + return "/_data_frame/transforms"; + } + + public function getParamWhitelist(): array + { + return [ + 'from', + 'size', + 'allow_no_match' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setTransformId($transform_id): GetTransform + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php new file mode 100644 index 0000000..326c116 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php @@ -0,0 +1,64 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id/_stats"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.get_transform_stats'); + } + + public function getParamWhitelist(): array + { + return [ + 'from', + 'size', + 'allow_no_match' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setTransformId($transform_id): GetTransformStats + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php new file mode 100644 index 0000000..3f949ea --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php @@ -0,0 +1,52 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PutTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PutTransform.php new file mode 100644 index 0000000..482e260 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PutTransform.php @@ -0,0 +1,72 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.put_transform'); + } + + public function getParamWhitelist(): array + { + return [ + 'defer_validation' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTransformId($transform_id): PutTransform + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StartTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StartTransform.php new file mode 100644 index 0000000..62d412f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StartTransform.php @@ -0,0 +1,62 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id/_start"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.start_transform'); + } + + public function getParamWhitelist(): array + { + return [ + 'timeout' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTransformId($transform_id): StartTransform + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StopTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StopTransform.php new file mode 100644 index 0000000..9c38c62 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StopTransform.php @@ -0,0 +1,64 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id/_stop"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.stop_transform'); + } + + public function getParamWhitelist(): array + { + return [ + 'wait_for_completion', + 'timeout', + 'allow_no_match' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTransformId($transform_id): StopTransform + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php new file mode 100644 index 0000000..6ba0aed --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php @@ -0,0 +1,72 @@ +transform_id ?? null; + + if (isset($transform_id)) { + return "/_data_frame/transforms/$transform_id/_update"; + } + throw new RuntimeException('Missing parameter for the endpoint data_frame_transform_deprecated.update_transform'); + } + + public function getParamWhitelist(): array + { + return [ + 'defer_validation' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTransformId($transform_id): static + { + if (isset($transform_id) !== true) { + return $this; + } + $this->transform_id = $transform_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Delete.php new file mode 100644 index 0000000..356a8e9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Delete.php @@ -0,0 +1,68 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for delete'); + } + $index = rawurlencode($this->index); + + return "/$index/_doc/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'refresh', + 'routing', + 'timeout', + 'version', + 'version_type', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteAllPits.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteAllPits.php new file mode 100644 index 0000000..92b2886 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteAllPits.php @@ -0,0 +1,43 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for delete_by_query'); + } + $index = rawurlencode($this->index); + + return "/$index/_delete_by_query"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'allow_no_indices', + 'analyze_wildcard', + 'analyzer', + 'conflicts', + 'default_operator', + 'df', + 'expand_wildcards', + 'from', + 'ignore_unavailable', + 'lenient', + 'max_docs', + 'preference', + 'q', + 'refresh', + 'request_cache', + 'requests_per_second', + 'routing', + 'scroll', + 'scroll_size', + 'search_timeout', + 'search_type', + 'size', + 'slices', + 'sort', + 'stats', + 'terminate_after', + 'timeout', + 'version', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php new file mode 100644 index 0000000..be50cb0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php @@ -0,0 +1,69 @@ +task_id) || $this->task_id === '') { + throw new RuntimeException('task_id is required for delete_by_query_rethrottle'); + } + $task_id = rawurlencode($this->task_id); + + return "/_delete_by_query/$task_id/_rethrottle"; + } + + public function getParamWhitelist(): array + { + return [ + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeletePit.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeletePit.php new file mode 100644 index 0000000..f6588c8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeletePit.php @@ -0,0 +1,53 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteScript.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteScript.php new file mode 100644 index 0000000..f1dce48 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/DeleteScript.php @@ -0,0 +1,64 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete_script'); + } + $id = rawurlencode($this->id); + + return "/_scripts/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Exists.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Exists.php new file mode 100644 index 0000000..14bf93d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Exists.php @@ -0,0 +1,70 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for exists'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for exists'); + } + $index = rawurlencode($this->index); + + return "/$index/_doc/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'preference', + 'realtime', + 'refresh', + 'routing', + 'stored_fields', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ExistsSource.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ExistsSource.php new file mode 100644 index 0000000..26bb03a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ExistsSource.php @@ -0,0 +1,69 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for exists_source'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for exists_source'); + } + $index = rawurlencode($this->index); + + return "/$index/_source/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'preference', + 'realtime', + 'refresh', + 'routing', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Explain.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Explain.php new file mode 100644 index 0000000..0bc480e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Explain.php @@ -0,0 +1,82 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for explain'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for explain'); + } + $index = rawurlencode($this->index); + + return "/$index/_explain/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'analyze_wildcard', + 'analyzer', + 'default_operator', + 'df', + 'lenient', + 'preference', + 'q', + 'routing', + 'stored_fields', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FieldCaps.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FieldCaps.php new file mode 100644 index 0000000..51189d6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FieldCaps.php @@ -0,0 +1,68 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_field_caps"; + } + return "/_field_caps"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'fields', + 'ignore_unavailable', + 'include_unmapped', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Create.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Create.php new file mode 100644 index 0000000..f4f037e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Create.php @@ -0,0 +1,60 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Delete.php new file mode 100644 index 0000000..47ec96f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Delete.php @@ -0,0 +1,63 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'clear_status', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Deprovision.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Deprovision.php new file mode 100644 index 0000000..325c2d9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Deprovision.php @@ -0,0 +1,63 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id/_deprovision"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.deprovision'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_delete', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Get.php new file mode 100644 index 0000000..d2a1ca0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Get.php @@ -0,0 +1,62 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetStatus.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetStatus.php new file mode 100644 index 0000000..e0bd688 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetStatus.php @@ -0,0 +1,63 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id/_status"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.get_status'); + } + + public function getParamWhitelist(): array + { + return [ + 'all', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetSteps.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetSteps.php new file mode 100644 index 0000000..ff4d4b2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/GetSteps.php @@ -0,0 +1,46 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id/_provision"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.provision'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Search.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Search.php new file mode 100644 index 0000000..b4f6b99 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Search.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/SearchState.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/SearchState.php new file mode 100644 index 0000000..e6d0b81 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/SearchState.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Update.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Update.php new file mode 100644 index 0000000..be4b50e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/FlowFramework/Update.php @@ -0,0 +1,77 @@ +workflow_id ? rawurlencode($this->workflow_id) : null; + if (isset($workflow_id)) { + return "/_plugins/_flow_framework/workflow/$workflow_id"; + } + throw new RuntimeException('Missing parameter for the endpoint flow_framework.update'); + } + + public function getParamWhitelist(): array + { + return [ + 'provision', + 'reprovision', + 'update_fields', + 'use_case', + 'validation', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setWorkflowId($workflow_id): static + { + if (is_null($workflow_id)) { + return $this; + } + $this->workflow_id = $workflow_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/DeleteIp2geoDatasource.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/DeleteIp2geoDatasource.php new file mode 100644 index 0000000..c5a2d63 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/DeleteIp2geoDatasource.php @@ -0,0 +1,62 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_plugins/geospatial/ip2geo/datasource/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint geospatial.delete_ip2geo_datasource'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPost.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPost.php new file mode 100644 index 0000000..427036f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPost.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPut.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPut.php new file mode 100644 index 0000000..d4cc393 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GeojsonUploadPut.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetIp2geoDatasource.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetIp2geoDatasource.php new file mode 100644 index 0000000..28ef39f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetIp2geoDatasource.php @@ -0,0 +1,64 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_plugins/geospatial/ip2geo/datasource/$name"; + } + return "/_plugins/geospatial/ip2geo/datasource"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetUploadStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetUploadStats.php new file mode 100644 index 0000000..ecb9cf2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/GetUploadStats.php @@ -0,0 +1,45 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_plugins/geospatial/ip2geo/datasource/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint geospatial.put_ip2geo_datasource'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/PutIp2geoDatasourceSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/PutIp2geoDatasourceSettings.php new file mode 100644 index 0000000..6879e83 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Geospatial/PutIp2geoDatasourceSettings.php @@ -0,0 +1,72 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_plugins/geospatial/ip2geo/datasource/$name/_settings"; + } + throw new RuntimeException('Missing parameter for the endpoint geospatial.put_ip2geo_datasource_settings'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Get.php new file mode 100644 index 0000000..3a27e2b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Get.php @@ -0,0 +1,70 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for get'); + } + $index = rawurlencode($this->index); + + return "/$index/_doc/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'preference', + 'realtime', + 'refresh', + 'routing', + 'stored_fields', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetAllPits.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetAllPits.php new file mode 100644 index 0000000..460df80 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetAllPits.php @@ -0,0 +1,43 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get_script'); + } + $id = rawurlencode($this->id); + + return "/_scripts/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetScriptContext.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetScriptContext.php new file mode 100644 index 0000000..270c440 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/GetScriptContext.php @@ -0,0 +1,49 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get_source'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for get_source'); + } + $index = rawurlencode($this->index); + + return "/$index/_source/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'preference', + 'realtime', + 'refresh', + 'routing', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Index.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Index.php new file mode 100644 index 0000000..b39e019 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Index.php @@ -0,0 +1,80 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for index'); + } + $index = rawurlencode($this->index); + $id = $this->id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/$index/_doc/$id"; + } + return "/$index/_doc"; + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'op_type', + 'pipeline', + 'refresh', + 'require_alias', + 'routing', + 'timeout', + 'version', + 'version_type', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/AddBlock.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/AddBlock.php new file mode 100644 index 0000000..ff3378b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/AddBlock.php @@ -0,0 +1,80 @@ +block ? rawurlencode($this->block) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index) && isset($block)) { + return "/$index/_block/$block"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.add_block'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBlock($block): static + { + if (is_null($block)) { + return $this; + } + $this->block = $block; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Analyze.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Analyze.php new file mode 100644 index 0000000..77a2fdb --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Analyze.php @@ -0,0 +1,66 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_analyze"; + } + return "/_analyze"; + } + + public function getParamWhitelist(): array + { + return [ + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ClearCache.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ClearCache.php new file mode 100644 index 0000000..ddfcf6e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ClearCache.php @@ -0,0 +1,64 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_cache/clear"; + } + return "/_cache/clear"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'fielddata', + 'fields', + 'file', + 'ignore_unavailable', + 'index', + 'query', + 'request', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CloneIndices.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CloneIndices.php new file mode 100644 index 0000000..ca83e0b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CloneIndices.php @@ -0,0 +1,90 @@ +index ? rawurlencode($this->index) : null; + $target = $this->target ? rawurlencode($this->target) : null; + if (isset($index) && isset($target)) { + return "/$index/_clone/$target"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.clone'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'task_execution_timeout', + 'timeout', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTarget($target): static + { + if (is_null($target)) { + return $this; + } + $this->target = $target; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Close.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Close.php new file mode 100644 index 0000000..cb9d884 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Close.php @@ -0,0 +1,68 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_close"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.close'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'master_timeout', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Create.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Create.php new file mode 100644 index 0000000..4c30095 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Create.php @@ -0,0 +1,75 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.create'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CreateDataStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CreateDataStream.php new file mode 100644 index 0000000..2907798 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/CreateDataStream.php @@ -0,0 +1,78 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_data_stream/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.create_data_stream'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DataStreamsStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DataStreamsStats.php new file mode 100644 index 0000000..a0280e0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DataStreamsStats.php @@ -0,0 +1,70 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_data_stream/$name/_stats"; + } + return "/_data_stream/_stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Delete.php new file mode 100644 index 0000000..d23a616 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Delete.php @@ -0,0 +1,67 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteAlias.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteAlias.php new file mode 100644 index 0000000..0b7b176 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteAlias.php @@ -0,0 +1,84 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for delete_alias'); + } + $index = rawurlencode($this->index); + if (!isset($this->name) || $this->name === '') { + throw new RuntimeException('name is required for delete_alias'); + } + $name = rawurlencode($this->name); + + return "/$index/_alias/$name"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php new file mode 100644 index 0000000..1c5483e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php @@ -0,0 +1,71 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_data_stream/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.delete_data_stream'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php new file mode 100644 index 0000000..38447b8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php @@ -0,0 +1,76 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.delete_index_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php new file mode 100644 index 0000000..ed50bfa --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php @@ -0,0 +1,76 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.delete_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Exists.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Exists.php new file mode 100644 index 0000000..e0c3f23 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Exists.php @@ -0,0 +1,63 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.exists'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'flat_settings', + 'ignore_unavailable', + 'include_defaults', + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsAlias.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsAlias.php new file mode 100644 index 0000000..6ea5e88 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsAlias.php @@ -0,0 +1,79 @@ +name) || $this->name === '') { + throw new RuntimeException('name is required for exists_alias'); + } + $name = rawurlencode($this->name); + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_alias/$name"; + } + return "/_alias/$name"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php new file mode 100644 index 0000000..2862ea4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php @@ -0,0 +1,77 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.exists_index_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'flat_settings', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php new file mode 100644 index 0000000..6abac88 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php @@ -0,0 +1,80 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.exists_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'flat_settings', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Flush.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Flush.php new file mode 100644 index 0000000..0691f68 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Flush.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_flush"; + } + return "/_flush"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'force', + 'ignore_unavailable', + 'wait_if_ongoing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ForceMerge.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ForceMerge.php new file mode 100644 index 0000000..4fbdfb3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ForceMerge.php @@ -0,0 +1,63 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_forcemerge"; + } + return "/_forcemerge"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'flush', + 'ignore_unavailable', + 'max_num_segments', + 'only_expunge_deletes', + 'primary_only', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Get.php new file mode 100644 index 0000000..5845a8d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Get.php @@ -0,0 +1,69 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'flat_settings', + 'ignore_unavailable', + 'include_defaults', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetAlias.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetAlias.php new file mode 100644 index 0000000..914ff03 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetAlias.php @@ -0,0 +1,81 @@ +name ? rawurlencode($this->name) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index) && isset($name)) { + return "/$index/_alias/$name"; + } + if (isset($index)) { + return "/$index/_alias"; + } + if (isset($name)) { + return "/_alias/$name"; + } + return "/_alias"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetDataStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetDataStream.php new file mode 100644 index 0000000..9a70c27 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetDataStream.php @@ -0,0 +1,70 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_data_stream/$name"; + } + return "/_data_stream"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php new file mode 100644 index 0000000..f496fba --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php @@ -0,0 +1,80 @@ +fields) || $this->fields === '') { + throw new RuntimeException('fields is required for get_field_mapping'); + } + $fields = rawurlencode($this->fields); + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_mapping/field/$fields"; + } + return "/_mapping/field/$fields"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'include_defaults', + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setFields($fields): static + { + if (!isset($fields)) { + return $this; + } + if (is_array($fields) === true) { + $fields = implode(",", $fields); + } + $this->fields = rawurlencode($fields); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetIndexTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetIndexTemplate.php new file mode 100644 index 0000000..fc871cf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetIndexTemplate.php @@ -0,0 +1,79 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/$name"; + } + return "/_index_template"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'flat_settings', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetMapping.php new file mode 100644 index 0000000..ab9c3a3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetMapping.php @@ -0,0 +1,67 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_mapping"; + } + return "/_mapping"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'index', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetSettings.php new file mode 100644 index 0000000..f653d80 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetSettings.php @@ -0,0 +1,90 @@ +name ? rawurlencode($this->name) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index) && isset($name)) { + return "/$index/_settings/$name"; + } + if (isset($index)) { + return "/$index/_settings"; + } + if (isset($name)) { + return "/_settings/$name"; + } + return "/_settings"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'flat_settings', + 'ignore_unavailable', + 'include_defaults', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetTemplate.php new file mode 100644 index 0000000..1e94e0c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetTemplate.php @@ -0,0 +1,79 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_template/$name"; + } + return "/_template"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'flat_settings', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetUpgrade.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetUpgrade.php new file mode 100644 index 0000000..e8665d7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/GetUpgrade.php @@ -0,0 +1,58 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_upgrade"; + } + return "/_upgrade"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Open.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Open.php new file mode 100644 index 0000000..f7a3963 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Open.php @@ -0,0 +1,70 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_open"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.open'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'master_timeout', + 'task_execution_timeout', + 'timeout', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutAlias.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutAlias.php new file mode 100644 index 0000000..476b853 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutAlias.php @@ -0,0 +1,92 @@ +name ? rawurlencode($this->name) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index) && isset($name)) { + return "/$index/_alias/$name"; + } + if (isset($index)) { + return "/$index/_alias"; + } + if (isset($name)) { + return "/_alias/$name"; + } + return "/_alias"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php new file mode 100644 index 0000000..91ad866 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php @@ -0,0 +1,87 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.put_index_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cause', + 'cluster_manager_timeout', + 'create', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutMapping.php new file mode 100644 index 0000000..e347548 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutMapping.php @@ -0,0 +1,78 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_mapping"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.put_mapping'); + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'ignore_unavailable', + 'master_timeout', + 'timeout', + 'write_index_only', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutSettings.php new file mode 100644 index 0000000..a25d444 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutSettings.php @@ -0,0 +1,78 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_settings"; + } + return "/_settings"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'cluster_manager_timeout', + 'expand_wildcards', + 'flat_settings', + 'ignore_unavailable', + 'master_timeout', + 'preserve_existing', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutTemplate.php new file mode 100644 index 0000000..7058b62 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/PutTemplate.php @@ -0,0 +1,87 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_template/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.put_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'create', + 'master_timeout', + 'order', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Recovery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Recovery.php new file mode 100644 index 0000000..65a2135 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Recovery.php @@ -0,0 +1,57 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_recovery"; + } + return "/_recovery"; + } + + public function getParamWhitelist(): array + { + return [ + 'active_only', + 'detailed', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Refresh.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Refresh.php new file mode 100644 index 0000000..3a7708c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Refresh.php @@ -0,0 +1,58 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_refresh"; + } + return "/_refresh"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/RefreshSearchAnalyzers.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/RefreshSearchAnalyzers.php new file mode 100644 index 0000000..ab78832 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/RefreshSearchAnalyzers.php @@ -0,0 +1,48 @@ +index ?? null; + + if (isset($index)) { + return "/_plugins/_refresh_search_analyzers/$index"; + } + throw new RuntimeException('Missing index parameter for the endpoint indices.refresh_search_analyzers'); + } + + public function getParamWhitelist(): array + { + return []; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ResolveIndex.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ResolveIndex.php new file mode 100644 index 0000000..119bc55 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ResolveIndex.php @@ -0,0 +1,72 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_resolve/index/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.resolve_index'); + } + + public function getParamWhitelist(): array + { + return [ + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (!isset($name)) { + return $this; + } + if (is_array($name) === true) { + $name = implode(",", $name); + } + $this->name = rawurlencode($name); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Rollover.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Rollover.php new file mode 100644 index 0000000..ffc656c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Rollover.php @@ -0,0 +1,103 @@ +alias) || $this->alias === '') { + throw new RuntimeException('alias is required for rollover'); + } + $alias = rawurlencode($this->alias); + $new_index = $this->new_index ? rawurlencode($this->new_index) : null; + if (isset($new_index)) { + return "/$alias/_rollover/$new_index"; + } + return "/$alias/_rollover"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'dry_run', + 'master_timeout', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAlias($alias): static + { + if (is_null($alias)) { + return $this; + } + $this->alias = $alias; + + return $this; + } + + public function setNewIndex($new_index): static + { + if (is_null($new_index)) { + return $this; + } + $this->new_index = $new_index; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Segments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Segments.php new file mode 100644 index 0000000..fc20e6f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Segments.php @@ -0,0 +1,59 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_segments"; + } + return "/_segments"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'verbose', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ShardStores.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ShardStores.php new file mode 100644 index 0000000..639b949 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ShardStores.php @@ -0,0 +1,59 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_shard_stores"; + } + return "/_shard_stores"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'status', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Shrink.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Shrink.php new file mode 100644 index 0000000..94bb125 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Shrink.php @@ -0,0 +1,91 @@ +index ? rawurlencode($this->index) : null; + $target = $this->target ? rawurlencode($this->target) : null; + if (isset($index) && isset($target)) { + return "/$index/_shrink/$target"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.shrink'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'copy_settings', + 'master_timeout', + 'task_execution_timeout', + 'timeout', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTarget($target): static + { + if (is_null($target)) { + return $this; + } + $this->target = $target; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php new file mode 100644 index 0000000..2a9863c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php @@ -0,0 +1,85 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/_simulate_index/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.simulate_index_template'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php new file mode 100644 index 0000000..58fa105 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php @@ -0,0 +1,86 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_index_template/_simulate/$name"; + } + return "/_index_template/_simulate"; + } + + public function getParamWhitelist(): array + { + return [ + 'cause', + 'cluster_manager_timeout', + 'create', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Split.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Split.php new file mode 100644 index 0000000..0811ac7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Split.php @@ -0,0 +1,91 @@ +index ? rawurlencode($this->index) : null; + $target = $this->target ? rawurlencode($this->target) : null; + if (isset($index) && isset($target)) { + return "/$index/_split/$target"; + } + throw new RuntimeException('Missing parameter for the endpoint indices.split'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'copy_settings', + 'master_timeout', + 'task_execution_timeout', + 'timeout', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTarget($target): static + { + if (is_null($target)) { + return $this; + } + $this->target = $target; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Stats.php new file mode 100644 index 0000000..ef02311 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Stats.php @@ -0,0 +1,86 @@ +metric ? rawurlencode($this->metric) : null; + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index) && isset($metric)) { + return "/$index/_stats/$metric"; + } + if (isset($metric)) { + return "/_stats/$metric"; + } + if (isset($index)) { + return "/$index/_stats"; + } + return "/_stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'completion_fields', + 'expand_wildcards', + 'fielddata_fields', + 'fields', + 'forbid_closed_indices', + 'groups', + 'include_segment_file_sizes', + 'include_unloaded_segments', + 'level', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/UpdateAliases.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/UpdateAliases.php new file mode 100644 index 0000000..dc20cc2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/UpdateAliases.php @@ -0,0 +1,69 @@ +body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Upgrade.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Upgrade.php new file mode 100644 index 0000000..14d7695 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/Upgrade.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_upgrade"; + } + return "/_upgrade"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'only_ancient_segments', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ValidateQuery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ValidateQuery.php new file mode 100644 index 0000000..d78dcac --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Indices/ValidateQuery.php @@ -0,0 +1,77 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_validate/query"; + } + return "/_validate/query"; + } + + public function getParamWhitelist(): array + { + return [ + 'all_shards', + 'allow_no_indices', + 'analyze_wildcard', + 'analyzer', + 'default_operator', + 'df', + 'expand_wildcards', + 'explain', + 'ignore_unavailable', + 'lenient', + 'q', + 'rewrite', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Info.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Info.php new file mode 100644 index 0000000..136011e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Info.php @@ -0,0 +1,49 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_ingest/pipeline/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ingest.delete_pipeline'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/GetPipeline.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/GetPipeline.php new file mode 100644 index 0000000..6b5a57e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/GetPipeline.php @@ -0,0 +1,62 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_ingest/pipeline/$id"; + } + return "/_ingest/pipeline"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php new file mode 100644 index 0000000..d3290ee --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php @@ -0,0 +1,52 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_ingest/pipeline/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ingest.put_pipeline'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/Simulate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/Simulate.php new file mode 100644 index 0000000..63edf92 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingest/Simulate.php @@ -0,0 +1,66 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_ingest/pipeline/$id/_simulate"; + } + return "/_ingest/pipeline/_simulate"; + } + + public function getParamWhitelist(): array + { + return [ + 'verbose', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/GetState.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/GetState.php new file mode 100644 index 0000000..15cb0ad --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/GetState.php @@ -0,0 +1,53 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/ingestion/_state"; + } + throw new RuntimeException('Missing parameter for the endpoint ingestion.get_state'); + } + + public function getParamWhitelist(): array + { + return [ + 'next_token', + 'size', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Pause.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Pause.php new file mode 100644 index 0000000..09714e9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Pause.php @@ -0,0 +1,52 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/ingestion/_pause"; + } + throw new RuntimeException('Missing parameter for the endpoint ingestion.pause'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Resume.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Resume.php new file mode 100644 index 0000000..76500ad --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ingestion/Resume.php @@ -0,0 +1,62 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/ingestion/_resume"; + } + throw new RuntimeException('Missing parameter for the endpoint ingestion.resume'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Insights/TopQueries.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Insights/TopQueries.php new file mode 100644 index 0000000..6a3750f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Insights/TopQueries.php @@ -0,0 +1,45 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_ism/add/$index"; + } + return "/_plugins/_ism/add"; + } + + public function getParamWhitelist(): array + { + return [ + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ChangePolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ChangePolicy.php new file mode 100644 index 0000000..f068d41 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ChangePolicy.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_ism/change_policy/$index"; + } + return "/_plugins/_ism/change_policy"; + } + + public function getParamWhitelist(): array + { + return [ + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/DeletePolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/DeletePolicy.php new file mode 100644 index 0000000..a2a69f7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/DeletePolicy.php @@ -0,0 +1,63 @@ +policy_id) || $this->policy_id === '') { + throw new RuntimeException('policy_id is required for delete_policy'); + } + $policy_id = rawurlencode($this->policy_id); + + return "/_plugins/_ism/policies/$policy_id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setPolicyId($policy_id): static + { + if (is_null($policy_id)) { + return $this; + } + $this->policy_id = $policy_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExistsPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExistsPolicy.php new file mode 100644 index 0000000..bbe04d6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExistsPolicy.php @@ -0,0 +1,63 @@ +policy_id) || $this->policy_id === '') { + throw new RuntimeException('policy_id is required for exists_policy'); + } + $policy_id = rawurlencode($this->policy_id); + + return "/_plugins/_ism/policies/$policy_id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'HEAD'; + } + + public function setPolicyId($policy_id): static + { + if (is_null($policy_id)) { + return $this; + } + $this->policy_id = $policy_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExplainPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExplainPolicy.php new file mode 100644 index 0000000..1dcbcce --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/ExplainPolicy.php @@ -0,0 +1,59 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_ism/explain/$index"; + } + return "/_plugins/_ism/explain"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/GetPolicies.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/GetPolicies.php new file mode 100644 index 0000000..4da4ccc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/GetPolicies.php @@ -0,0 +1,45 @@ +policy_id) || $this->policy_id === '') { + throw new RuntimeException('policy_id is required for get_policy'); + } + $policy_id = rawurlencode($this->policy_id); + + return "/_plugins/_ism/policies/$policy_id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setPolicyId($policy_id): static + { + if (is_null($policy_id)) { + return $this; + } + $this->policy_id = $policy_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicies.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicies.php new file mode 100644 index 0000000..09ec3cd --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicies.php @@ -0,0 +1,58 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicy.php new file mode 100644 index 0000000..01bf204 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/PutPolicy.php @@ -0,0 +1,75 @@ +policy_id) || $this->policy_id === '') { + throw new RuntimeException('policy_id is required for put_policy'); + } + $policy_id = rawurlencode($this->policy_id); + + return "/_plugins/_ism/policies/$policy_id"; + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setPolicyId($policy_id): static + { + if (is_null($policy_id)) { + return $this; + } + $this->policy_id = $policy_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RefreshSearchAnalyzers.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RefreshSearchAnalyzers.php new file mode 100644 index 0000000..b3cbbd4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RefreshSearchAnalyzers.php @@ -0,0 +1,51 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for refresh_search_analyzers'); + } + $index = rawurlencode($this->index); + + return "/_plugins/_refresh_search_analyzers/$index"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RemovePolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RemovePolicy.php new file mode 100644 index 0000000..55393e1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RemovePolicy.php @@ -0,0 +1,50 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_ism/remove/$index"; + } + return "/_plugins/_ism/remove"; + } + + public function getParamWhitelist(): array + { + return [ + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RetryIndex.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RetryIndex.php new file mode 100644 index 0000000..921bd27 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ism/RetryIndex.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_ism/retry/$index"; + } + return "/_plugins/_ism/retry"; + } + + public function getParamWhitelist(): array + { + return [ + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/DeleteModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/DeleteModel.php new file mode 100644 index 0000000..e00c657 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/DeleteModel.php @@ -0,0 +1,62 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_knn/models/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint knn.delete_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/GetModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/GetModel.php new file mode 100644 index 0000000..c5b571d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/GetModel.php @@ -0,0 +1,62 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_knn/models/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint knn.get_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/SearchModels.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/SearchModels.php new file mode 100644 index 0000000..a190a82 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/SearchModels.php @@ -0,0 +1,97 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Stats.php new file mode 100644 index 0000000..336c8e8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Stats.php @@ -0,0 +1,86 @@ +node_id ? rawurlencode($this->node_id) : null; + $stat = $this->stat ? rawurlencode($this->stat) : null; + if (isset($node_id) && isset($stat)) { + return "/_plugins/_knn/$node_id/stats/$stat"; + } + if (isset($node_id)) { + return "/_plugins/_knn/$node_id/stats"; + } + if (isset($stat)) { + return "/_plugins/_knn/stats/$stat"; + } + return "/_plugins/_knn/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } + + public function setStat($stat): static + { + if (!isset($stat)) { + return $this; + } + if (is_array($stat) === true) { + $stat = implode(",", $stat); + } + $this->stat = rawurlencode($stat); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/TrainModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/TrainModel.php new file mode 100644 index 0000000..ca4580e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/TrainModel.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_knn/models/$model_id/_train"; + } + return "/_plugins/_knn/models/_train"; + } + + public function getParamWhitelist(): array + { + return [ + 'preference', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Warmup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Warmup.php new file mode 100644 index 0000000..7cc8557 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Knn/Warmup.php @@ -0,0 +1,51 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for warmup'); + } + $index = rawurlencode($this->index); + + return "/_plugins/_knn/warmup/$index"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Help.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Help.php new file mode 100644 index 0000000..d3ac504 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Help.php @@ -0,0 +1,45 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_list/indices/$index"; + } + return "/_list/indices"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'expand_wildcards', + 'format', + 'h', + 'health', + 'help', + 'include_unloaded_segments', + 'local', + 'master_timeout', + 'next_token', + 'pri', + 's', + 'size', + 'sort', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Shards.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Shards.php new file mode 100644 index 0000000..2d2e0ef --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/List/Shards.php @@ -0,0 +1,67 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_list/shards/$index"; + } + return "/_list/shards"; + } + + public function getParamWhitelist(): array + { + return [ + 'bytes', + 'cluster_manager_timeout', + 'format', + 'h', + 'help', + 'local', + 'master_timeout', + 'next_token', + 's', + 'size', + 'sort', + 'time', + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSet.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSet.php new file mode 100644 index 0000000..a84b62d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSet.php @@ -0,0 +1,90 @@ +name) || $this->name === '') { + throw new RuntimeException('name is required for add_features_to_set'); + } + $name = rawurlencode($this->name); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$name/_addfeatures"; + } + return "/_ltr/_featureset/$name/_addfeatures"; + } + + public function getParamWhitelist(): array + { + return [ + 'merge', + 'routing', + 'version', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSetByQuery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSetByQuery.php new file mode 100644 index 0000000..d869bef --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/AddFeaturesToSetByQuery.php @@ -0,0 +1,95 @@ +name) || $this->name === '') { + throw new RuntimeException('name is required for add_features_to_set_by_query'); + } + $name = rawurlencode($this->name); + if (!isset($this->query) || $this->query === '') { + throw new RuntimeException('query is required for add_features_to_set_by_query'); + } + $query = rawurlencode($this->query); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$name/_addfeatures/$query"; + } + return "/_ltr/_featureset/$name/_addfeatures/$query"; + } + + public function getParamWhitelist(): array + { + return [ + 'merge', + 'routing', + 'version', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + public function setQuery($query): static + { + if (is_null($query)) { + return $this; + } + $this->query = $query; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CacheStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CacheStats.php new file mode 100644 index 0000000..b5d495c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CacheStats.php @@ -0,0 +1,45 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_clearcache"; + } + return "/_ltr/_clearcache"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateDefaultStore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateDefaultStore.php new file mode 100644 index 0000000..cd7ef2f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateDefaultStore.php @@ -0,0 +1,45 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for create_feature'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_feature/$id"; + } + return "/_ltr/_feature/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateFeatureset.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateFeatureset.php new file mode 100644 index 0000000..c458204 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateFeatureset.php @@ -0,0 +1,77 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for create_featureset'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$id"; + } + return "/_ltr/_featureset/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModel.php new file mode 100644 index 0000000..695cd9f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModel.php @@ -0,0 +1,77 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for create_model'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_model/$id"; + } + return "/_ltr/_model/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModelFromSet.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModelFromSet.php new file mode 100644 index 0000000..725776b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateModelFromSet.php @@ -0,0 +1,88 @@ +name) || $this->name === '') { + throw new RuntimeException('name is required for create_model_from_set'); + } + $name = rawurlencode($this->name); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$name/_createmodel"; + } + return "/_ltr/_featureset/$name/_createmodel"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateStore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateStore.php new file mode 100644 index 0000000..c7cfe9c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/CreateStore.php @@ -0,0 +1,62 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store"; + } + throw new RuntimeException('Missing parameter for the endpoint ltr.create_store'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteDefaultStore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteDefaultStore.php new file mode 100644 index 0000000..3b3fedf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteDefaultStore.php @@ -0,0 +1,45 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete_feature'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_feature/$id"; + } + return "/_ltr/_feature/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteFeatureset.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteFeatureset.php new file mode 100644 index 0000000..37b7462 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteFeatureset.php @@ -0,0 +1,66 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete_featureset'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$id"; + } + return "/_ltr/_featureset/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteModel.php new file mode 100644 index 0000000..09fba04 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteModel.php @@ -0,0 +1,66 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete_model'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_model/$id"; + } + return "/_ltr/_model/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteStore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteStore.php new file mode 100644 index 0000000..95bad11 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/DeleteStore.php @@ -0,0 +1,62 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store"; + } + throw new RuntimeException('Missing parameter for the endpoint ltr.delete_store'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeature.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeature.php new file mode 100644 index 0000000..c1af3c5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeature.php @@ -0,0 +1,66 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get_feature'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_feature/$id"; + } + return "/_ltr/_feature/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeatureset.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeatureset.php new file mode 100644 index 0000000..1bb0d0c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetFeatureset.php @@ -0,0 +1,66 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get_featureset'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$id"; + } + return "/_ltr/_featureset/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetModel.php new file mode 100644 index 0000000..1e471d5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetModel.php @@ -0,0 +1,66 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get_model'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_model/$id"; + } + return "/_ltr/_model/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetStore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetStore.php new file mode 100644 index 0000000..683f927 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/GetStore.php @@ -0,0 +1,62 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store"; + } + throw new RuntimeException('Missing parameter for the endpoint ltr.get_store'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/ListStores.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/ListStores.php new file mode 100644 index 0000000..2324cab --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/ListStores.php @@ -0,0 +1,45 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_feature"; + } + return "/_ltr/_feature"; + } + + public function getParamWhitelist(): array + { + return [ + 'from', + 'prefix', + 'size', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchFeaturesets.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchFeaturesets.php new file mode 100644 index 0000000..f700c3d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchFeaturesets.php @@ -0,0 +1,64 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset"; + } + return "/_ltr/_featureset"; + } + + public function getParamWhitelist(): array + { + return [ + 'from', + 'prefix', + 'size', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchModels.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchModels.php new file mode 100644 index 0000000..af449d4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/SearchModels.php @@ -0,0 +1,64 @@ +store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_model"; + } + return "/_ltr/_model"; + } + + public function getParamWhitelist(): array + { + return [ + 'from', + 'prefix', + 'size', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/Stats.php new file mode 100644 index 0000000..269b843 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/Stats.php @@ -0,0 +1,86 @@ +node_id ? rawurlencode($this->node_id) : null; + $stat = $this->stat ? rawurlencode($this->stat) : null; + if (isset($node_id) && isset($stat)) { + return "/_plugins/_ltr/$node_id/stats/$stat"; + } + if (isset($node_id)) { + return "/_plugins/_ltr/$node_id/stats"; + } + if (isset($stat)) { + return "/_plugins/_ltr/stats/$stat"; + } + return "/_plugins/_ltr/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } + + public function setStat($stat): static + { + if (!isset($stat)) { + return $this; + } + if (is_array($stat) === true) { + $stat = implode(",", $stat); + } + $this->stat = rawurlencode($stat); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeature.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeature.php new file mode 100644 index 0000000..6d8b66a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeature.php @@ -0,0 +1,77 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for update_feature'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_feature/$id"; + } + return "/_ltr/_feature/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeatureset.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeatureset.php new file mode 100644 index 0000000..5061201 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ltr/UpdateFeatureset.php @@ -0,0 +1,77 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for update_featureset'); + } + $id = rawurlencode($this->id); + $store = $this->store ? rawurlencode($this->store) : null; + if (isset($store)) { + return "/_ltr/$store/_featureset/$id"; + } + return "/_ltr/_featureset/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setStore($store): static + { + if (is_null($store)) { + return $this; + } + $this->store = $store; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MTermVectors.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MTermVectors.php new file mode 100644 index 0000000..8768b46 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MTermVectors.php @@ -0,0 +1,75 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_mtermvectors"; + } + return "/_mtermvectors"; + } + + public function getParamWhitelist(): array + { + return [ + 'field_statistics', + 'fields', + 'ids', + 'offsets', + 'payloads', + 'positions', + 'preference', + 'realtime', + 'routing', + 'term_statistics', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Mget.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Mget.php new file mode 100644 index 0000000..d146138 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Mget.php @@ -0,0 +1,71 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_mget"; + } + return "/_mget"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'preference', + 'realtime', + 'refresh', + 'routing', + 'stored_fields', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/AddAgenticMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/AddAgenticMemory.php new file mode 100644 index 0000000..d5ee02b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/AddAgenticMemory.php @@ -0,0 +1,72 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + if (isset($memory_container_id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.add_agentic_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ChunkModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ChunkModel.php new file mode 100644 index 0000000..ab54a1c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ChunkModel.php @@ -0,0 +1,87 @@ +chunk_number ? rawurlencode($this->chunk_number) : null; + $model_id = $this->model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id) && isset($chunk_number)) { + return "/_plugins/_ml/models/$model_id/chunk/$chunk_number"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.chunk_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setChunkNumber($chunk_number): static + { + if (is_null($chunk_number)) { + return $this; + } + $this->chunk_number = $chunk_number; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateConnector.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateConnector.php new file mode 100644 index 0000000..b7b8a46 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateConnector.php @@ -0,0 +1,53 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateController.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateController.php new file mode 100644 index 0000000..dd52ab0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateController.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/controllers/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.create_controller'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemory.php new file mode 100644 index 0000000..8f10866 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemory.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainer.php new file mode 100644 index 0000000..a3115f0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainer.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainerSession.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainerSession.php new file mode 100644 index 0000000..452b5d2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMemoryContainerSession.php @@ -0,0 +1,72 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + if (isset($memory_container_id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/sessions"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.create_memory_container_session'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMessage.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMessage.php new file mode 100644 index 0000000..9a9b050 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateMessage.php @@ -0,0 +1,72 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id/messages"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.create_message'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateModelMeta.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateModelMeta.php new file mode 100644 index 0000000..8d2c22c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/CreateModelMeta.php @@ -0,0 +1,58 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgent.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgent.php new file mode 100644 index 0000000..2a1e05b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgent.php @@ -0,0 +1,62 @@ +agent_id ? rawurlencode($this->agent_id) : null; + if (isset($agent_id)) { + return "/_plugins/_ml/agents/$agent_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_agent'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setAgentId($agent_id): static + { + if (is_null($agent_id)) { + return $this; + } + $this->agent_id = $agent_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemory.php new file mode 100644 index 0000000..a2009ce --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemory.php @@ -0,0 +1,75 @@ +id ? rawurlencode($this->id) : null; + $memory_container_id = $this->memory_container_id ? rawurlencode($this->memory_container_id) : null; + $type = $this->type ? rawurlencode($this->type) : null; + if (isset($memory_container_id) && isset($type) && isset($id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/$type/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_agentic_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } + + public function setType($type): static + { + if (is_null($type)) { + return $this; + } + $this->type = $type; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemoryQuery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemoryQuery.php new file mode 100644 index 0000000..ad40cad --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteAgenticMemoryQuery.php @@ -0,0 +1,84 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + $type = $this->type ? rawurlencode($this->type) : null; + if (isset($memory_container_id) && isset($type)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/$type/_delete_by_query"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_agentic_memory_query'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } + + public function setType($type): static + { + if (is_null($type)) { + return $this; + } + $this->type = $type; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteConnector.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteConnector.php new file mode 100644 index 0000000..96f8dda --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteConnector.php @@ -0,0 +1,60 @@ +connector_id ? rawurlencode($this->connector_id) : null; + if (isset($connector_id)) { + return "/_plugins/_ml/connectors/$connector_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_connector'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setConnectorId($connector_id): static + { + if (is_null($connector_id)) { + return $this; + } + $this->connector_id = $connector_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteController.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteController.php new file mode 100644 index 0000000..ec03c86 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteController.php @@ -0,0 +1,62 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/controllers/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_controller'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemory.php new file mode 100644 index 0000000..afa12d4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemory.php @@ -0,0 +1,62 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemoryContainer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemoryContainer.php new file mode 100644 index 0000000..d706307 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteMemoryContainer.php @@ -0,0 +1,64 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + if (isset($memory_container_id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_memory_container'); + } + + public function getParamWhitelist(): array + { + return [ + 'delete_all_memories', + 'delete_memories', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModel.php new file mode 100644 index 0000000..afc046a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModel.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_ml/models/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php new file mode 100644 index 0000000..6dda48f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_ml/model_groups/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_model_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteTask.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteTask.php new file mode 100644 index 0000000..1c52fba --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeleteTask.php @@ -0,0 +1,62 @@ +task_id ? rawurlencode($this->task_id) : null; + if (isset($task_id)) { + return "/_plugins/_ml/tasks/$task_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.delete_task'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeployModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeployModel.php new file mode 100644 index 0000000..75747ef --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/DeployModel.php @@ -0,0 +1,60 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_deploy"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.deploy_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgent.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgent.php new file mode 100644 index 0000000..4d7c754 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgent.php @@ -0,0 +1,72 @@ +agent_id ? rawurlencode($this->agent_id) : null; + if (isset($agent_id)) { + return "/_plugins/_ml/agents/$agent_id/_execute"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.execute_agent'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAgentId($agent_id): static + { + if (is_null($agent_id)) { + return $this; + } + $this->agent_id = $agent_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgentStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgentStream.php new file mode 100644 index 0000000..8423215 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAgentStream.php @@ -0,0 +1,72 @@ +agent_id ? rawurlencode($this->agent_id) : null; + if (isset($agent_id)) { + return "/_plugins/_ml/agents/$agent_id/_execute/stream"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.execute_agent_stream'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAgentId($agent_id): static + { + if (is_null($agent_id)) { + return $this; + } + $this->agent_id = $agent_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAlgorithm.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAlgorithm.php new file mode 100644 index 0000000..8ed8a79 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteAlgorithm.php @@ -0,0 +1,72 @@ +algorithm_name ? rawurlencode($this->algorithm_name) : null; + if (isset($algorithm_name)) { + return "/_plugins/_ml/_execute/$algorithm_name"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.execute_algorithm'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAlgorithmName($algorithm_name): static + { + if (is_null($algorithm_name)) { + return $this; + } + $this->algorithm_name = $algorithm_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteTool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteTool.php new file mode 100644 index 0000000..81bba3f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/ExecuteTool.php @@ -0,0 +1,72 @@ +tool_name ? rawurlencode($this->tool_name) : null; + if (isset($tool_name)) { + return "/_plugins/_ml/tools/_execute/$tool_name"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.execute_tool'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setToolName($tool_name): static + { + if (is_null($tool_name)) { + return $this; + } + $this->tool_name = $tool_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgent.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgent.php new file mode 100644 index 0000000..338a8bf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgent.php @@ -0,0 +1,62 @@ +agent_id ? rawurlencode($this->agent_id) : null; + if (isset($agent_id)) { + return "/_plugins/_ml/agents/$agent_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_agent'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setAgentId($agent_id): static + { + if (is_null($agent_id)) { + return $this; + } + $this->agent_id = $agent_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgenticMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgenticMemory.php new file mode 100644 index 0000000..9eca19b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAgenticMemory.php @@ -0,0 +1,75 @@ +id ? rawurlencode($this->id) : null; + $memory_container_id = $this->memory_container_id ? rawurlencode($this->memory_container_id) : null; + $type = $this->type ? rawurlencode($this->type) : null; + if (isset($memory_container_id) && isset($type) && isset($id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/$type/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_agentic_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } + + public function setType($type): static + { + if (is_null($type)) { + return $this; + } + $this->type = $type; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllMemories.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllMemories.php new file mode 100644 index 0000000..436c109 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllMemories.php @@ -0,0 +1,47 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id/messages"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_all_messages'); + } + + public function getParamWhitelist(): array + { + return [ + 'max_results', + 'next_token', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllTools.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllTools.php new file mode 100644 index 0000000..19ef499 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetAllTools.php @@ -0,0 +1,45 @@ +connector_id ? rawurlencode($this->connector_id) : null; + if (isset($connector_id)) { + return "/_plugins/_ml/connectors/$connector_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_connector'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setConnectorId($connector_id): static + { + if (is_null($connector_id)) { + return $this; + } + $this->connector_id = $connector_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetConnectors.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetConnectors.php new file mode 100644 index 0000000..4d18eb3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetConnectors.php @@ -0,0 +1,43 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/controllers/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_controller'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemory.php new file mode 100644 index 0000000..a132ee2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemory.php @@ -0,0 +1,62 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemoryContainer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemoryContainer.php new file mode 100644 index 0000000..b6feece --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMemoryContainer.php @@ -0,0 +1,62 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + if (isset($memory_container_id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_memory_container'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessage.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessage.php new file mode 100644 index 0000000..748509c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessage.php @@ -0,0 +1,62 @@ +message_id ? rawurlencode($this->message_id) : null; + if (isset($message_id)) { + return "/_plugins/_ml/memory/message/$message_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_message'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMessageId($message_id): static + { + if (is_null($message_id)) { + return $this; + } + $this->message_id = $message_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessageTraces.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessageTraces.php new file mode 100644 index 0000000..1e9f4e0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetMessageTraces.php @@ -0,0 +1,64 @@ +message_id ? rawurlencode($this->message_id) : null; + if (isset($message_id)) { + return "/_plugins/_ml/memory/message/$message_id/traces"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_message_traces'); + } + + public function getParamWhitelist(): array + { + return [ + 'max_results', + 'next_token', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setMessageId($message_id): static + { + if (is_null($message_id)) { + return $this; + } + $this->message_id = $message_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModel.php new file mode 100644 index 0000000..5875b04 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModel.php @@ -0,0 +1,60 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroup.php new file mode 100644 index 0000000..7d8d021 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroup.php @@ -0,0 +1,62 @@ +model_group_id ? rawurlencode($this->model_group_id) : null; + if (isset($model_group_id)) { + return "/_plugins/_ml/model_groups/$model_group_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_model_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setModelGroupId($model_group_id): static + { + if (is_null($model_group_id)) { + return $this; + } + $this->model_group_id = $model_group_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroups.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroups.php new file mode 100644 index 0000000..3a50731 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetModelGroups.php @@ -0,0 +1,43 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileModels.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileModels.php new file mode 100644 index 0000000..9188f6b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileModels.php @@ -0,0 +1,71 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/profile/models/$model_id"; + } + return "/_plugins/_ml/profile/models"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileTasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileTasks.php new file mode 100644 index 0000000..752cbda --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetProfileTasks.php @@ -0,0 +1,71 @@ +task_id ? rawurlencode($this->task_id) : null; + if (isset($task_id)) { + return "/_plugins/_ml/profile/tasks/$task_id"; + } + return "/_plugins/_ml/profile/tasks"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetStats.php new file mode 100644 index 0000000..1a1dbc8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetStats.php @@ -0,0 +1,82 @@ +node_id ? rawurlencode($this->node_id) : null; + $stat = $this->stat ? rawurlencode($this->stat) : null; + if (isset($node_id) && isset($stat)) { + return "/_plugins/_ml/$node_id/stats/$stat"; + } + if (isset($node_id)) { + return "/_plugins/_ml/$node_id/stats"; + } + if (isset($stat)) { + return "/_plugins/_ml/stats/$stat"; + } + return "/_plugins/_ml/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (is_null($node_id)) { + return $this; + } + $this->node_id = $node_id; + + return $this; + } + + public function setStat($stat): static + { + if (!isset($stat)) { + return $this; + } + if (is_array($stat) === true) { + $stat = implode(",", $stat); + } + $this->stat = rawurlencode($stat); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTask.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTask.php new file mode 100644 index 0000000..bc23116 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTask.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_ml/tasks/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_task'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTool.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTool.php new file mode 100644 index 0000000..59a0146 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/GetTool.php @@ -0,0 +1,62 @@ +tool_name ? rawurlencode($this->tool_name) : null; + if (isset($tool_name)) { + return "/_plugins/_ml/tools/$tool_name"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.get_tool'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setToolName($tool_name): static + { + if (is_null($tool_name)) { + return $this; + } + $this->tool_name = $tool_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/LoadModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/LoadModel.php new file mode 100644 index 0000000..d2445e4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/LoadModel.php @@ -0,0 +1,65 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_load"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.load_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Predict.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Predict.php new file mode 100644 index 0000000..af33de6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Predict.php @@ -0,0 +1,82 @@ +algorithm_name ? rawurlencode($this->algorithm_name) : null; + $model_id = $this->model_id ? rawurlencode($this->model_id) : null; + if (isset($algorithm_name) && isset($model_id)) { + return "/_plugins/_ml/_predict/$algorithm_name/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.predict'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAlgorithmName($algorithm_name): static + { + if (is_null($algorithm_name)) { + return $this; + } + $this->algorithm_name = $algorithm_name; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModel.php new file mode 100644 index 0000000..e8443ea --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModel.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_predict"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.predict_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModelStream.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModelStream.php new file mode 100644 index 0000000..f4b0f46 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/PredictModelStream.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_predict/stream"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.predict_model_stream'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterAgents.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterAgents.php new file mode 100644 index 0000000..cbfa908 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterAgents.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModel.php new file mode 100644 index 0000000..1cb2311 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModel.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php new file mode 100644 index 0000000..6058ede --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelMeta.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelMeta.php new file mode 100644 index 0000000..dd4902f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/RegisterModelMeta.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgenticMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgenticMemory.php new file mode 100644 index 0000000..5e593bb --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgenticMemory.php @@ -0,0 +1,84 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + $type = $this->type ? rawurlencode($this->type) : null; + if (isset($memory_container_id) && isset($type)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/$type/_search"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.search_agentic_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } + + public function setType($type): static + { + if (is_null($type)) { + return $this; + } + $this->type = $type; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgents.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgents.php new file mode 100644 index 0000000..b236cd9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchAgents.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchConnectors.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchConnectors.php new file mode 100644 index 0000000..b03ccf7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchConnectors.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemory.php new file mode 100644 index 0000000..938b7ed --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemory.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemoryContainer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemoryContainer.php new file mode 100644 index 0000000..40bf36f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMemoryContainer.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMessage.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMessage.php new file mode 100644 index 0000000..2083efc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchMessage.php @@ -0,0 +1,72 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id/_search"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.search_message'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModelGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModelGroup.php new file mode 100644 index 0000000..68d8fec --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModelGroup.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModels.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModels.php new file mode 100644 index 0000000..868d295 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchModels.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchTasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchTasks.php new file mode 100644 index 0000000..75bb111 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/SearchTasks.php @@ -0,0 +1,55 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Train.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Train.php new file mode 100644 index 0000000..cef42e4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/Train.php @@ -0,0 +1,72 @@ +algorithm_name ? rawurlencode($this->algorithm_name) : null; + if (isset($algorithm_name)) { + return "/_plugins/_ml/_train/$algorithm_name"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.train'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAlgorithmName($algorithm_name): static + { + if (is_null($algorithm_name)) { + return $this; + } + $this->algorithm_name = $algorithm_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/TrainPredict.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/TrainPredict.php new file mode 100644 index 0000000..57512ff --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/TrainPredict.php @@ -0,0 +1,72 @@ +algorithm_name ? rawurlencode($this->algorithm_name) : null; + if (isset($algorithm_name)) { + return "/_plugins/_ml/_train_predict/$algorithm_name"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.train_predict'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setAlgorithmName($algorithm_name): static + { + if (is_null($algorithm_name)) { + return $this; + } + $this->algorithm_name = $algorithm_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UndeployModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UndeployModel.php new file mode 100644 index 0000000..5ce2135 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UndeployModel.php @@ -0,0 +1,69 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_undeploy"; + } + return "/_plugins/_ml/models/_undeploy"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UnloadModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UnloadModel.php new file mode 100644 index 0000000..c544851 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UnloadModel.php @@ -0,0 +1,74 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id/_unload"; + } + return "/_plugins/_ml/models/_unload"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateAgenticMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateAgenticMemory.php new file mode 100644 index 0000000..ec9642c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateAgenticMemory.php @@ -0,0 +1,85 @@ +id ? rawurlencode($this->id) : null; + $memory_container_id = $this->memory_container_id ? rawurlencode($this->memory_container_id) : null; + $type = $this->type ? rawurlencode($this->type) : null; + if (isset($memory_container_id) && isset($type) && isset($id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id/memories/$type/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_agentic_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } + + public function setType($type): static + { + if (is_null($type)) { + return $this; + } + $this->type = $type; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateConnector.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateConnector.php new file mode 100644 index 0000000..e5f2165 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateConnector.php @@ -0,0 +1,72 @@ +connector_id ? rawurlencode($this->connector_id) : null; + if (isset($connector_id)) { + return "/_plugins/_ml/connectors/$connector_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_connector'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setConnectorId($connector_id): static + { + if (is_null($connector_id)) { + return $this; + } + $this->connector_id = $connector_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateController.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateController.php new file mode 100644 index 0000000..619680c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateController.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/controllers/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_controller'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemory.php new file mode 100644 index 0000000..09a365f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemory.php @@ -0,0 +1,72 @@ +memory_id ? rawurlencode($this->memory_id) : null; + if (isset($memory_id)) { + return "/_plugins/_ml/memory/$memory_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_memory'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryId($memory_id): static + { + if (is_null($memory_id)) { + return $this; + } + $this->memory_id = $memory_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemoryContainer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemoryContainer.php new file mode 100644 index 0000000..df43da9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMemoryContainer.php @@ -0,0 +1,72 @@ +memory_container_id ? rawurlencode($this->memory_container_id) : null; + if (isset($memory_container_id)) { + return "/_plugins/_ml/memory_containers/$memory_container_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_memory_container'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMemoryContainerId($memory_container_id): static + { + if (is_null($memory_container_id)) { + return $this; + } + $this->memory_container_id = $memory_container_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMessage.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMessage.php new file mode 100644 index 0000000..af704a7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateMessage.php @@ -0,0 +1,72 @@ +message_id ? rawurlencode($this->message_id) : null; + if (isset($message_id)) { + return "/_plugins/_ml/memory/message/$message_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_message'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setMessageId($message_id): static + { + if (is_null($message_id)) { + return $this; + } + $this->message_id = $message_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModel.php new file mode 100644 index 0000000..76a7234 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModel.php @@ -0,0 +1,72 @@ +model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id)) { + return "/_plugins/_ml/models/$model_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_model'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php new file mode 100644 index 0000000..9b1c80e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php @@ -0,0 +1,70 @@ +model_group_id ? rawurlencode($this->model_group_id) : null; + if (isset($model_group_id)) { + return "/_plugins/_ml/model_groups/$model_group_id"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.update_model_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setModelGroupId($model_group_id): static + { + if (is_null($model_group_id)) { + return $this; + } + $this->model_group_id = $model_group_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadChunk.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadChunk.php new file mode 100644 index 0000000..178a13e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadChunk.php @@ -0,0 +1,84 @@ +chunk_number ? rawurlencode($this->chunk_number) : null; + $model_id = $this->model_id ? rawurlencode($this->model_id) : null; + if (isset($model_id) && isset($chunk_number)) { + return "/_plugins/_ml/models/$model_id/upload_chunk/$chunk_number"; + } + throw new RuntimeException('Missing parameter for the endpoint ml.upload_chunk'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setChunkNumber($chunk_number): static + { + if (is_null($chunk_number)) { + return $this; + } + $this->chunk_number = $chunk_number; + + return $this; + } + + public function setModelId($model_id): static + { + if (is_null($model_id)) { + return $this; + } + $this->model_id = $model_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadModel.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadModel.php new file mode 100644 index 0000000..e4ac991 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ml/UploadModel.php @@ -0,0 +1,58 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Monitoring/Bulk.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Monitoring/Bulk.php new file mode 100644 index 0000000..797a3f6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Monitoring/Bulk.php @@ -0,0 +1,74 @@ +serializer = $serializer; + } + + public function getURI(): string + { + return "/_monitoring/bulk"; + } + + public function getParamWhitelist(): array + { + return [ + 'system_id', + 'system_api_version', + 'interval' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (isset($body) !== true) { + return $this; + } + if (is_array($body) === true || $body instanceof Traversable) { + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + } elseif (is_string($body)) { + $this->body = $body; + if (substr($body, -1) != "\n") { + $this->body .= "\n"; + } + } else { + throw new InvalidArgumentException("Body must be an array, traversable object or string"); + } + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Msearch.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Msearch.php new file mode 100644 index 0000000..84e1b27 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Msearch.php @@ -0,0 +1,91 @@ +serializer = $serializer; + } + + public function getURI(): string + { + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_msearch"; + } + return "/_msearch"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_partial_results', + 'ccs_minimize_roundtrips', + 'max_concurrent_searches', + 'max_concurrent_shard_requests', + 'pre_filter_shard_size', + 'rest_total_hits_as_int', + 'search_type', + 'typed_keys', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody(string|iterable|null $body): static + { + if (is_null($body)) { + return $this; + } + + if (is_string($body)) { + if (!str_ends_with($body, "\n")) { + $body .= "\n"; + } + $this->body = $body; + return $this; + } + + // Must be an iterable. + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + + return $this; + + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MsearchTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MsearchTemplate.php new file mode 100644 index 0000000..5ef238d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/MsearchTemplate.php @@ -0,0 +1,88 @@ +serializer = $serializer; + } + + public function getURI(): string + { + $index = $this->index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_msearch/template"; + } + return "/_msearch/template"; + } + + public function getParamWhitelist(): array + { + return [ + 'ccs_minimize_roundtrips', + 'max_concurrent_searches', + 'rest_total_hits_as_int', + 'search_type', + 'typed_keys', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody(string|iterable|null $body): static + { + if (is_null($body)) { + return $this; + } + + if (is_string($body)) { + if (!str_ends_with($body, "\n")) { + $body .= "\n"; + } + $this->body = $body; + return $this; + } + + // Must be an iterable. + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + + return $this; + + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Neural/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Neural/Stats.php new file mode 100644 index 0000000..e88b3b1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Neural/Stats.php @@ -0,0 +1,87 @@ +node_id ? rawurlencode($this->node_id) : null; + $stat = $this->stat ? rawurlencode($this->stat) : null; + if (isset($node_id) && isset($stat)) { + return "/_plugins/_neural/$node_id/stats/$stat"; + } + if (isset($node_id)) { + return "/_plugins/_neural/$node_id/stats"; + } + if (isset($stat)) { + return "/_plugins/_neural/stats/$stat"; + } + return "/_plugins/_neural/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'flat_stat_paths', + 'include_all_nodes', + 'include_individual_nodes', + 'include_info', + 'include_metadata', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (is_null($node_id)) { + return $this; + } + $this->node_id = $node_id; + + return $this; + } + + public function setStat($stat): static + { + if (!isset($stat)) { + return $this; + } + if (is_array($stat) === true) { + $stat = implode(",", $stat); + } + $this->stat = rawurlencode($stat); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/HotThreads.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/HotThreads.php new file mode 100644 index 0000000..6f8b546 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/HotThreads.php @@ -0,0 +1,76 @@ +node_id ? rawurlencode($this->node_id) : null; + if (isset($node_id)) { + return "/_nodes/$node_id/hot_threads"; + } + return "/_nodes/hot_threads"; + } + + public function getParamWhitelist(): array + { + return [ + 'ignore_idle_threads', + 'interval', + 'snapshots', + 'threads', + 'timeout', + 'type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Info.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Info.php new file mode 100644 index 0000000..2642523 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Info.php @@ -0,0 +1,108 @@ +node_id_or_metric ? rawurlencode($this->node_id_or_metric) : null; + $metric = $this->metric ? rawurlencode($this->metric) : null; + $node_id = $this->node_id ? rawurlencode($this->node_id) : null; + if (isset($node_id_or_metric)) { + return "/_nodes/$node_id_or_metric"; + } + if (isset($node_id) && isset($metric)) { + return "/_nodes/$node_id/$metric"; + } + if (isset($node_id)) { + return "/_nodes/$node_id"; + } + if (isset($metric)) { + return "/_nodes/$metric"; + } + return "/_nodes"; + } + + public function getParamWhitelist(): array + { + return [ + 'flat_settings', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeIdOrMetric($node_id_or_metric): static + { + if (is_null($node_id_or_metric)) { + return $this; + } + $this->node_id_or_metric = $node_id_or_metric; + + return $this; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php new file mode 100644 index 0000000..a9f8ba6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php @@ -0,0 +1,81 @@ +node_id ? rawurlencode($this->node_id) : null; + if (isset($node_id)) { + return "/_nodes/$node_id/reload_secure_settings"; + } + return "/_nodes/reload_secure_settings"; + } + + public function getParamWhitelist(): array + { + return [ + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Stats.php new file mode 100644 index 0000000..a540a4f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Stats.php @@ -0,0 +1,120 @@ +node_id ? rawurlencode($this->node_id) : null; + $metric = $this->metric ? rawurlencode($this->metric) : null; + $index_metric = $this->index_metric ? rawurlencode($this->index_metric) : null; + if (isset($node_id) && isset($metric) && isset($index_metric)) { + return "/_nodes/$node_id/stats/$metric/$index_metric"; + } + if (isset($metric) && isset($index_metric)) { + return "/_nodes/stats/$metric/$index_metric"; + } + if (isset($node_id) && isset($metric)) { + return "/_nodes/$node_id/stats/$metric"; + } + if (isset($node_id)) { + return "/_nodes/$node_id/stats"; + } + if (isset($metric)) { + return "/_nodes/stats/$metric"; + } + return "/_nodes/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'completion_fields', + 'fielddata_fields', + 'fields', + 'groups', + 'include_segment_file_sizes', + 'level', + 'timeout', + 'types', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } + + public function setIndexMetric($index_metric): static + { + if (!isset($index_metric)) { + return $this; + } + if (is_array($index_metric) === true) { + $index_metric = implode(",", $index_metric); + } + $this->index_metric = rawurlencode($index_metric); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Usage.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Usage.php new file mode 100644 index 0000000..65f664a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Nodes/Usage.php @@ -0,0 +1,92 @@ +node_id ? rawurlencode($this->node_id) : null; + $metric = $this->metric ? rawurlencode($this->metric) : null; + if (isset($node_id) && isset($metric)) { + return "/_nodes/$node_id/usage/$metric"; + } + if (isset($node_id)) { + return "/_nodes/$node_id/usage"; + } + if (isset($metric)) { + return "/_nodes/usage/$metric"; + } + return "/_nodes/usage"; + } + + public function getParamWhitelist(): array + { + return [ + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (!isset($node_id)) { + return $this; + } + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); + } + $this->node_id = rawurlencode($node_id); + + return $this; + } + + public function setMetric($metric): static + { + if (!isset($metric)) { + return $this; + } + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + $this->metric = rawurlencode($metric); + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/CreateConfig.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/CreateConfig.php new file mode 100644 index 0000000..d1a8797 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/CreateConfig.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfig.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfig.php new file mode 100644 index 0000000..a664901 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfig.php @@ -0,0 +1,62 @@ +config_id ? rawurlencode($this->config_id) : null; + if (isset($config_id)) { + return "/_plugins/_notifications/configs/$config_id"; + } + throw new RuntimeException('Missing parameter for the endpoint notifications.delete_config'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setConfigId($config_id): static + { + if (is_null($config_id)) { + return $this; + } + $this->config_id = $config_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfigs.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfigs.php new file mode 100644 index 0000000..5227e2d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/DeleteConfigs.php @@ -0,0 +1,47 @@ +config_id ? rawurlencode($this->config_id) : null; + if (isset($config_id)) { + return "/_plugins/_notifications/configs/$config_id"; + } + throw new RuntimeException('Missing parameter for the endpoint notifications.get_config'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setConfigId($config_id): static + { + if (is_null($config_id)) { + return $this; + } + $this->config_id = $config_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/GetConfigs.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/GetConfigs.php new file mode 100644 index 0000000..5c02105 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/GetConfigs.php @@ -0,0 +1,95 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/ListChannels.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/ListChannels.php new file mode 100644 index 0000000..f0d9864 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/ListChannels.php @@ -0,0 +1,45 @@ +config_id ? rawurlencode($this->config_id) : null; + if (isset($config_id)) { + return "/_plugins/_notifications/feature/test/$config_id"; + } + throw new RuntimeException('Missing parameter for the endpoint notifications.send_test'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setConfigId($config_id): static + { + if (is_null($config_id)) { + return $this; + } + $this->config_id = $config_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/UpdateConfig.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/UpdateConfig.php new file mode 100644 index 0000000..9eb5763 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Notifications/UpdateConfig.php @@ -0,0 +1,72 @@ +config_id ? rawurlencode($this->config_id) : null; + if (isset($config_id)) { + return "/_plugins/_notifications/configs/$config_id"; + } + throw new RuntimeException('Missing parameter for the endpoint notifications.update_config'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setConfigId($config_id): static + { + if (is_null($config_id)) { + return $this; + } + $this->config_id = $config_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/CreateObject.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/CreateObject.php new file mode 100644 index 0000000..7002add --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/CreateObject.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObject.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObject.php new file mode 100644 index 0000000..48c0b6a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObject.php @@ -0,0 +1,62 @@ +object_id ? rawurlencode($this->object_id) : null; + if (isset($object_id)) { + return "/_plugins/_observability/object/$object_id"; + } + throw new RuntimeException('Missing parameter for the endpoint observability.delete_object'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setObjectId($object_id): static + { + if (is_null($object_id)) { + return $this; + } + $this->object_id = $object_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObjects.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObjects.php new file mode 100644 index 0000000..e7501ed --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/DeleteObjects.php @@ -0,0 +1,47 @@ +object_id ? rawurlencode($this->object_id) : null; + if (isset($object_id)) { + return "/_plugins/_observability/object/$object_id"; + } + throw new RuntimeException('Missing parameter for the endpoint observability.get_object'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setObjectId($object_id): static + { + if (is_null($object_id)) { + return $this; + } + $this->object_id = $object_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/ListObjects.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/ListObjects.php new file mode 100644 index 0000000..20e10f5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Observability/ListObjects.php @@ -0,0 +1,45 @@ +object_id ? rawurlencode($this->object_id) : null; + if (isset($object_id)) { + return "/_plugins/_observability/object/$object_id"; + } + throw new RuntimeException('Missing parameter for the endpoint observability.update_object'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setObjectId($object_id): static + { + if (is_null($object_id)) { + return $this; + } + $this->object_id = $object_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ping.php new file mode 100644 index 0000000..bc55c56 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ping.php @@ -0,0 +1,49 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/GetStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/GetStats.php new file mode 100644 index 0000000..9c121b9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/GetStats.php @@ -0,0 +1,47 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/Query.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/Query.php new file mode 100644 index 0000000..f67cd56 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ppl/Query.php @@ -0,0 +1,57 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/PutScript.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/PutScript.php new file mode 100644 index 0000000..a9260b2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/PutScript.php @@ -0,0 +1,90 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for put_script'); + } + $id = rawurlencode($this->id); + $context = $this->context ? rawurlencode($this->context) : null; + if (isset($context)) { + return "/_scripts/$id/$context"; + } + return "/_scripts/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'context', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setContext($context): static + { + if (is_null($context)) { + return $this; + } + $this->context = $context; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceDelete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceDelete.php new file mode 100644 index 0000000..cf7ff11 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceDelete.php @@ -0,0 +1,62 @@ +datasource_name ? rawurlencode($this->datasource_name) : null; + if (isset($datasource_name)) { + return "/_plugins/_query/_datasources/$datasource_name"; + } + throw new RuntimeException('Missing parameter for the endpoint query.datasource_delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setDatasourceName($datasource_name): static + { + if (is_null($datasource_name)) { + return $this; + } + $this->datasource_name = $datasource_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceRetrieve.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceRetrieve.php new file mode 100644 index 0000000..513df0c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourceRetrieve.php @@ -0,0 +1,62 @@ +datasource_name ? rawurlencode($this->datasource_name) : null; + if (isset($datasource_name)) { + return "/_plugins/_query/_datasources/$datasource_name"; + } + throw new RuntimeException('Missing parameter for the endpoint query.datasource_retrieve'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setDatasourceName($datasource_name): static + { + if (is_null($datasource_name)) { + return $this; + } + $this->datasource_name = $datasource_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesCreate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesCreate.php new file mode 100644 index 0000000..ba2d457 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesCreate.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesList.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesList.php new file mode 100644 index 0000000..16f5752 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Query/DatasourcesList.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RankEval.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RankEval.php new file mode 100644 index 0000000..efe46fc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RankEval.php @@ -0,0 +1,67 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_rank_eval"; + } + return "/_rank_eval"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'search_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Reindex.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Reindex.php new file mode 100644 index 0000000..87385e9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Reindex.php @@ -0,0 +1,68 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ReindexRethrottle.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ReindexRethrottle.php new file mode 100644 index 0000000..c6d5fc5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ReindexRethrottle.php @@ -0,0 +1,69 @@ +task_id) || $this->task_id === '') { + throw new RuntimeException('task_id is required for reindex_rethrottle'); + } + $task_id = rawurlencode($this->task_id); + + return "/_reindex/$task_id/_rethrottle"; + } + + public function getParamWhitelist(): array + { + return [ + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RemoteStore/Restore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RemoteStore/Restore.php new file mode 100644 index 0000000..36c240c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RemoteStore/Restore.php @@ -0,0 +1,57 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RenderSearchTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RenderSearchTemplate.php new file mode 100644 index 0000000..4cb4c50 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/RenderSearchTemplate.php @@ -0,0 +1,63 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_render/template/$id"; + } + return "/_render/template"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/AutofollowStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/AutofollowStats.php new file mode 100644 index 0000000..26d842d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/AutofollowStats.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/DeleteReplicationRule.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/DeleteReplicationRule.php new file mode 100644 index 0000000..29f2507 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/DeleteReplicationRule.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/FollowerStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/FollowerStats.php new file mode 100644 index 0000000..34299dc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/FollowerStats.php @@ -0,0 +1,45 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_pause"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.pause'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Resume.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Resume.php new file mode 100644 index 0000000..b90e3e4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Resume.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_resume"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.resume'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Start.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Start.php new file mode 100644 index 0000000..73df580 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Start.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_start"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.start'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Status.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Status.php new file mode 100644 index 0000000..084aece --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Status.php @@ -0,0 +1,50 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_status"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.status'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Stop.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Stop.php new file mode 100644 index 0000000..dfb60a2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/Stop.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_stop"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.stop'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/UpdateSettings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/UpdateSettings.php new file mode 100644 index 0000000..3f9759a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Replication/UpdateSettings.php @@ -0,0 +1,60 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/_plugins/_replication/$index/_update"; + } + throw new RuntimeException('Missing parameter for the endpoint replication.update_settings'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Delete.php new file mode 100644 index 0000000..c1672c7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Delete.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for delete'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Explain.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Explain.php new file mode 100644 index 0000000..785b11d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Explain.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for explain'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id/_explain"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Get.php new file mode 100644 index 0000000..2eb6a96 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Get.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for get'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Put.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Put.php new file mode 100644 index 0000000..f939272 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Put.php @@ -0,0 +1,63 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for put'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id"; + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Start.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Start.php new file mode 100644 index 0000000..5633b13 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Start.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for start'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id/_start"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Stop.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Stop.php new file mode 100644 index 0000000..fd41329 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Rollups/Stop.php @@ -0,0 +1,51 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for stop'); + } + $id = rawurlencode($this->id); + + return "/_plugins/_rollup/jobs/$id/_stop"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php new file mode 100644 index 0000000..c87b508 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php @@ -0,0 +1,59 @@ +body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Scroll.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Scroll.php new file mode 100644 index 0000000..68f6709 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Scroll.php @@ -0,0 +1,82 @@ +scroll_id ? rawurlencode($this->scroll_id) : null; + if (isset($scroll_id)) { + @trigger_error('A scroll id can be quite large and should be specified as part of the body', E_USER_DEPRECATED); + } + + if (isset($scroll_id)) { + return "/_search/scroll/$scroll_id"; + } + return "/_search/scroll"; + } + + public function getParamWhitelist(): array + { + return [ + 'rest_total_hits_as_int', + 'scroll', + 'scroll_id', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setScrollId($scroll_id): static + { + if (is_null($scroll_id)) { + return $this; + } + $this->scroll_id = $scroll_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Search.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Search.php new file mode 100644 index 0000000..449b297 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Search.php @@ -0,0 +1,111 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_search"; + } + return "/_search"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'allow_no_indices', + 'allow_partial_search_results', + 'analyze_wildcard', + 'analyzer', + 'batched_reduce_size', + 'cancel_after_time_interval', + 'ccs_minimize_roundtrips', + 'default_operator', + 'df', + 'docvalue_fields', + 'expand_wildcards', + 'explain', + 'from', + 'ignore_throttled', + 'ignore_unavailable', + 'include_named_queries_score', + 'index', + 'lenient', + 'max_concurrent_shard_requests', + 'phase_took', + 'pre_filter_shard_size', + 'preference', + 'q', + 'request_cache', + 'rest_total_hits_as_int', + 'routing', + 'scroll', + 'search_pipeline', + 'search_type', + 'seq_no_primary_term', + 'size', + 'sort', + 'stats', + 'stored_fields', + 'suggest_field', + 'suggest_mode', + 'suggest_size', + 'suggest_text', + 'terminate_after', + 'timeout', + 'track_scores', + 'track_total_hits', + 'typed_keys', + 'verbose_pipeline', + 'version', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Delete.php new file mode 100644 index 0000000..d0ba590 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Delete.php @@ -0,0 +1,52 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_search/pipeline/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_pipeline.delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Get.php new file mode 100644 index 0000000..37a1616 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Get.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_search/pipeline/$id"; + } + return "/_search/pipeline"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Put.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Put.php new file mode 100644 index 0000000..2dbad23 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchPipeline/Put.php @@ -0,0 +1,62 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_search/pipeline/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_pipeline.put'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteExperiments.php new file mode 100644 index 0000000..df73376 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteExperiments.php @@ -0,0 +1,62 @@ +experiment_id ? rawurlencode($this->experiment_id) : null; + if (isset($experiment_id)) { + return "/_plugins/_search_relevance/experiments/$experiment_id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_relevance.delete_experiments'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setExperimentId($experiment_id): static + { + if (is_null($experiment_id)) { + return $this; + } + $this->experiment_id = $experiment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteJudgments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteJudgments.php new file mode 100644 index 0000000..7dd0383 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteJudgments.php @@ -0,0 +1,62 @@ +judgment_id ? rawurlencode($this->judgment_id) : null; + if (isset($judgment_id)) { + return "/_plugins/_search_relevance/judgments/$judgment_id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_relevance.delete_judgments'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setJudgmentId($judgment_id): static + { + if (is_null($judgment_id)) { + return $this; + } + $this->judgment_id = $judgment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteQuerySets.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteQuerySets.php new file mode 100644 index 0000000..a9d7940 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteQuerySets.php @@ -0,0 +1,62 @@ +query_set_id ? rawurlencode($this->query_set_id) : null; + if (isset($query_set_id)) { + return "/_plugins/_search_relevance/query_sets/$query_set_id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_relevance.delete_query_sets'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setQuerySetId($query_set_id): static + { + if (is_null($query_set_id)) { + return $this; + } + $this->query_set_id = $query_set_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteScheduledExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteScheduledExperiments.php new file mode 100644 index 0000000..14d2e8f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteScheduledExperiments.php @@ -0,0 +1,62 @@ +experiment_id ? rawurlencode($this->experiment_id) : null; + if (isset($experiment_id)) { + return "/_plugins/_search_relevance/experiments/schedule/$experiment_id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_relevance.delete_scheduled_experiments'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setExperimentId($experiment_id): static + { + if (is_null($experiment_id)) { + return $this; + } + $this->experiment_id = $experiment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteSearchConfigurations.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteSearchConfigurations.php new file mode 100644 index 0000000..790e26e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/DeleteSearchConfigurations.php @@ -0,0 +1,62 @@ +search_configuration_id ? rawurlencode($this->search_configuration_id) : null; + if (isset($search_configuration_id)) { + return "/_plugins/_search_relevance/search_configurations/$search_configuration_id"; + } + throw new RuntimeException('Missing parameter for the endpoint search_relevance.delete_search_configurations'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setSearchConfigurationId($search_configuration_id): static + { + if (is_null($search_configuration_id)) { + return $this; + } + $this->search_configuration_id = $search_configuration_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetExperiments.php new file mode 100644 index 0000000..8d73a68 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetExperiments.php @@ -0,0 +1,61 @@ +experiment_id ? rawurlencode($this->experiment_id) : null; + if (isset($experiment_id)) { + return "/_plugins/_search_relevance/experiments/$experiment_id"; + } + return "/_plugins/_search_relevance/experiments"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setExperimentId($experiment_id): static + { + if (is_null($experiment_id)) { + return $this; + } + $this->experiment_id = $experiment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetJudgments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetJudgments.php new file mode 100644 index 0000000..a6bdeaf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetJudgments.php @@ -0,0 +1,61 @@ +judgment_id ? rawurlencode($this->judgment_id) : null; + if (isset($judgment_id)) { + return "/_plugins/_search_relevance/judgments/$judgment_id"; + } + return "/_plugins/_search_relevance/judgments"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setJudgmentId($judgment_id): static + { + if (is_null($judgment_id)) { + return $this; + } + $this->judgment_id = $judgment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetNodeStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetNodeStats.php new file mode 100644 index 0000000..373c45a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetNodeStats.php @@ -0,0 +1,82 @@ +node_id) || $this->node_id === '') { + throw new RuntimeException('node_id is required for get_node_stats'); + } + $node_id = rawurlencode($this->node_id); + $stat = $this->stat ? rawurlencode($this->stat) : null; + if (isset($stat)) { + return "/_plugins/_search_relevance/$node_id/stats/$stat"; + } + return "/_plugins/_search_relevance/$node_id/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'flat_stat_paths', + 'include_all_nodes', + 'include_individual_nodes', + 'include_info', + 'include_metadata', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (is_null($node_id)) { + return $this; + } + $this->node_id = $node_id; + + return $this; + } + + public function setStat($stat): static + { + if (is_null($stat)) { + return $this; + } + $this->stat = $stat; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetQuerySets.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetQuerySets.php new file mode 100644 index 0000000..77cbd8e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetQuerySets.php @@ -0,0 +1,61 @@ +query_set_id ? rawurlencode($this->query_set_id) : null; + if (isset($query_set_id)) { + return "/_plugins/_search_relevance/query_sets/$query_set_id"; + } + return "/_plugins/_search_relevance/query_sets"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setQuerySetId($query_set_id): static + { + if (is_null($query_set_id)) { + return $this; + } + $this->query_set_id = $query_set_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetScheduledExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetScheduledExperiments.php new file mode 100644 index 0000000..5e142c5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetScheduledExperiments.php @@ -0,0 +1,61 @@ +experiment_id ? rawurlencode($this->experiment_id) : null; + if (isset($experiment_id)) { + return "/_plugins/_search_relevance/experiments/schedule/$experiment_id"; + } + return "/_plugins/_search_relevance/experiments/schedule"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setExperimentId($experiment_id): static + { + if (is_null($experiment_id)) { + return $this; + } + $this->experiment_id = $experiment_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetSearchConfigurations.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetSearchConfigurations.php new file mode 100644 index 0000000..fbbdc0c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetSearchConfigurations.php @@ -0,0 +1,61 @@ +search_configuration_id ? rawurlencode($this->search_configuration_id) : null; + if (isset($search_configuration_id)) { + return "/_plugins/_search_relevance/search_configurations/$search_configuration_id"; + } + return "/_plugins/_search_relevance/search_configurations"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setSearchConfigurationId($search_configuration_id): static + { + if (is_null($search_configuration_id)) { + return $this; + } + $this->search_configuration_id = $search_configuration_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetStats.php new file mode 100644 index 0000000..563337d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/GetStats.php @@ -0,0 +1,66 @@ +stat ? rawurlencode($this->stat) : null; + if (isset($stat)) { + return "/_plugins/_search_relevance/stats/$stat"; + } + return "/_plugins/_search_relevance/stats"; + } + + public function getParamWhitelist(): array + { + return [ + 'flat_stat_paths', + 'include_all_nodes', + 'include_individual_nodes', + 'include_info', + 'include_metadata', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setStat($stat): static + { + if (is_null($stat)) { + return $this; + } + $this->stat = $stat; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostQuerySets.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostQuerySets.php new file mode 100644 index 0000000..cd658bf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostQuerySets.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostScheduledExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostScheduledExperiments.php new file mode 100644 index 0000000..b3b6b8f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PostScheduledExperiments.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutExperiments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutExperiments.php new file mode 100644 index 0000000..dcf33fe --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutExperiments.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutJudgments.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutJudgments.php new file mode 100644 index 0000000..77cc7f0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutJudgments.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutQuerySets.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutQuerySets.php new file mode 100644 index 0000000..3203903 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutQuerySets.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutSearchConfigurations.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutSearchConfigurations.php new file mode 100644 index 0000000..81d5cfa --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchRelevance/PutSearchConfigurations.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchShards.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchShards.php new file mode 100644 index 0000000..7bc56e4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchShards.php @@ -0,0 +1,69 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_search_shards"; + } + return "/_search_shards"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable', + 'local', + 'preference', + 'routing', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchTemplate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchTemplate.php new file mode 100644 index 0000000..b056add --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchTemplate.php @@ -0,0 +1,78 @@ +index ? rawurlencode($this->index) : null; + if (isset($index)) { + return "/$index/_search/template"; + } + return "/_search/template"; + } + + public function getParamWhitelist(): array + { + return [ + 'allow_no_indices', + 'ccs_minimize_roundtrips', + 'expand_wildcards', + 'explain', + 'ignore_throttled', + 'ignore_unavailable', + 'phase_took', + 'preference', + 'profile', + 'rest_total_hits_as_int', + 'routing', + 'scroll', + 'search_pipeline', + 'search_type', + 'typed_keys', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/ClearCache.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/ClearCache.php new file mode 100644 index 0000000..3933363 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/ClearCache.php @@ -0,0 +1,52 @@ +index ?? null; + + if (isset($index)) { + return "/$index/_searchable_snapshots/cache/clear"; + } + return "/_searchable_snapshots/cache/clear"; + } + + public function getParamWhitelist(): array + { + return [ + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'index' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Mount.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Mount.php new file mode 100644 index 0000000..953b596 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Mount.php @@ -0,0 +1,90 @@ +repository ?? null; + $snapshot = $this->snapshot ?? null; + + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot/_mount"; + } + throw new RuntimeException('Missing parameter for the endpoint searchable_snapshots.mount'); + } + + public function getParamWhitelist(): array + { + return [ + 'master_timeout', + 'wait_for_completion', + 'cluster_manager_timeout' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRepository($repository): static + { + if (isset($repository) !== true) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (isset($snapshot) !== true) { + return $this; + } + $this->snapshot = $snapshot; + + return $this; + } + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/RepositoryStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/RepositoryStats.php new file mode 100644 index 0000000..ec31d66 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/RepositoryStats.php @@ -0,0 +1,60 @@ +repository ?? null; + + if (isset($repository)) { + return "/_snapshot/$repository/_stats"; + } + throw new RuntimeException('Missing parameter for the endpoint searchable_snapshots.repository_stats'); + } + + public function getParamWhitelist(): array + { + return []; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRepository($repository): RepositoryStats + { + if (isset($repository) !== true) { + return $this; + } + $this->repository = $repository; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Stats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Stats.php new file mode 100644 index 0000000..822b117 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/SearchableSnapshots/Stats.php @@ -0,0 +1,47 @@ +index ?? null; + + if (isset($index)) { + return "/$index/_searchable_snapshots/stats"; + } + return "/_searchable_snapshots/stats"; + } + + public function getParamWhitelist(): array + { + return []; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Authinfo.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Authinfo.php new file mode 100644 index 0000000..617b53c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Authinfo.php @@ -0,0 +1,47 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php new file mode 100644 index 0000000..217d997 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateActionGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateActionGroup.php new file mode 100644 index 0000000..77b2162 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateActionGroup.php @@ -0,0 +1,73 @@ +action_group) || $this->action_group === '') { + throw new RuntimeException('action_group is required for create_action_group'); + } + $action_group = rawurlencode($this->action_group); + + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setActionGroup($action_group): static + { + if (is_null($action_group)) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateAllowlist.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateAllowlist.php new file mode 100644 index 0000000..c938f12 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateAllowlist.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRole.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRole.php new file mode 100644 index 0000000..d1e5143 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRole.php @@ -0,0 +1,73 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for create_role'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php new file mode 100644 index 0000000..6005088 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php @@ -0,0 +1,73 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for create_role_mapping'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateTenant.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateTenant.php new file mode 100644 index 0000000..1b44c7f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateTenant.php @@ -0,0 +1,73 @@ +tenant) || $this->tenant === '') { + throw new RuntimeException('tenant is required for create_tenant'); + } + $tenant = rawurlencode($this->tenant); + + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTenant($tenant): static + { + if (is_null($tenant)) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php new file mode 100644 index 0000000..7989d2b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUser.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUser.php new file mode 100644 index 0000000..48e3db7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUser.php @@ -0,0 +1,73 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for create_user'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php new file mode 100644 index 0000000..0bd0b6b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php @@ -0,0 +1,73 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for create_user_legacy'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php new file mode 100644 index 0000000..e73d672 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php @@ -0,0 +1,63 @@ +action_group) || $this->action_group === '') { + throw new RuntimeException('action_group is required for delete_action_group'); + } + $action_group = rawurlencode($this->action_group); + + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setActionGroup($action_group): static + { + if (is_null($action_group)) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php new file mode 100644 index 0000000..7afcc1d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php @@ -0,0 +1,63 @@ +cluster_name) || $this->cluster_name === '') { + throw new RuntimeException('cluster_name is required for delete_distinguished_name'); + } + $cluster_name = rawurlencode($this->cluster_name); + + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setClusterName($cluster_name): static + { + if (is_null($cluster_name)) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRole.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRole.php new file mode 100644 index 0000000..557d368 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRole.php @@ -0,0 +1,63 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for delete_role'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php new file mode 100644 index 0000000..240eb7c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php @@ -0,0 +1,63 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for delete_role_mapping'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteTenant.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteTenant.php new file mode 100644 index 0000000..9087365 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteTenant.php @@ -0,0 +1,63 @@ +tenant) || $this->tenant === '') { + throw new RuntimeException('tenant is required for delete_tenant'); + } + $tenant = rawurlencode($this->tenant); + + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setTenant($tenant): static + { + if (is_null($tenant)) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUser.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUser.php new file mode 100644 index 0000000..398ffd2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUser.php @@ -0,0 +1,63 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for delete_user'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php new file mode 100644 index 0000000..093e03c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php @@ -0,0 +1,63 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for delete_user_legacy'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/FlushCache.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/FlushCache.php new file mode 100644 index 0000000..b1ad570 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/FlushCache.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserToken.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserToken.php new file mode 100644 index 0000000..cc1ca56 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserToken.php @@ -0,0 +1,63 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for generate_user_token'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/internalusers/$username/authtoken"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php new file mode 100644 index 0000000..da35d87 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php @@ -0,0 +1,63 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for generate_user_token_legacy'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/user/$username/authtoken"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetAccountDetails.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetAccountDetails.php new file mode 100644 index 0000000..4deb6f1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetAccountDetails.php @@ -0,0 +1,45 @@ +action_group) || $this->action_group === '') { + throw new RuntimeException('action_group is required for get_action_group'); + } + $action_group = rawurlencode($this->action_group); + + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setActionGroup($action_group): static + { + if (is_null($action_group)) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetActionGroups.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetActionGroups.php new file mode 100644 index 0000000..9249fc6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetActionGroups.php @@ -0,0 +1,45 @@ +cluster_name) || $this->cluster_name === '') { + throw new RuntimeException('cluster_name is required for get_distinguished_name'); + } + $cluster_name = rawurlencode($this->cluster_name); + + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'show_all', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setClusterName($cluster_name): static + { + if (is_null($cluster_name)) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php new file mode 100644 index 0000000..1ce8358 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php @@ -0,0 +1,46 @@ +node_id ? rawurlencode($this->node_id) : null; + if (isset($node_id)) { + return "/_plugins/_security/api/certificates/$node_id"; + } + throw new RuntimeException('Missing parameter for the endpoint security.get_node_certificates'); + } + + public function getParamWhitelist(): array + { + return [ + 'cert_type', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setNodeId($node_id): static + { + if (is_null($node_id)) { + return $this; + } + $this->node_id = $node_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php new file mode 100644 index 0000000..3be1a3b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php @@ -0,0 +1,45 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for get_role'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMapping.php new file mode 100644 index 0000000..a369bbb --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMapping.php @@ -0,0 +1,63 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for get_role_mapping'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMappings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMappings.php new file mode 100644 index 0000000..82ebfbf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetRoleMappings.php @@ -0,0 +1,45 @@ +tenant) || $this->tenant === '') { + throw new RuntimeException('tenant is required for get_tenant'); + } + $tenant = rawurlencode($this->tenant); + + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setTenant($tenant): static + { + if (is_null($tenant)) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetTenants.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetTenants.php new file mode 100644 index 0000000..f7c9daf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetTenants.php @@ -0,0 +1,45 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for get_user'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUserLegacy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUserLegacy.php new file mode 100644 index 0000000..fe1664e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUserLegacy.php @@ -0,0 +1,63 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for get_user_legacy'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUsers.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUsers.php new file mode 100644 index 0000000..abd54cf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/GetUsers.php @@ -0,0 +1,45 @@ +action_group) || $this->action_group === '') { + throw new RuntimeException('action_group is required for patch_action_group'); + } + $action_group = rawurlencode($this->action_group); + + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setActionGroup($action_group): static + { + if (is_null($action_group)) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchActionGroups.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchActionGroups.php new file mode 100644 index 0000000..6bdd042 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchActionGroups.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAllowlist.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAllowlist.php new file mode 100644 index 0000000..0499aba --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAllowlist.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php new file mode 100644 index 0000000..804ca28 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchConfiguration.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchConfiguration.php new file mode 100644 index 0000000..48c38cc --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php new file mode 100644 index 0000000..de7d658 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php @@ -0,0 +1,73 @@ +cluster_name) || $this->cluster_name === '') { + throw new RuntimeException('cluster_name is required for patch_distinguished_name'); + } + $cluster_name = rawurlencode($this->cluster_name); + + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setClusterName($cluster_name): static + { + if (is_null($cluster_name)) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php new file mode 100644 index 0000000..3f4de03 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRole.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRole.php new file mode 100644 index 0000000..1ffe302 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRole.php @@ -0,0 +1,73 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for patch_role'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php new file mode 100644 index 0000000..9e34a39 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php @@ -0,0 +1,73 @@ +role) || $this->role === '') { + throw new RuntimeException('role is required for patch_role_mapping'); + } + $role = rawurlencode($this->role); + + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): static + { + if (is_null($role)) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php new file mode 100644 index 0000000..33efe6c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoles.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoles.php new file mode 100644 index 0000000..faedd90 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchRoles.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenant.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenant.php new file mode 100644 index 0000000..dfd5526 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenant.php @@ -0,0 +1,73 @@ +tenant) || $this->tenant === '') { + throw new RuntimeException('tenant is required for patch_tenant'); + } + $tenant = rawurlencode($this->tenant); + + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTenant($tenant): static + { + if (is_null($tenant)) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenants.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenants.php new file mode 100644 index 0000000..05e931a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchTenants.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUser.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUser.php new file mode 100644 index 0000000..9a7427e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUser.php @@ -0,0 +1,73 @@ +username) || $this->username === '') { + throw new RuntimeException('username is required for patch_user'); + } + $username = rawurlencode($this->username); + + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setUsername($username): static + { + if (is_null($username)) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUsers.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUsers.php new file mode 100644 index 0000000..6a5ba80 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PatchUsers.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php new file mode 100644 index 0000000..87fff40 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php new file mode 100644 index 0000000..9b5192d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php new file mode 100644 index 0000000..a2ca3ed --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php @@ -0,0 +1,73 @@ +cluster_name) || $this->cluster_name === '') { + throw new RuntimeException('cluster_name is required for update_distinguished_name'); + } + $cluster_name = rawurlencode($this->cluster_name); + + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setClusterName($cluster_name): static + { + if (is_null($cluster_name)) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Validate.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Validate.php new file mode 100644 index 0000000..753af33 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Security/Validate.php @@ -0,0 +1,46 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.create_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/DeletePolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/DeletePolicy.php new file mode 100644 index 0000000..3196a37 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/DeletePolicy.php @@ -0,0 +1,62 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.delete_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/ExplainPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/ExplainPolicy.php new file mode 100644 index 0000000..ba041bb --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/ExplainPolicy.php @@ -0,0 +1,62 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name/_explain"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.explain_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/GetPolicies.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/GetPolicies.php new file mode 100644 index 0000000..2c27849 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/GetPolicies.php @@ -0,0 +1,50 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.get_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StartPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StartPolicy.php new file mode 100644 index 0000000..fac577b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StartPolicy.php @@ -0,0 +1,62 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name/_start"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.start_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StopPolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StopPolicy.php new file mode 100644 index 0000000..9c2a312 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/StopPolicy.php @@ -0,0 +1,62 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name/_stop"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.stop_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/UpdatePolicy.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/UpdatePolicy.php new file mode 100644 index 0000000..06172ab --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sm/UpdatePolicy.php @@ -0,0 +1,74 @@ +policy_name ? rawurlencode($this->policy_name) : null; + if (isset($policy_name)) { + return "/_plugins/_sm/policies/$policy_name"; + } + throw new RuntimeException('Missing parameter for the endpoint sm.update_policy'); + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setPolicyName($policy_name): static + { + if (is_null($policy_name)) { + return $this; + } + $this->policy_name = $policy_name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php new file mode 100644 index 0000000..c095e0a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php @@ -0,0 +1,76 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_snapshot/$repository/_cleanup"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.cleanup_repository'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php new file mode 100644 index 0000000..c741779 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php @@ -0,0 +1,109 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + $target_snapshot = $this->target_snapshot ? rawurlencode($this->target_snapshot) : null; + if (isset($repository) && isset($snapshot) && isset($target_snapshot)) { + return "/_snapshot/$repository/$snapshot/_clone/$target_snapshot"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.clone'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (is_null($snapshot)) { + return $this; + } + $this->snapshot = $snapshot; + + return $this; + } + + public function setTargetSnapshot($target_snapshot): static + { + if (is_null($target_snapshot)) { + return $this; + } + $this->target_snapshot = $target_snapshot; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Create.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Create.php new file mode 100644 index 0000000..e9ff71d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Create.php @@ -0,0 +1,98 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.create'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (is_null($snapshot)) { + return $this; + } + $this->snapshot = $snapshot; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php new file mode 100644 index 0000000..821c301 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php @@ -0,0 +1,87 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_snapshot/$repository"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.create_repository'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'verify', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Delete.php new file mode 100644 index 0000000..5a9260b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Delete.php @@ -0,0 +1,87 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (is_null($snapshot)) { + return $this; + } + $this->snapshot = $snapshot; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php new file mode 100644 index 0000000..27cf8cf --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php @@ -0,0 +1,79 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_snapshot/$repository"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.delete_repository'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setRepository($repository): static + { + if (!isset($repository)) { + return $this; + } + if (is_array($repository) === true) { + $repository = implode(",", $repository); + } + $this->repository = rawurlencode($repository); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Get.php new file mode 100644 index 0000000..ce10ba4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Get.php @@ -0,0 +1,92 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'ignore_unavailable', + 'master_timeout', + 'verbose', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (!isset($snapshot)) { + return $this; + } + if (is_array($snapshot) === true) { + $snapshot = implode(",", $snapshot); + } + $this->snapshot = rawurlencode($snapshot); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/GetRepository.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/GetRepository.php new file mode 100644 index 0000000..a7f3dc8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/GetRepository.php @@ -0,0 +1,78 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_snapshot/$repository"; + } + return "/_snapshot"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'local', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRepository($repository): static + { + if (!isset($repository)) { + return $this; + } + if (is_array($repository) === true) { + $repository = implode(",", $repository); + } + $this->repository = rawurlencode($repository); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Restore.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Restore.php new file mode 100644 index 0000000..d3a35f1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Restore.php @@ -0,0 +1,98 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot/_restore"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.restore'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (is_null($snapshot)) { + return $this; + } + $this->snapshot = $snapshot; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Status.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Status.php new file mode 100644 index 0000000..3ac3a79 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/Status.php @@ -0,0 +1,93 @@ +repository ? rawurlencode($this->repository) : null; + $snapshot = $this->snapshot ? rawurlencode($this->snapshot) : null; + if (isset($repository) && isset($snapshot)) { + return "/_snapshot/$repository/$snapshot/_status"; + } + if (isset($repository)) { + return "/_snapshot/$repository/_status"; + } + return "/_snapshot/_status"; + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'ignore_unavailable', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + public function setSnapshot($snapshot): static + { + if (!isset($snapshot)) { + return $this; + } + if (is_array($snapshot) === true) { + $snapshot = implode(",", $snapshot); + } + $this->snapshot = rawurlencode($snapshot); + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php new file mode 100644 index 0000000..66415a8 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php @@ -0,0 +1,76 @@ +repository ? rawurlencode($this->repository) : null; + if (isset($repository)) { + return "/_snapshot/$repository/_verify"; + } + throw new RuntimeException('Missing parameter for the endpoint snapshot.verify_repository'); + } + + public function getParamWhitelist(): array + { + return [ + 'cluster_manager_timeout', + 'master_timeout', + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setRepository($repository): static + { + if (is_null($repository)) { + return $this; + } + $this->repository = $repository; + + return $this; + } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Close.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Close.php new file mode 100644 index 0000000..7bf12b5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Close.php @@ -0,0 +1,57 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/CursorClose.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/CursorClose.php new file mode 100644 index 0000000..3553fb1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/CursorClose.php @@ -0,0 +1,34 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/GetStats.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/GetStats.php new file mode 100644 index 0000000..d0992fe --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/GetStats.php @@ -0,0 +1,47 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Query.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Query.php new file mode 100644 index 0000000..e4a362c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Query.php @@ -0,0 +1,57 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Settings.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Settings.php new file mode 100644 index 0000000..78fc51f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Sql/Settings.php @@ -0,0 +1,56 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ssl/Certificates.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ssl/Certificates.php new file mode 100644 index 0000000..c2c35d3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ssl/Certificates.php @@ -0,0 +1,44 @@ +task_id ? rawurlencode($this->task_id) : null; + if (isset($task_id)) { + return "/_tasks/$task_id/_cancel"; + } + return "/_tasks/_cancel"; + } + + public function getParamWhitelist(): array + { + return [ + 'actions', + 'nodes', + 'parent_task_id', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/Get.php new file mode 100644 index 0000000..aa2708e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/Get.php @@ -0,0 +1,70 @@ +task_id ? rawurlencode($this->task_id) : null; + if (isset($task_id)) { + return "/_tasks/$task_id"; + } + throw new RuntimeException('Missing parameter for the endpoint tasks.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'timeout', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/ListTasks.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/ListTasks.php new file mode 100644 index 0000000..04d9db5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Tasks/ListTasks.php @@ -0,0 +1,58 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for termvectors'); + } + $index = rawurlencode($this->index); + $id = $this->id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/$index/_termvectors/$id"; + } + return "/$index/_termvectors"; + } + + public function getParamWhitelist(): array + { + return [ + 'field_statistics', + 'fields', + 'offsets', + 'payloads', + 'positions', + 'preference', + 'realtime', + 'routing', + 'term_statistics', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return isset($this->body) ? 'POST' : 'GET'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Delete.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Delete.php new file mode 100644 index 0000000..737de53 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Delete.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.delete'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Explain.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Explain.php new file mode 100644 index 0000000..a43b767 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Explain.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id/_explain"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.explain'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Get.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Get.php new file mode 100644 index 0000000..39d60dd --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Get.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.get'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Preview.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Preview.php new file mode 100644 index 0000000..fe27bf9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Preview.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Put.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Put.php new file mode 100644 index 0000000..40a30c4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Put.php @@ -0,0 +1,62 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.put'); + } + + public function getParamWhitelist(): array + { + return [ + 'if_primary_term', + 'if_seq_no', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Search.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Search.php new file mode 100644 index 0000000..e1ee0c9 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Search.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id/_start"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.start'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Stop.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Stop.php new file mode 100644 index 0000000..a42c566 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Transforms/Stop.php @@ -0,0 +1,50 @@ +id ? rawurlencode($this->id) : null; + if (isset($id)) { + return "/_plugins/_transform/$id/_stop"; + } + throw new RuntimeException('Missing parameter for the endpoint transforms.stop'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ubi/Initialize.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ubi/Initialize.php new file mode 100644 index 0000000..79f231e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Ubi/Initialize.php @@ -0,0 +1,45 @@ +id) || $this->id === '') { + throw new RuntimeException('id is required for update'); + } + $id = rawurlencode($this->id); + if (!isset($this->index) || $this->index === '') { + throw new RuntimeException('index is required for update'); + } + $index = rawurlencode($this->index); + + return "/$index/_update/$id"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'if_primary_term', + 'if_seq_no', + 'lang', + 'refresh', + 'require_alias', + 'retry_on_conflict', + 'routing', + 'timeout', + 'wait_for_active_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQuery.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQuery.php new file mode 100644 index 0000000..d40139f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQuery.php @@ -0,0 +1,100 @@ +index) || $this->index === '') { + throw new RuntimeException('index is required for update_by_query'); + } + $index = rawurlencode($this->index); + + return "/$index/_update_by_query"; + } + + public function getParamWhitelist(): array + { + return [ + '_source', + '_source_excludes', + '_source_includes', + 'allow_no_indices', + 'analyze_wildcard', + 'analyzer', + 'conflicts', + 'default_operator', + 'df', + 'expand_wildcards', + 'from', + 'ignore_unavailable', + 'lenient', + 'max_docs', + 'pipeline', + 'preference', + 'q', + 'refresh', + 'request_cache', + 'requests_per_second', + 'routing', + 'scroll', + 'scroll_size', + 'search_timeout', + 'search_type', + 'size', + 'slices', + 'sort', + 'stats', + 'terminate_after', + 'timeout', + 'version', + 'wait_for_active_shards', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php new file mode 100644 index 0000000..5d3b377 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php @@ -0,0 +1,69 @@ +task_id) || $this->task_id === '') { + throw new RuntimeException('task_id is required for update_by_query_rethrottle'); + } + $task_id = rawurlencode($this->task_id); + + return "/_update_by_query/$task_id/_rethrottle"; + } + + public function getParamWhitelist(): array + { + return [ + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setTaskId($task_id): static + { + if (is_null($task_id)) { + return $this; + } + $this->task_id = $task_id; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php new file mode 100644 index 0000000..bb902b6 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/CreateQueryGroup.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php new file mode 100644 index 0000000..2d259ce --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/DeleteQueryGroup.php @@ -0,0 +1,62 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_wlm/query_group/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint wlm.delete_query_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php new file mode 100644 index 0000000..97139a0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/GetQueryGroup.php @@ -0,0 +1,61 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_wlm/query_group/$name"; + } + return "/_wlm/query_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php new file mode 100644 index 0000000..201c8c5 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Endpoints/Wlm/UpdateQueryGroup.php @@ -0,0 +1,72 @@ +name ? rawurlencode($this->name) : null; + if (isset($name)) { + return "/_wlm/query_group/$name"; + } + throw new RuntimeException('Missing parameter for the endpoint wlm.update_query_group'); + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): static + { + if (is_null($body)) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setName($name): static + { + if (is_null($name)) { + return $this; + } + $this->name = $name; + + return $this; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/BadMethodCallException.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/BadMethodCallException.php new file mode 100644 index 0000000..7919822 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/BadMethodCallException.php @@ -0,0 +1,16 @@ +statusCode; + } + + public function getHeaders(): array + { + return $this->headers; + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionFactory.php new file mode 100644 index 0000000..1c9c06c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionFactory.php @@ -0,0 +1,69 @@ + self::createBadRequestException($errorMessage, $previous, $code, $headers), + 401 => new UnauthorizedHttpException($errorMessage, $headers, $code, $previous), + 403 => new ForbiddenHttpException($errorMessage, $headers, $code, $previous), + 404 => new NotFoundHttpException($errorMessage, $headers, $code, $previous), + 406 => new NotAcceptableHttpException($errorMessage, $headers, $code, $previous), + 409 => new ConflictHttpException($errorMessage, $headers, $code, $previous), + 429 => new TooManyRequestsHttpException($errorMessage, $headers, $code, $previous), + 500 => self::createInternalServerErrorException($errorMessage, $previous, $code, $headers), + 503 => new ServiceUnavailableHttpException($errorMessage, $headers, $code, $previous), + default => new HttpException($statusCode, $errorMessage, $headers, $code, $previous), + }; + } + + private static function createBadRequestException( + string $message = '', + ?\Throwable $previous = null, + int $code = 0, + array $headers = [] + ): HttpExceptionInterface { + if (str_contains($message, 'script_lang not supported')) { + return new ScriptLangNotSupportedException($message); + } + return new BadRequestHttpException($message, $headers, $code, $previous); + } + + /** + * Create an InternalServerErrorHttpException from the given parameters. + */ + private static function createInternalServerErrorException( + string $message = '', + ?\Throwable $previous = null, + int $code = 0, + array $headers = [] + ): HttpExceptionInterface { + if (str_contains($message, "RoutingMissingException")) { + return new RoutingMissingException($message); + } + if (preg_match('/ActionRequestValidationException.+ no documents to get/', $message) === 1) { + return new NoDocumentsToGetException($message); + } + if (str_contains($message, 'NoShardAvailableActionException')) { + return new NoShardAvailableException($message); + } + return new InternalServerErrorHttpException($message, $headers, $code, $previous); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionInterface.php new file mode 100644 index 0000000..2a3d76f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/HttpExceptionInterface.php @@ -0,0 +1,21 @@ +getErrorMessage($code), $code, $previous); + } + + public function getData(): ?string + { + return $this->data; + } + + /** + * Gets the JSON error message for the given error code. + */ + private function getErrorMessage(int $code): string + { + return match ($code) { + JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded', + JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', + JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', + JSON_ERROR_SYNTAX => 'Syntax error', + JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', + JSON_ERROR_RECURSION => 'One or more recursive references in the value to be encoded', + JSON_ERROR_INF_OR_NAN => 'One or more NAN or INF values in the value to be encoded', + JSON_ERROR_UNSUPPORTED_TYPE => 'A value of a type that cannot be encoded was given', + + // JSON_ERROR_* constant values that are available on PHP >= 7.0 + 9 => 'Decoding of value would result in invalid PHP property name', //JSON_ERROR_INVALID_PROPERTY_NAME + 10 => 'Attempted to decode nonexistent UTF-16 code-point',//JSON_ERROR_UTF16 + default => throw new \InvalidArgumentException("Encountered unknown JSON error code: [{$code}]"), + }; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/NoDocumentsToGetException.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/NoDocumentsToGetException.php new file mode 100644 index 0000000..157c73a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Exception/NoDocumentsToGetException.php @@ -0,0 +1,12 @@ + $options + * The Guzzle client options. + */ + public function create(array $options): Client + { + // Clean up the options array for the Guzzle HTTP Client. + if (isset($options['auth_aws'])) { + $awsAuth = $options['auth_aws']; + unset($options['auth_aws']); + } + + $httpClient = (new GuzzleHttpClientFactory($this->maxRetries, $this->logger))->create($options); + + if (isset($awsAuth)) { + if (!isset($awsAuth['host'])) { + // Get the host from the base URI. + $awsAuth['host'] = parse_url($options['base_uri'], PHP_URL_HOST); + } + $httpClient = $this->getSigningClientFactory()->create($httpClient, $awsAuth); + } + + $httpFactory = new HttpFactory(); + + $serializer = new SmartSerializer(); + + $requestFactory = new RequestFactory( + $httpFactory, + $httpFactory, + $httpFactory, + $serializer, + ); + + $transport = (new TransportFactory()) + ->setHttpClient($httpClient) + ->setRequestFactory($requestFactory) + ->create(); + + return new Client($transport, new EndpointFactory($serializer), []); + } + + /** + * Gets the AWS signing client factory. + */ + protected function getSigningClientFactory(): SigningClientFactory + { + if ($this->awsSigningHttpClientFactory === null) { + $this->awsSigningHttpClientFactory = new SigningClientFactory(); + } + return $this->awsSigningHttpClientFactory; + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Handlers/SigV4Handler.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Handlers/SigV4Handler.php new file mode 100644 index 0000000..70bd3bb --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Handlers/SigV4Handler.php @@ -0,0 +1,156 @@ +>, body: string|resource|null, client?: array} + * + * @deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\Aws\SigV4RequestFactory instead. + */ +class SigV4Handler +{ + /** + * @var SignatureV4 + */ + private $signer; + /** + * @var callable + */ + private $credentialProvider; + /** + * @var callable + */ + private $wrappedHandler; + + /** + * A handler that applies an AWS V4 signature before dispatching requests. + * + * @param string $region The region of your Amazon + * OpenSearch Service domain + * @param string $service The Service of your Amazon + * OpenSearch Service domain + * @param callable|null $credentialProvider A callable that returns a + * promise that is fulfilled + * with an instance of + * Aws\Credentials\Credentials + * @param callable|null $wrappedHandler A RingPHP handler + */ + public function __construct( + string $region, + string $service, + ?callable $credentialProvider = null, + ?callable $wrappedHandler = null + ) { + self::assertDependenciesInstalled(); + $this->signer = new SignatureV4($service, $region); + $this->wrappedHandler = $wrappedHandler + ?: ClientBuilder::defaultHandler(); + $this->credentialProvider = $credentialProvider + ?: CredentialProvider::defaultProvider(); + } + + /** + * @phpstan-param RingPhpRequest $request + */ + public function __invoke(array $request) + { + $creds = call_user_func($this->credentialProvider)->wait(); + + $psr7Request = $this->createPsr7Request($request); + $psr7Request = $psr7Request->withHeader('x-amz-content-sha256', Utils::hash($psr7Request->getBody(), 'sha256')); + $signedRequest = $this->signer + ->signRequest($psr7Request, $creds); + return call_user_func($this->wrappedHandler, $this->createRingRequest($signedRequest, $request)); + } + + public static function assertDependenciesInstalled(): void + { + if (!class_exists(SignatureV4::class)) { + throw new RuntimeException( + 'The AWS SDK for PHP must be installed in order to use the SigV4 signing handler' + ); + } + } + + /** + * @phpstan-param RingPhpRequest $ringPhpRequest + */ + private function createPsr7Request(array $ringPhpRequest): Request + { + // fix for uppercase 'Host' array key in elasticsearch-php 5.3.1 and backward compatible + // https://github.com/aws/aws-sdk-php/issues/1225 + $hostKey = isset($ringPhpRequest['headers']['Host']) ? 'Host' : 'host'; + + // Amazon ES/OS listens on standard ports (443 for HTTPS, 80 for HTTP). + // Consequently, the port should be stripped from the host header. + $parsedUrl = parse_url($ringPhpRequest['headers'][$hostKey][0]); + if (isset($parsedUrl['host'])) { + $ringPhpRequest['headers'][$hostKey][0] = $parsedUrl['host']; + } + + // Create a PSR-7 URI from the array passed to the handler + $uri = (new Uri($ringPhpRequest['uri'])) + ->withScheme($ringPhpRequest['scheme']) + ->withHost($ringPhpRequest['headers'][$hostKey][0]); + if (isset($ringPhpRequest['query_string'])) { + $uri = $uri->withQuery($ringPhpRequest['query_string']); + } + + // Create a PSR-7 request from the array passed to the handler + return new Request( + $ringPhpRequest['http_method'], + $uri, + $ringPhpRequest['headers'], + $ringPhpRequest['body'] + ); + } + + /** + * @phpstan-param RingPhpRequest $originalRequest + * + * @phpstan-return RingPhpRequest + */ + private function createRingRequest(RequestInterface $request, array $originalRequest): array + { + $uri = $request->getUri(); + $body = (string) $request->getBody(); + + // RingPHP currently expects empty message bodies to be null: + // https://github.com/guzzle/RingPHP/blob/4c8fe4c48a0fb7cc5e41ef529e43fecd6da4d539/src/Client/CurlFactory.php#L202 + if (empty($body)) { + $body = null; + } + + // Reset the explicit port in the URL + $client = $originalRequest['client']; + unset($client['curl'][CURLOPT_PORT]); + + $ringRequest = [ + 'http_method' => $request->getMethod(), + 'scheme' => $uri->getScheme(), + 'uri' => $uri->getPath(), + 'body' => $body, + 'headers' => $request->getHeaders(), + 'client' => $client + ]; + if ($uri->getQuery()) { + $ringRequest['query_string'] = $uri->getQuery(); + } + + return $ringRequest; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchHitIterator.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchHitIterator.php new file mode 100644 index 0000000..aa00504 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchHitIterator.php @@ -0,0 +1,171 @@ +search_responses = $search_responses; + } + + /** + * Rewinds the internal SearchResponseIterator and itself + * + * @return void + * @see Iterator::rewind() + */ + public function rewind(): void + { + $this->current_key = 0; + $this->search_responses->rewind(); + + // The first page may be empty. In that case, the next page is fetched. + $current_page = $this->search_responses->current(); + if ($this->search_responses->valid() && empty($current_page['hits']['hits'])) { + $this->search_responses->next(); + } + + $this->count = 0; + if (isset($current_page['hits']) && isset($current_page['hits']['total'])) { + $this->count = $current_page['hits']['total']; + } + + $this->readPageData(); + } + + /** + * Advances pointer of the current hit to the next one in the current page. If there + * isn't a next hit in the current page, then it advances the current page and moves the + * pointer to the first hit in the page. + * + * @return void + * @see Iterator::next() + */ + public function next(): void + { + $this->current_key++; + $this->current_hit_index++; + $current_page = $this->search_responses->current(); + if (isset($current_page['hits']['hits'][$this->current_hit_index])) { + $this->current_hit_data = $current_page['hits']['hits'][$this->current_hit_index]; + } else { + $this->search_responses->next(); + $this->readPageData(); + } + } + + /** + * Returns a boolean indicating whether or not the current pointer has valid data + * + * @return bool + * @see Iterator::valid() + */ + public function valid(): bool + { + return is_array($this->current_hit_data); + } + + /** + * Returns the current hit + * + * @return array + * @see Iterator::current() + */ + public function current(): array + { + return $this->current_hit_data; + } + + /** + * Returns the current hit index. The hit index spans all pages. + * + * @return int + * @see Iterator::key() + */ + public function key(): int + { + return $this->current_key; + } + + /** + * Advances the internal SearchResponseIterator and resets the current_hit_index to 0 + * + * @internal + */ + private function readPageData(): void + { + if ($this->search_responses->valid()) { + $current_page = $this->search_responses->current(); + $this->current_hit_index = 0; + $this->current_hit_data = $current_page['hits']['hits'][$this->current_hit_index]; + } else { + $this->current_hit_data = null; + } + } + + /** + * {@inheritDoc} + */ + public function count(): int + { + return $this->count; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchResponseIterator.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchResponseIterator.php new file mode 100644 index 0000000..e339435 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Helper/Iterators/SearchResponseIterator.php @@ -0,0 +1,188 @@ +client = $client; + $this->params = $search_params; + + if (isset($search_params['scroll'])) { + $this->scroll_ttl = $search_params['scroll']; + } + } + + /** + * Destructor + */ + public function __destruct() + { + $this->clearScroll(); + } + + /** + * Sets the time to live duration of a scroll window + * + * @param string $time_to_live + * @return $this + */ + public function setScrollTimeout(string $time_to_live): SearchResponseIterator + { + $this->scroll_ttl = $time_to_live; + return $this; + } + + /** + * Clears the current scroll window if there is a scroll_id stored + * + * @return void + */ + private function clearScroll(): void + { + if (!empty($this->scroll_id)) { + $this->client->clearScroll( + array( + 'scroll_id' => $this->scroll_id, + 'client' => array( + 'ignore' => 404 + ) + ) + ); + $this->scroll_id = null; + } + } + + /** + * Rewinds the iterator by performing the initial search. + * + * @return void + * @see Iterator::rewind() + */ + public function rewind(): void + { + $this->clearScroll(); + $this->current_key = 0; + $this->current_scrolled_response = $this->client->search($this->params); + $this->scroll_id = $this->current_scrolled_response['_scroll_id']; + } + + /** + * Fetches every "page" after the first one using the lastest "scroll_id" + * + * @return void + * @see Iterator::next() + */ + public function next(): void + { + $this->current_scrolled_response = $this->client->scroll( + [ + 'scroll' => $this->scroll_ttl, + 'body' => [ + 'scroll_id' => $this->scroll_id, + ], + ] + ); + $this->scroll_id = $this->current_scrolled_response['_scroll_id']; + $this->current_key++; + } + + /** + * Returns a boolean value indicating if the current page is valid or not + * + * @return bool + * @see Iterator::valid() + */ + public function valid(): bool + { + return isset($this->current_scrolled_response['hits']['hits'][0]); + } + + /** + * Returns the current "page" + * + * @return array + * @see Iterator::current() + */ + public function current(): array + { + return $this->current_scrolled_response; + } + + /** + * Returns the current "page number" of the current "page" + * + * @return int + * @see Iterator::key() + */ + public function key(): int + { + return $this->current_key; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleHttpClientFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleHttpClientFactory.php new file mode 100644 index 0000000..a0b2675 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleHttpClientFactory.php @@ -0,0 +1,78 @@ + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'User-Agent' => sprintf('opensearch-php/%s (%s; PHP %s)', Client::VERSION, PHP_OS, PHP_VERSION), + ], + ]; + + // Merge the default options with the provided options. + $config = array_merge_recursive($defaults, $options); + + $stack = HandlerStack::create(); + + // Handle retries if max_retries is set. + if ($this->maxRetries > 0) { + $decider = new GuzzleRetryDecider($this->maxRetries, $this->logger); + $stack->push(Middleware::retry($decider(...))); + } + + // Attach any middlewares that look valid. + foreach ($middlewares as $name => $middleware) { + if (is_callable($middleware)) { + // If a name was specified in the options array, use it. + if (is_int($name) || is_numeric($name)) { + $name = ''; + } + $stack->push($middleware, $name); + } + } + + $config['handler'] = $stack; + + return new GuzzleClient($config); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleRetryDecider.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleRetryDecider.php new file mode 100644 index 0000000..034e94e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/GuzzleRetryDecider.php @@ -0,0 +1,53 @@ += $this->maxRetries) { + return false; + } + // Increment $retries after comparison for human display in log + // message. + if ($exception instanceof ConnectException) { + $this->logger?->warning( + 'Retrying request {retries} of {maxRetries}: {exception}', + [ + 'retries' => $retries + 1, + 'maxRetries' => $this->maxRetries, + 'exception' => $exception->getMessage(), + ] + ); + return true; + } + if ($response && $response->getStatusCode() >= 500) { + $this->logger?->warning( + 'Retrying request {retries} of {maxRetries}: Status code {status}', + [ + 'retries' => $retries + 1, + 'maxRetries' => $this->maxRetries, + 'status' => $response->getStatusCode(), + ] + ); + return true; + } + // We only retry if there is a 500 or a ConnectException. + return false; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/HttpClientFactoryInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/HttpClientFactoryInterface.php new file mode 100644 index 0000000..cd1a78c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/HttpClientFactoryInterface.php @@ -0,0 +1,21 @@ + $options + */ + public function create(array $options): ClientInterface; + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/SymfonyHttpClientFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/SymfonyHttpClientFactory.php new file mode 100644 index 0000000..7bee612 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpClient/SymfonyHttpClientFactory.php @@ -0,0 +1,51 @@ + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'User-Agent' => sprintf('opensearch-php/%s (%s; PHP %s)', Client::VERSION, PHP_OS, PHP_VERSION), + ], + ]; + $options = array_merge_recursive($defaults, $options); + + $symfonyClient = HttpClient::create()->withOptions($options); + + if ($this->maxRetries > 0) { + $symfonyClient = new RetryableHttpClient($symfonyClient, null, $this->maxRetries, $this->logger); + } + + return new Psr18Client($symfonyClient); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpTransport.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpTransport.php new file mode 100644 index 0000000..748c542 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/HttpTransport.php @@ -0,0 +1,61 @@ +requestFactory->createRequest($method, $uri, $params, $body, $headers); + } + + /** + * {@inheritdoc} + */ + public function sendRequest( + string $method, + string $uri, + array $params = [], + mixed $body = null, + array $headers = [], + ): iterable|string|null { + // @todo Remove support for legacy options in 3.0.0. + // @phpstan-ignore isset.offset + if (isset($headers['client']['headers'])) { + $headers = array_merge($headers, $headers['client']['headers']); + } + unset($headers['client']); + $request = $this->createRequest($method, $uri, $params, $body, $headers); + $response = $this->client->sendRequest($request); + $statusCode = $response->getStatusCode(); + $responseBody = $response->getBody()->getContents(); + $responseHeaders = $response->getHeaders(); + $data = $this->serializer->deserialize($responseBody, $responseHeaders); + // Status code >= 200 < 300 is a success. + // Status code >= 300 < 400 is a redirect and should be handled by the client. + if ($statusCode >= 400) { + // Throw an HTTP exception. + throw HttpExceptionFactory::create($statusCode, $data); + } + return $data; + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyEndpointFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyEndpointFactory.php new file mode 100644 index 0000000..843b89b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyEndpointFactory.php @@ -0,0 +1,42 @@ +endpoints = $endpoints; + } + + /** + * {@inheritdoc} + */ + public function getEndpoint(string $class): AbstractEndpoint + { + // We need to strip the base namespace from the class name for BC. + $class = str_replace('OpenSearch\\Endpoints\\', '', $class); + $endpointBuilder = $this->endpoints; + return $endpointBuilder($class); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyTransportWrapper.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyTransportWrapper.php new file mode 100644 index 0000000..eea0ca7 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyTransportWrapper.php @@ -0,0 +1,38 @@ +transport->performRequest($method, $uri, $params, $body, $options); + return $this->transport->resultOrFuture($promise, $options); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AbstractNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AbstractNamespace.php new file mode 100644 index 0000000..b20f17a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AbstractNamespace.php @@ -0,0 +1,106 @@ +transport = $transport; + // @phpstan-ignore new.deprecated + $this->httpTransport = new LegacyTransportWrapper($transport); + } else { + $this->httpTransport = $transport; + } + if (is_callable($endpointFactory)) { + @trigger_error('Passing a callable as $endpointFactory param to ' . __METHOD__ . '() is deprecated in 2.4.0 and will be removed in 3.0.0. Pass an instance of \OpenSearch\EndpointFactoryInterface instead.', E_USER_DEPRECATED); + $endpoints = $endpointFactory; + // @phpstan-ignore new.deprecated + $endpointFactory = new LegacyEndpointFactory($endpointFactory); + } else { + $endpoints = function ($c) use ($endpointFactory) { + @trigger_error('The $endpoints property is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); + return $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c); + }; + } + // @phpstan-ignore property.deprecated + $this->endpoints = $endpoints; + $this->endpointFactory = $endpointFactory; + } + + /** + * @return null|mixed + */ + public function extractArgument(array &$params, string $arg) + { + if (array_key_exists($arg, $params) === true) { + $val = $params[$arg]; + unset($params[$arg]); + return $val; + } else { + return null; + } + } + + protected function performRequest(AbstractEndpoint $endpoint) + { + return $this->httpTransport->sendRequest( + $endpoint->getMethod(), + $endpoint->getURI(), + $endpoint->getParams(), + $endpoint->getBody(), + $endpoint->getOptions() + ); + + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AsyncSearchNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AsyncSearchNamespace.php new file mode 100644 index 0000000..7b1c9f0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/AsyncSearchNamespace.php @@ -0,0 +1,31 @@ +extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Gets partial responses from an asynchronous search. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Performs an asynchronous search. + * + * @param array{index?: string, keep_alive?: string, keep_on_completion?: bool, wait_for_completion_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index to be searched. Can be an individual name, a comma-separated list of indexes, or a wildcard expression of index names. + * - keep_alive: The amount of time that the result is saved in the cluster. For example, `2d` means that the results are stored in the cluster for 48 hours. The saved search results are deleted after this period or if the search is canceled. Note that this includes the query execution time. If the query exceeds this amount of time, the process cancels this query automatically. + * - keep_on_completion: Whether to save the results in the cluster after the search is complete. You can examine the stored results at a later time. + * - wait_for_completion_timeout: The amount of time to wait for the results. You can poll the remaining results based on an ID. The maximum value is 300 seconds. Default is `1s`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function search(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Search::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Monitors any asynchronous searches that are `running`, `completed`, or `persisted`. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/BooleanRequestWrapper.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/BooleanRequestWrapper.php new file mode 100644 index 0000000..575574e --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/BooleanRequestWrapper.php @@ -0,0 +1,99 @@ +sendRequest( + $endpoint->getMethod(), + $endpoint->getURI(), + $endpoint->getParams(), + $endpoint->getBody(), + $endpoint->getOptions() + ); + + } catch (NotFoundHttpException|RoutingMissingException $e) { + // Return false for 404 errors. + return false; + } + return true; + } + + /** + * Perform Request + * + * @throws Missing404Exception + * @throws RoutingMissingException + * + * @deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\Namespaces\BooleanRequestWrapper::sendRequest() instead. + */ + public static function performRequest(AbstractEndpoint $endpoint, Transport $transport) + { + @trigger_error( + __METHOD__ . '() is deprecated in 2.4.0 and will be removed in 3.0.0. Use \OpenSearch\Namespaces\BooleanRequestWrapper::sendRequest() instead.' + ); + try { + $response = $transport->performRequest( + $endpoint->getMethod(), + $endpoint->getURI(), + $endpoint->getParams(), + $endpoint->getBody(), + $endpoint->getOptions() + ); + + $response = $transport->resultOrFuture($response, $endpoint->getOptions()); + if (!($response instanceof FutureArrayInterface)) { + if ($response['status'] === 200) { + return true; + } else { + return false; + } + } else { + // async mode, can't easily resolve this...punt to user + return $response; + } + } catch (Missing404Exception $exception) { + return false; + } catch (RoutingMissingException $exception) { + return false; + } + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/CatNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/CatNamespace.php new file mode 100644 index 0000000..e072ee1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/CatNamespace.php @@ -0,0 +1,774 @@ +extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(Aliases::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Lists all active CAT point-in-time segments. + * + * @param array{bytes?: mixed, format?: string, h?: mixed, help?: bool, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - bytes: The units used to display byte values. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function allPitSegments(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(AllPitSegments::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. + * + * @param array{node_id?: mixed, bytes?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: A comma-separated list of node IDs or names used to limit the returned information. + * - bytes: The units used to display byte values. + * - cluster_manager_timeout: A timeout for connection to the cluster manager node. + * - format: A short version of the HTTP `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from cluster-manager node. (Default: false) + * - master_timeout: A timeout for connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function allocation(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Allocation::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about the cluster-manager node. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: A timeout for connection to the cluster manager node. + * - format: A short version of the HTTP `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: A timeout for connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function clusterManager(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ClusterManager::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Provides quick access to the document count of the entire cluster or of an individual index. + * + * @param array{index?: mixed, format?: string, h?: mixed, help?: bool, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function count(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Count::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Shows how much heap memory is currently being used by field data on every data node in the cluster. + * + * @param array{fields?: mixed, bytes?: mixed, format?: string, h?: mixed, help?: bool, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - fields: A comma-separated list of fields used to limit the amount of returned information. + * - bytes: The units used to display byte values. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function fielddata(array $params = []) + { + $fields = $this->extractArgument($params, 'fields'); + + $endpoint = $this->endpointFactory->getEndpoint(Fielddata::class); + $endpoint->setParams($params); + $endpoint->setFields($fields); + + return $this->performRequest($endpoint); + } + + /** + * Returns a concise representation of the cluster health. + * + * @param array{format?: string, h?: mixed, help?: bool, s?: mixed, time?: mixed, ts?: bool, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: The unit used to display time values. + * - ts: When `true`, returns `HH:MM:SS` and Unix epoch timestamps. (Default: true) + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function health(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Health::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns help for the Cat APIs. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function help(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Help::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Lists information related to indexes, that is, how much disk space they are using, how many shards they have, their health status, and so on. + * + * @param array{index?: mixed, bytes?: mixed, cluster_manager_timeout?: string, expand_wildcards?: mixed, format?: string, h?: mixed, health?: mixed, help?: bool, include_unloaded_segments?: bool, local?: bool, master_timeout?: string, pri?: bool, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - bytes: The units used to display byte values. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - expand_wildcards: + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - health: Limits indexes based on their health status. Supported values are `green`, `yellow`, and `red`. + * - help: Returns help information. (Default: false) + * - include_unloaded_segments: Whether to include information from segments not loaded into memory. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - pri: When `true`, returns information only from the primary shards. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function indices(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Indices::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about the cluster-manager node. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function master(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Master::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about custom node attributes. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function nodeattrs(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(NodeAttrs::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns basic statistics about the performance of cluster nodes. + * + * @param array{bytes?: mixed, cluster_manager_timeout?: string, format?: string, full_id?: mixed, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - bytes: The units used to display byte values. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - full_id: When `true`, returns the full node ID. When `false`, returns the shortened node ID. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function nodes(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Nodes::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns a concise representation of the cluster's pending tasks. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function pendingTasks(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(PendingTasks::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Lists one or several CAT point-in-time segments. + * + * @param array{bytes?: mixed, format?: string, h?: mixed, help?: bool, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - bytes: The units used to display byte values. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function pitSegments(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PitSegments::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about the names, components, and versions of the installed plugins. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function plugins(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Plugins::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns all completed and ongoing index and shard recoveries. + * + * @param array{index?: mixed, active_only?: bool, bytes?: mixed, detailed?: bool, format?: string, h?: mixed, help?: bool, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - active_only: If `true`, the response only includes ongoing shard recoveries. (Default: false) + * - bytes: The units used to display byte values. + * - detailed: When `true`, includes detailed information about shard recoveries. (Default: false) + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function recovery(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Recovery::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about all snapshot repositories for a cluster. + * + * @param array{cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function repositories(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Repositories::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about active and last-completed segment replication events on each replica shard, including related shard-level metrics. These metrics provide information about how far behind the primary shard the replicas are lagging. + * + * @param array{index?: mixed, active_only?: bool, allow_no_indices?: bool, bytes?: mixed, completed_only?: bool, detailed?: bool, expand_wildcards?: mixed, format?: string, h?: mixed, help?: bool, ignore_throttled?: bool, ignore_unavailable?: bool, s?: mixed, shards?: mixed, time?: mixed, timeout?: string, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - active_only: When `true`, the response only includes ongoing segment replication events. (Default: false) + * - allow_no_indices: Whether to ignore the index if a wildcard index expression resolves to no concrete indexes. This includes the `_all` string or when no indexes have been specified. + * - bytes: The units used to display byte values. + * - completed_only: When `true`, the response only includes the last-completed segment replication events. (Default: false) + * - detailed: When `true`, the response includes additional metrics for each stage of a segment replication event. (Default: false) + * - expand_wildcards: + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - ignore_throttled: Whether specified concrete, expanded, or aliased indexes should be ignored when throttled. + * - ignore_unavailable: Whether the specified concrete indexes should be ignored when missing or closed. + * - s: A comma-separated list of column names or column aliases to sort by. + * - shards: A comma-separated list of shards to display. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - timeout: The operation timeout. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function segmentReplication(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(SegmentReplication::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Provides low-level information about the segments in the shards of an index. + * + * @param array{index?: mixed, bytes?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - bytes: The units used to display byte values. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function segments(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Segments::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Lists the states of all primary and replica shards and how they are distributed. + * + * @param array{index?: mixed, bytes?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: + * - bytes: The units used to display byte values. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function shards(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Shards::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Lists all of the snapshots stored in a specific repository. + * + * @param array{repository?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, ignore_unavailable?: bool, master_timeout?: string, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, OpenSearch returns an error. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - ignore_unavailable: When `true`, the response does not include information from unavailable snapshots. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function snapshots(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + + $endpoint = $this->endpointFactory->getEndpoint(Snapshots::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + + /** + * Lists the progress of all tasks currently running on the cluster. + * + * @param array{actions?: mixed, detailed?: bool, format?: string, h?: mixed, help?: bool, s?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, node_id?: mixed, parent_task?: string} $params + * - actions: The task action names used to limit the response. + * - detailed: If `true`, the response includes detailed information about shard recoveries. (Default: false) + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - time: Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - node_id: A comma-separated list of node IDs or names used to limit the returned information. Use `_local` to return information from the node to which you're connecting, specify a specific node from which to get information, or keep the parameter empty to get information from all nodes. + * - parent_task: The parent task identifier, which is used to limit the response. + * @return array + */ + public function tasks(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Tasks::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Lists the names, patterns, order numbers, and version numbers of index templates. + * + * @param array{name?: string, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function templates(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(Templates::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Returns cluster-wide thread pool statistics per node.By default the active, queued, and rejected statistics are returned for all thread pools. + * + * @param array{thread_pool_patterns?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, s?: mixed, size?: int, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. + * - cluster_manager_timeout: A timeout for connection to the cluster manager node. + * - format: A short version of the `Accept` header, such as `json` or `yaml`. + * - h: A comma-separated list of column names to display. + * - help: Returns help information. (Default: false) + * - local: Returns local information but does not retrieve the state from the cluster manager node. (Default: false) + * - master_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - s: A comma-separated list of column names or column aliases to sort by. + * - size: The multiplier in which to display values. + * - v: Enables verbose mode, which displays column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function threadPool(array $params = []) + { + $thread_pool_patterns = $this->extractArgument($params, 'thread_pool_patterns'); + + $endpoint = $this->endpointFactory->getEndpoint(ThreadPool::class); + $endpoint->setParams($params); + $endpoint->setThreadPoolPatterns($thread_pool_patterns); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ClusterNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ClusterNamespace.php new file mode 100644 index 0000000..f53378d --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ClusterNamespace.php @@ -0,0 +1,602 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(AllocationExplain::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a component template. + * + * @param array{name?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the component template to delete. Supports wildcard (*) expressions. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: + * - timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteComponentTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteComponentTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Recommissions a decommissioned zone. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteDecommissionAwareness(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteDecommissionAwareness::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Clears any cluster voting configuration exclusions. + * + * @param array{wait_for_removal?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - wait_for_removal: Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. When `true`, all excluded nodes are removed from the cluster before this API takes any action. When `false`, the voting configuration exclusions list is cleared even if some excluded nodes are still in the cluster. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteVotingConfigExclusions(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteVotingConfigExclusions::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Delete weighted shard routing weights. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function deleteWeightedRouting(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteWeightedRouting::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about whether a particular component template exist. + * + * @param array{name?: string, cluster_manager_timeout?: string, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the component template. Wildcard (*) expressions are supported. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - local: When `true`, the request retrieves information from the local node only. When `false`, information is retrieved from the cluster manager node. (Default: false) + * - master_timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsComponentTemplate(array $params = []): bool + { + $name = $this->extractArgument($params, 'name'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsComponentTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns one or more component templates. + * + * @param array{name?: mixed, cluster_manager_timeout?: string, flat_settings?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the component template to retrieve. Wildcard (`*`) expressions are supported. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - flat_settings: Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default: false) + * - local: When `true`, the request retrieves information from the local node only. When `false`, information is retrieved from the cluster manager node. (Default: false) + * - master_timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getComponentTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetComponentTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the decommission status for all zones. + * + * @param array{awareness_attribute_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - awareness_attribute_name: The name of the awareness attribute. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getDecommissionAwareness(array $params = []) + { + $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetDecommissionAwareness::class); + $endpoint->setParams($params); + $endpoint->setAwarenessAttributeName($awareness_attribute_name); + + return $this->performRequest($endpoint); + } + + /** + * Returns cluster settings. + * + * @param array{cluster_manager_timeout?: string, flat_settings?: bool, include_defaults?: bool, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - flat_settings: Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default: false) + * - include_defaults: When `true`, returns default cluster settings from the local node. (Default: false) + * - master_timeout: + * - timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSettings(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetSettings::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Fetches weighted shard routing weights. + * + * @param array{attribute?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - attribute: The name of the awareness attribute. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getWeightedRouting(array $params = []) + { + $attribute = $this->extractArgument($params, 'attribute'); + + $endpoint = $this->endpointFactory->getEndpoint(GetWeightedRouting::class); + $endpoint->setParams($params); + $endpoint->setAttribute($attribute); + + return $this->performRequest($endpoint); + } + + /** + * Returns basic information about the health of the cluster. + * + * @param array{index?: mixed, awareness_attribute?: string, cluster_manager_timeout?: string, expand_wildcards?: mixed, level?: mixed, local?: bool, master_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, wait_for_events?: mixed, wait_for_no_initializing_shards?: bool, wait_for_no_relocating_shards?: bool, wait_for_nodes?: mixed, wait_for_status?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: + * - awareness_attribute: The name of the awareness attribute for which to return the cluster health status (for example, `zone`). Applicable only if `level` is set to `awareness_attributes`. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - expand_wildcards: + * - level: (Options: awareness_attributes, cluster, indices, shards) + * - local: Whether to return information from the local node only instead of from the cluster manager node. (Default: false) + * - master_timeout: + * - timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - wait_for_active_shards: + * - wait_for_events: + * - wait_for_no_initializing_shards: Whether to wait until there are no initializing shards in the cluster. (Default: false) + * - wait_for_no_relocating_shards: Whether to wait until there are no relocating shards in the cluster. (Default: false) + * - wait_for_nodes: Waits until the specified number of nodes (`N`) is available. Accepts `>=N`, `<=N`, `>N`, and `extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Health::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns a list of pending cluster-level tasks, such as index creation, mapping updates,or new allocations. + * + * @param array{cluster_manager_timeout?: string, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - local: When `true`, the request retrieves information from the local node only. When `false`, information is retrieved from the cluster manager node. (Default: false) + * - master_timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function pendingTasks(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(PendingTasks::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Updates the cluster voting configuration by excluding certain node IDs or names. + * + * @param array{node_ids?: mixed, node_names?: mixed, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_ids: A comma-separated list of node IDs to exclude from the voting configuration. When using this setting, you cannot also specify `node_names`. Either `node_ids` or `node_names` are required to receive a valid response. + * - node_names: A comma-separated list of node names to exclude from the voting configuration. When using this setting, you cannot also specify `node_ids`. Either `node_ids` or `node_names` are required to receive a valid response. + * - timeout: When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration before returning a response. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function postVotingConfigExclusions(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(PostVotingConfigExclusions::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates a component template. + * + * @param array{name?: string, cluster_manager_timeout?: string, create?: bool, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: The name of the component template to create. OpenSearch includes the following built-in component templates: `logs-mappings`, `logs-settings`, `metrics-mappings`, `metrics-settings`, `synthetics-mapping`, and `synthetics-settings`. OpenSearch uses these templates to configure backing indexes for its data streams. If you want to overwrite one of these templates, set the replacement template `version` to a higher value than the current version. If you want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the [Cluster Update Settings API](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/). + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - create: When `true`, this request cannot replace or update existing component templates. (Default: false) + * - master_timeout: + * - timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The template definition. (Required) + * @return array + */ + public function putComponentTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutComponentTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Decommissions a cluster zone based on awareness. This can greatly benefit multi-zone deployments, where awareness attributes can aid in applying new upgrades to a cluster in a controlled fashion. + * + * @param array{awareness_attribute_name?: string, awareness_attribute_value?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - awareness_attribute_name: The name of the awareness attribute. + * - awareness_attribute_value: The value of the awareness attribute. For example, if you have shards allocated in two different zones, you can give each zone a value of `zone-a` or `zoneb`. The cluster decommission operation decommissions the zone listed in the method. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function putDecommissionAwareness(array $params = []) + { + $awareness_attribute_name = $this->extractArgument($params, 'awareness_attribute_name'); + $awareness_attribute_value = $this->extractArgument($params, 'awareness_attribute_value'); + + $endpoint = $this->endpointFactory->getEndpoint(PutDecommissionAwareness::class); + $endpoint->setParams($params); + $endpoint->setAwarenessAttributeName($awareness_attribute_name); + $endpoint->setAwarenessAttributeValue($awareness_attribute_value); + + return $this->performRequest($endpoint); + } + + /** + * Updates the cluster settings. + * + * @param array{cluster_manager_timeout?: string, flat_settings?: bool, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - flat_settings: Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default: false) + * - master_timeout: + * - timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The cluster settings to update. (Required) + * @return array + */ + public function putSettings(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutSettings::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates weighted shard routing weights. + * + * @param array{attribute?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - attribute: The name of awareness attribute, usually `zone`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putWeightedRouting(array $params = []) + { + $attribute = $this->extractArgument($params, 'attribute'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutWeightedRouting::class); + $endpoint->setParams($params); + $endpoint->setAttribute($attribute); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns the information about configured remote clusters. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function remoteInfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(RemoteInfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Allows to manually change the allocation of individual shards in the cluster. + * + * @param array{cluster_manager_timeout?: string, dry_run?: bool, explain?: bool, master_timeout?: string, metric?: mixed, retry_failed?: bool, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - dry_run: When `true`, the request simulates the operation and returns the resulting state. + * - explain: When `true`, the response contains an explanation of why reroute certain commands can or cannot be executed. + * - master_timeout: + * - metric: Limits the information returned to the specified metrics. + * - retry_failed: When `true`, retries shard allocation if it was blocked because of too many subsequent failures. + * - timeout: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The definition of `commands` to perform (`move`, `cancel`, `allocate`) + * @return array + */ + public function reroute(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Reroute::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns comprehensive information about the state of the cluster. + * + * @param array{metric?: mixed, index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, flat_settings?: bool, ignore_unavailable?: bool, local?: bool, master_timeout?: string, wait_for_metadata_version?: int, wait_for_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - metric: Limits the information returned to only the [specified metric groups](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/#metric-groups). + * - index: + * - allow_no_indices: Whether to ignore a wildcard index expression that resolves into no concrete indexes. This includes the `_all` string or when no indexes have been specified. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - expand_wildcards: + * - flat_settings: Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default: false) + * - ignore_unavailable: Whether the specified concrete indexes should be ignored when unavailable (missing or closed). + * - local: Whether to return information from the local node only instead of from the cluster manager node. (Default: false) + * - master_timeout: + * - wait_for_metadata_version: Wait for the metadata version to be equal or greater than the specified metadata version. + * - wait_for_timeout: The maximum time to wait for `wait_for_metadata_version` before timing out. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function state(array $params = []) + { + $metric = $this->extractArgument($params, 'metric'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(State::class); + $endpoint->setParams($params); + $endpoint->setMetric($metric); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns a high-level overview of cluster statistics. + * + * @param array{index_metric?: mixed, metric?: mixed, node_id?: mixed, flat_settings?: bool, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index_metric: A comma-separated list of [index metric groups](https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/#index-metric-groups), for example, `docs,store`. + * - metric: Limit the information returned to the specified metrics. + * - node_id: + * - flat_settings: Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of `"cluster": { "max_shards_per_node": 500 }` is `"cluster.max_shards_per_node": "500"`. (Default: false) + * - timeout: The amount of time to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response's `_nodes.failed` property. Defaults to no timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + $index_metric = $this->extractArgument($params, 'index_metric'); + $metric = $this->extractArgument($params, 'metric'); + $node_id = $this->extractArgument($params, 'node_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setIndexMetric($index_metric); + $endpoint->setMetric($metric); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php new file mode 100644 index 0000000..e5709f2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php @@ -0,0 +1,109 @@ +extractArgument($params, 'index_uuid'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteDanglingIndex::class); + $endpoint->setParams($params); + $endpoint->setIndexUuid($index_uuid); + + return $this->performRequest($endpoint); + } + + /** + * Imports the specified dangling index. + * + * @param array{index_uuid?: string, accept_data_loss?: bool, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index_uuid: The UUID of the dangling index. + * - accept_data_loss: Must be set to true in order to import the dangling index. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Specify timeout for connection to cluster manager. + * - timeout: Explicit operation timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function importDanglingIndex(array $params = []) + { + $index_uuid = $this->extractArgument($params, 'index_uuid'); + + $endpoint = $this->endpointFactory->getEndpoint(ImportDanglingIndex::class); + $endpoint->setParams($params); + $endpoint->setIndexUuid($index_uuid); + + return $this->performRequest($endpoint); + } + + /** + * Returns all dangling indexes. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function listDanglingIndices(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListDanglingIndices::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php new file mode 100644 index 0000000..b72b743 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php @@ -0,0 +1,208 @@ +extractArgument($params, 'transform_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\DeleteTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms + * $params['from'] = (int) skips a number of transform configs, defaults to 0 + * $params['size'] = (int) specifies a max number of transforms to get, defaults to 100 + * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function getTransform(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\GetTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id of the transform for which to get stats. '_all' or '*' implies all transforms + * $params['from'] = (number) skips a number of transform stats, defaults to 0 + * $params['size'] = (number) specifies a max number of transform stats to get, defaults to 100 + * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function getTransformStats(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\GetTransformStats'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + + return $this->performRequest($endpoint); + } + public function previewTransform(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\PreviewTransform'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id of the new transform. + * $params['defer_validation'] = (boolean) If validations should be deferred until transform starts, defaults to false. + * $params['body'] = (array) The transform definition (Required) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function putTransform(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\PutTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id of the transform to start + * $params['timeout'] = (time) Controls the time to wait for the transform to start + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function startTransform(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\StartTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id of the transform to stop + * $params['wait_for_completion'] = (boolean) Whether to wait for the transform to fully stop before returning or not. Default to false + * $params['timeout'] = (time) Controls the time to wait until the transform has stopped. Default to 30 seconds + * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function stopTransform(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\StopTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + + return $this->performRequest($endpoint); + } + /** + * $params['transform_id'] = (string) The id of the transform. + * $params['defer_validation'] = (boolean) If validations should be deferred until transform starts, defaults to false. + * $params['body'] = (array) The update transform definition (Required) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is BETA and may change in ways that are not backwards compatible + * + */ + public function updateTransform(array $params = []) + { + $transform_id = $this->extractArgument($params, 'transform_id'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('DataFrameTransformDeprecated\UpdateTransform'); + $endpoint->setParams($params); + $endpoint->setTransformId($transform_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php new file mode 100644 index 0000000..ea4bec4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/FlowFrameworkNamespace.php @@ -0,0 +1,283 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Create::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a workflow template. + * + * @param array{workflow_id?: string, clear_status?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - workflow_id: + * - clear_status: (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function delete(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + + return $this->performRequest($endpoint); + } + + /** + * Deprovision workflow's resources when you no longer need them. + * + * @param array{workflow_id?: string, allow_delete?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - workflow_id: + * - allow_delete: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deprovision(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Deprovision::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a workflow template. + * + * @param array{workflow_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - workflow_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the current workflow provisioning status. + * + * @param array{workflow_id?: string, all?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - workflow_id: + * - all: Whether to return all fields in the response. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStatus(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetStatus::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves available workflow steps. + * + * @param array{workflow_step?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - workflow_step: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSteps(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetSteps::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Provisioning a workflow. This API is also executed when the Create or Update Workflow API is called with the provision parameter set to true. + * + * @param array{workflow_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - workflow_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function provision(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Provision::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search for workflows by using a query matching a field. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function search(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Search::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search for workflows by using a query matching a field. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function searchState(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchState::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates a workflow template that has not been provisioned. + * + * @param array{workflow_id?: string, provision?: bool, reprovision?: bool, update_fields?: bool, use_case?: string, validation?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - workflow_id: + * - provision: (Default: false) + * - reprovision: (Default: false) + * - update_fields: (Default: false) + * - use_case: Specifies the workflow template to use. + * - validation: (Default: all) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function update(array $params = []) + { + $workflow_id = $this->extractArgument($params, 'workflow_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Update::class); + $endpoint->setParams($params); + $endpoint->setWorkflowId($workflow_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/GeospatialNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/GeospatialNamespace.php new file mode 100644 index 0000000..a9486d2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/GeospatialNamespace.php @@ -0,0 +1,197 @@ +extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteIp2geoDatasource::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Use an OpenSearch query to upload `GeoJSON`, operation will fail if index exists.- When type is `geo_point`, only Point geometry is allowed- When type is `geo_shape`, all geometry types are allowed (Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Envelope). + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function geojsonUploadPost(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GeojsonUploadPost::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Use an OpenSearch query to upload `GeoJSON` regardless if index exists.- When type is `geo_point`, only Point geometry is allowed- When type is `geo_shape`, all geometry types are allowed (Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Envelope). + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function geojsonUploadPut(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GeojsonUploadPut::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Get one or more IP2Geo data sources, defaulting to returning all if no names specified. + * + * @param array{name?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getIp2geoDatasource(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetIp2geoDatasource::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves statistics for all geospatial uploads. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getUploadStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetUploadStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Create a specific IP2Geo data source.Default values: - `endpoint`: `"https://geoip.maps.opensearch.org/v1/geolite2-city/manifest.json"` - `update_interval_in_days`: 3. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putIp2geoDatasource(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutIp2geoDatasource::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a specific IP2Geo data source. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function putIp2geoDatasourceSettings(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutIp2geoDatasourceSettings::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IndicesNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IndicesNamespace.php new file mode 100644 index 0000000..59b97ed --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IndicesNamespace.php @@ -0,0 +1,1527 @@ +extractArgument($params, 'block'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(AddBlock::class); + $endpoint->setParams($params); + $endpoint->setBlock($block); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Performs the analysis process on a text and return the tokens breakdown of the text. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index to scope the operation. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Define analyzer/tokenizer parameters and the text on which the analysis should be performed + * @return array + */ + public function analyze(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Analyze::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Clears all or specific caches for one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, fielddata?: bool, fields?: mixed, file?: bool, ignore_unavailable?: bool, query?: bool, request?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - fielddata: If `true`, clears the fields cache. Use the `fields` parameter to clear the cache of specific fields only. + * - fields: A comma-separated list of field names used to limit the `fielddata` parameter. + * - file: If `true`, clears the unused entries from the file cache on nodes with the Search role. (Default: false) + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - query: If `true`, clears the query cache. + * - request: If `true`, clears the request cache. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function clearCache(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(ClearCache::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Clones an index. + * + * @param array{index?: string, target?: string, cluster_manager_timeout?: string, master_timeout?: string, task_execution_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the source index to clone. + * - target: Name of the target index to create. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - task_execution_timeout: Explicit task execution timeout, only useful when `wait_for_completion` is false, defaults to `1h`. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: Should this request wait until the operation has completed before returning. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The configuration for the target index (`settings` and `aliases`) + * @return array + */ + public function clone(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $target = $this->extractArgument($params, 'target'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CloneIndices::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setTarget($target); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Closes an index. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, ignore_unavailable?: bool, master_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list or wildcard expression of index names used to limit the request. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function close(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Close::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Creates an index with optional settings and mappings. + * + * @param array{index?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the index you wish to create. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The configuration for the index (`settings` and `mappings`) + * @return array + */ + public function create(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Create::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates a data stream. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `#`, `:`, or a space character; Cannot start with `-`, `_`, `+`, or `.ds-`; Cannot be `.` or `..`; Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The data stream definition + * @return array + */ + public function createDataStream(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateDataStream::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Provides statistics on operations happening in a data stream. + * + * @param array{name?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a cluster, omit this parameter or use `*`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function dataStreamsStats(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DataStreamsStats::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Deletes an index. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, ignore_unavailable?: bool, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (`*`) or `_all`. To use wildcards or `_all`, set the `action.destructive_requires_name` cluster setting to `false`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. (Default: false) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function delete(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Deletes an alias. + * + * @param array{index?: mixed, name?: mixed, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams or indexes used to limit the request. Supports wildcards (`*`). + * - name: A comma-separated list of aliases to remove. Supports wildcards (`*`). To remove all aliases, use `*` or `_all`. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteAlias(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteAlias::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a data stream. + * + * @param array{name?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteDataStream(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteDataStream::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Deletes an index template. + * + * @param array{name?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the index template to delete. Wildcard (*) expressions are supported. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteIndexTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteIndexTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Deletes an index template. + * + * @param array{name?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the legacy index template to delete. Wildcard (`*`) expressions are supported. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about whether a particular index exists. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, flat_settings?: bool, ignore_unavailable?: bool, include_defaults?: bool, local?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases. Supports wildcards (`*`). + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. (Default: false) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. (Default: false) + * - include_defaults: If `true`, return all default settings in the response. (Default: false) + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function exists(array $params = []): bool + { + $index = $this->extractArgument($params, 'index'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(Exists::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns information about whether a particular alias exists. + * + * @param array{name?: mixed, index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, local?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of aliases to check. Supports wildcards (`*`). + * - index: A comma-separated list of data streams or indexes used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, requests that include a missing data stream or index in the target indexes or data streams return an error. + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsAlias(array $params = []): bool + { + $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsAlias::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setIndex($index); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns information about whether a particular index template exists. + * + * @param array{name?: string, cluster_manager_timeout?: string, flat_settings?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the index template to check existence of. Wildcard (*) expressions are supported. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - flat_settings: Return settings in flat format. (Default: false) + * - local: Return local information, do not retrieve the state from cluster-manager node. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsIndexTemplate(array $params = []): bool + { + $name = $this->extractArgument($params, 'name'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsIndexTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Returns information about whether a particular index template exists. + * + * @param array{name?: mixed, cluster_manager_timeout?: string, flat_settings?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The comma separated names of the index templates + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - flat_settings: Return settings in flat format. (Default: false) + * - local: Return local information, do not retrieve the state from cluster-manager node. (Default: false) + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsTemplate(array $params = []): bool + { + $name = $this->extractArgument($params, 'name'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Performs the flush operation on one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, force?: bool, ignore_unavailable?: bool, wait_if_ongoing?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to flush. Supports wildcards (`*`). To flush all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - force: If `true`, the request forces a flush even if there are no changes to commit to the index. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - wait_if_ongoing: If `true`, the flush operation blocks until execution when another flush operation is running. If `false`, OpenSearch returns an error if you request a flush when another flush operation is running. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function flush(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Flush::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Performs the force merge operation on one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, flush?: bool, ignore_unavailable?: bool, max_num_segments?: int, only_expunge_deletes?: bool, primary_only?: bool, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indexes + * - allow_no_indices: Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes `_all` string or when no indexes have been specified) + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - flush: Specify whether the index should be flushed after performing the operation. (Default: true) + * - ignore_unavailable: Whether specified concrete indexes should be ignored when unavailable (missing or closed) + * - max_num_segments: The number of larger segments into which smaller segments are merged. Set this parameter to 1 to merge all segments into one segment. The default behavior is to perform the merge as necessary. + * - only_expunge_deletes: Specify whether the operation should only expunge deleted documents + * - primary_only: Specify whether the operation should only perform on primary shards. Defaults to false. (Default: false) + * - wait_for_completion: Should the request wait until the force merge is completed. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function forcemerge(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(ForceMerge::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, flat_settings?: bool, ignore_unavailable?: bool, include_defaults?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard expressions (*) are supported. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. (Default: false) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - ignore_unavailable: If `false`, requests that target a missing index return an error. (Default: false) + * - include_defaults: If `true`, return all default settings in the response. (Default: false) + * - local: If `true`, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the cluster-manager node. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns an alias. + * + * @param array{name?: mixed, index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, local?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. + * - index: A comma-separated list of data streams or indexes used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAlias(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetAlias::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns data streams. + * + * @param array{name?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are returned. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getDataStream(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetDataStream::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Returns mapping for one or more fields. + * + * @param array{fields?: mixed, index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, include_defaults?: bool, local?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - fields: A comma-separated list or wildcard expression of fields used to limit returned information. + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - include_defaults: If `true`, return all default settings in the response. + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getFieldMapping(array $params = []) + { + $fields = $this->extractArgument($params, 'fields'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetFieldMapping::class); + $endpoint->setParams($params); + $endpoint->setFields($fields); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns an index template. + * + * @param array{name?: mixed, cluster_manager_timeout?: string, flat_settings?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the index template to retrieve. Wildcard (*) expressions are supported. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - local: If `true`, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the cluster-manager node. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getIndexTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetIndexTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Returns mappings for one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, ignore_unavailable?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getMapping(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetMapping::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns settings for one or more indexes. + * + * @param array{name?: mixed, index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, flat_settings?: bool, ignore_unavailable?: bool, include_defaults?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list or wildcard expression of settings to retrieve. + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with `bar`. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - include_defaults: If `true`, return all default settings in the response. (Default: false) + * - local: If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the cluster-manager node. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSettings(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetSettings::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns an index template. + * + * @param array{name?: mixed, cluster_manager_timeout?: string, flat_settings?: bool, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: A comma-separated list of index template names used to limit the request. Wildcard (`*`) expressions are supported. To return all index templates, omit this parameter or use a value of `_all` or `*`. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - local: If `true`, the request retrieves information from the local node only. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * The `_upgrade` API is no longer useful and will be removed. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * - allow_no_indices: Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes `_all` string or when no indexes have been specified). + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - ignore_unavailable: Whether specified concrete indexes should be ignored when unavailable (missing or closed). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getUpgrade(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetUpgrade::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Opens an index. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, ignore_unavailable?: bool, master_timeout?: string, task_execution_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). By default, you must explicitly name the indexes you using to limit the request. To limit a request using `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to false. You can update this setting in the `opensearch.yml` file or using the cluster update settings API. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - task_execution_timeout: Explicit task execution timeout, only useful when `wait_for_completion` is false, defaults to `1h`. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: Should this request wait until the operation has completed before returning. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function open(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Open::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates an alias. + * + * @param array{name?: string, index?: mixed, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: Alias to update. If the alias doesn't exist, the request creates it. Index alias names support date math. + * - index: A comma-separated list of data streams or indexes to add. Supports wildcards (`*`). Wildcard patterns that match both data streams and indexes return an error. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The settings for the alias, such as `routing` or `filter` + * @return array + */ + public function putAlias(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutAlias::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates an index template. + * + * @param array{name?: string, cause?: string, cluster_manager_timeout?: string, create?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: Index or template name + * - cause: User defined reason for creating/updating the index template. (Default: false) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - create: If `true`, this request cannot replace or update existing index templates. (Default: false) + * - master_timeout: Operation timeout for connection to cluster-manager node. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The template definition (Required) + * @return array + */ + public function putIndexTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutIndexTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the index mappings. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, ignore_unavailable?: bool, master_timeout?: string, timeout?: string, write_index_only?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indexes. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - write_index_only: If `true`, the mappings are applied only to the current write index for the target. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The mapping definition (Required) + * @return array + */ + public function putMapping(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutMapping::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the index settings. + * + * @param array{index?: mixed, allow_no_indices?: bool, cluster_manager_timeout?: string, expand_wildcards?: mixed, flat_settings?: bool, ignore_unavailable?: bool, master_timeout?: string, preserve_existing?: bool, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - flat_settings: If `true`, returns settings in flat format. (Default: false) + * - ignore_unavailable: Whether specified concrete indexes should be ignored when unavailable (missing or closed). + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - preserve_existing: If `true`, existing index settings remain unchanged. (Default: false) + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function putSettings(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutSettings::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates an index template. + * + * @param array{name?: string, cluster_manager_timeout?: string, create?: bool, master_timeout?: string, order?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: The name of the template + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - create: If `true`, this request cannot replace or update existing index templates. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - order: Order in which OpenSearch applies this template if index matches multiple templates. Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The template definition (Required) + * @return array + */ + public function putTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about ongoing index shard recoveries. + * + * @param array{index?: mixed, active_only?: bool, detailed?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - active_only: If `true`, the response only includes ongoing shard recoveries. (Default: false) + * - detailed: If `true`, the response includes detailed information about shard recoveries. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function recovery(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Recovery::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Performs the refresh operation in one or more indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function refresh(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Refresh::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about any matching indexes, aliases, and data streams. + * + * @param array{name?: mixed, expand_wildcards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: Comma-separated name(s) or index pattern(s) of the indexes, aliases, and data streams to resolve. Resources on remote clusters can be specified using the ``:`` syntax. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function resolveIndex(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(ResolveIndex::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Updates an alias to point to a new index when the existing indexis considered to be too large or too old. + * + * @param array{alias?: string, new_index?: string, cluster_manager_timeout?: string, dry_run?: bool, master_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - alias: Name of the data stream or index alias to roll over. + * - new_index: The name of the index to create. Supports date math. Data streams do not support this parameter. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - dry_run: If `true`, checks whether the current index satisfies the specified conditions but does not perform a rollover. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The conditions that needs to be met for executing rollover + * @return array + */ + public function rollover(array $params = []) + { + $alias = $this->extractArgument($params, 'alias'); + $new_index = $this->extractArgument($params, 'new_index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Rollover::class); + $endpoint->setParams($params); + $endpoint->setAlias($alias); + $endpoint->setNewIndex($new_index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Provides low-level information about segments in a Lucene index. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, verbose?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - verbose: If `true`, the request returns a verbose response. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function segments(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Segments::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Provides store information for shard copies of indexes. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, status?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: Limits health reporting to a specific source. Can be a single source or a comma-separated list of sources (comprised of data streams, indexes, and aliases). + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. (Default: false) + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + * - ignore_unavailable: If `true`, missing or closed indexes are not included in the response. (Default: false) + * - status: A list of shard health statuses used to limit the request. (Default: yellow, red) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function shardStores(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(ShardStores::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Allow to shrink an existing index into a new index with fewer primary shards. + * + * @param array{index?: string, target?: string, cluster_manager_timeout?: string, copy_settings?: bool, master_timeout?: string, task_execution_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the source index to shrink. + * - target: Name of the target index to create. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - copy_settings: whether or not to copy settings from the source index. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - task_execution_timeout: Explicit task execution timeout, only useful when `wait_for_completion` is false, defaults to `1h`. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: Should this request wait until the operation has completed before returning. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The configuration for the target index (`settings` and `aliases`) + * @return array + */ + public function shrink(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $target = $this->extractArgument($params, 'target'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Shrink::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setTarget($target); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Simulate matching the given index name against the index templates in the system. + * + * @param array{name?: string, cluster_manager_timeout?: string, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: Index or template name to simulate + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: New index template definition, which will be included in the simulation, as if it already exists in the system + * @return array + */ + public function simulateIndexTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SimulateIndexTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Simulate resolving the given template name or body. + * + * @param array{name?: string, cause?: string, cluster_manager_timeout?: string, create?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: The name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template configuration in the request body. + * - cause: User defined reason for dry-run creating the new template for simulation purposes. (Default: false) + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - create: If `true`, the template passed in the body is only used if no existing templates match the same index patterns. If `false`, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function simulateTemplate(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SimulateTemplate::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Allows you to split an existing index into a new index with more primary shards. + * + * @param array{index?: string, target?: string, cluster_manager_timeout?: string, copy_settings?: bool, master_timeout?: string, task_execution_timeout?: string, timeout?: string, wait_for_active_shards?: mixed, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Name of the source index to split. + * - target: Name of the target index to create. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - copy_settings: whether or not to copy settings from the source index. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - task_execution_timeout: Explicit task execution timeout, only useful when `wait_for_completion` is false, defaults to `1h`. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). + * - wait_for_completion: Should this request wait until the operation has completed before returning. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The configuration for the target index (`settings` and `aliases`) + * @return array + */ + public function split(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $target = $this->extractArgument($params, 'target'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Split::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setTarget($target); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Provides statistics on operations happening in an index. + * + * @param array{metric?: mixed, index?: mixed, completion_fields?: mixed, expand_wildcards?: mixed, fielddata_fields?: mixed, fields?: mixed, forbid_closed_indices?: bool, groups?: mixed, include_segment_file_sizes?: bool, include_unloaded_segments?: bool, level?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - metric: Limit the information returned the specific metrics. + * - index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indexes + * - completion_fields: A comma-separated list or wildcard expressions of fields to include in field data and suggest statistics. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. + * - fielddata_fields: A comma-separated list or wildcard expressions of fields to include in field data statistics. + * - fields: A comma-separated list or wildcard expressions of fields to include in the statistics. + * - forbid_closed_indices: If `true`, statistics are not collected from closed indexes. (Default: true) + * - groups: A comma-separated list of search groups to include in the search statistics. + * - include_segment_file_sizes: If `true`, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). (Default: false) + * - include_unloaded_segments: If `true`, the response includes information from segments that are not loaded into memory. (Default: false) + * - level: Indicates whether statistics are aggregated at the cluster, index, or shard level. (Options: cluster, indices, shards) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + $metric = $this->extractArgument($params, 'metric'); + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setMetric($metric); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Updates index aliases. + * + * @param array{cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The definition of `actions` to perform (Required) + * @return array + */ + public function updateAliases(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateAliases::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * The `_upgrade` API is no longer useful and will be removed. + * + * @param array{index?: mixed, allow_no_indices?: bool, expand_wildcards?: mixed, ignore_unavailable?: bool, only_ancient_segments?: bool, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * - allow_no_indices: Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes `_all` string or when no indexes have been specified). + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - ignore_unavailable: Whether specified concrete indexes should be ignored when unavailable (missing or closed). + * - only_ancient_segments: If `true`, only ancient (an older Lucene major release) segments will be upgraded. + * - wait_for_completion: Should this request wait until the operation has completed before returning. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function upgrade(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Upgrade::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Allows a user to validate a potentially expensive query without executing it. + * + * @param array{index?: mixed, all_shards?: bool, allow_no_indices?: bool, analyze_wildcard?: bool, analyzer?: string, default_operator?: mixed, df?: string, expand_wildcards?: mixed, explain?: bool, ignore_unavailable?: bool, lenient?: bool, q?: string, rewrite?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (`*`). To search all data streams or indexes, omit this parameter or use `*` or `_all`. + * - all_shards: If `true`, the validation is executed on all shards instead of one random shard per index. + * - allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. + * - analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. (Default: false) + * - analyzer: Analyzer to use for the query string. This parameter can only be used when the `q` query string parameter is specified. + * - default_operator: The default operator for query string query: `AND` or `OR`. (Options: and, AND, or, OR) + * - df: Field to use as default where no field prefix is given in the query string. This parameter can only be used when the `q` query string parameter is specified. + * - expand_wildcards: Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + * - explain: If `true`, the response returns detailed information if an error has occurred. + * - ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. + * - lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. + * - q: Query in the Lucene query string syntax. + * - rewrite: If `true`, returns a more detailed explanation showing the actual Lucene query that will be executed. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The query definition specified with the Query DSL + * @return array + */ + public function validateQuery(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ValidateQuery::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Alias function to getAlias() + * + * @deprecated added to prevent BC break introduced in 7.2.0 + * @see https://github.com/elastic/elasticsearch-php/issues/940 + */ + public function getAliases(array $params = []) + { + return $this->getAlias($params); + } + /** + * $params['index'] = (list) A comma-separated list of index names to refresh analyzers for + * + * @param array $params Associative array of parameters + * @return array + */ + public function refreshSearchAnalyzers(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(RefreshSearchAnalyzers::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestNamespace.php new file mode 100644 index 0000000..ba56187 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestNamespace.php @@ -0,0 +1,165 @@ +extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeletePipeline::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns an ingest pipeline. + * + * @param array{id?: string, cluster_manager_timeout?: string, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: A comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions are supported. To get all ingest pipelines, omit this parameter or use `*`. (Required) + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPipeline(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetPipeline::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns a list of built-in grok patterns. + * + * @param array{s?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - s: Determines how to sort returned grok patterns by key name. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function processorGrok(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ProcessorGrok::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates an ingest pipeline. + * + * @param array{id?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The ID of the ingest pipeline. (Required) + * - cluster_manager_timeout: The amount of time allowed to establish a connection to the cluster manager node. + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - timeout: The amount of time to wait for a response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The ingest definition. (Required) + * @return array + */ + public function putPipeline(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutPipeline::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Simulates an ingest pipeline with example documents. + * + * @param array{id?: string, verbose?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The pipeline to test. If you don't specify a `pipeline` in the request body, this parameter is required. (Required) + * - verbose: When `true`, the response includes output data for each processor in the pipeline (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The simulate definition (Required) + * @return array + */ + public function simulate(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Simulate::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestionNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestionNamespace.php new file mode 100644 index 0000000..1f1a6b3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IngestionNamespace.php @@ -0,0 +1,108 @@ +extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(GetState::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Use this API to pause ingestion for a given index. + * + * @param array{index?: string, cluster_manager_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: Index for which ingestion should be paused. + * - cluster_manager_timeout: Time to wait for cluster manager connection. + * - timeout: Timeout for the request. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function pause(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Pause::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Use this API to resume ingestion for the given index. + * + * @param array{index?: string, cluster_manager_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: Index for which ingestion should be resumed. + * - cluster_manager_timeout: Time to wait for cluster manager connection. + * - timeout: Timeout for the request. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function resume(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Resume::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/InsightsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/InsightsNamespace.php new file mode 100644 index 0000000..48ccf61 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/InsightsNamespace.php @@ -0,0 +1,47 @@ +endpointFactory->getEndpoint(TopQueries::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IsmNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IsmNamespace.php new file mode 100644 index 0000000..c0fbaa4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/IsmNamespace.php @@ -0,0 +1,334 @@ +extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(AddPolicy::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the managed index policy to a new policy. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function changePolicy(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ChangePolicy::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a policy. + * + * @param array{policy_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deletePolicy(array $params = []) + { + $policy_id = $this->extractArgument($params, 'policy_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyId($policy_id); + + return $this->performRequest($endpoint); + } + + /** + * Checks for the existence of a policy. + * + * @param array{policy_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return bool + */ + public function existsPolicy(array $params = []): bool + { + $policy_id = $this->extractArgument($params, 'policy_id'); + // Legacy option to manually make this verbose so we can check status code. + // @todo remove in 3.0.0 + $params['client']['verbose'] = true; + + $endpoint = $this->endpointFactory->getEndpoint(ExistsPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyId($policy_id); + + return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); + } + + /** + * Retrieves the currently applied policy on the specified indexes. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function explainPolicy(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the policies. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPolicies(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a specific policy. + * + * @param array{policy_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPolicy(array $params = []) + { + $policy_id = $this->extractArgument($params, 'policy_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyId($policy_id); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates policies. + * + * @param array{if_primary_term?: int|float, if_seq_no?: int, policyID?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - policyID: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putPolicies(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutPolicies::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates a policy. + * + * @param array{policy_id?: string, if_primary_term?: int|float, if_seq_no?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - policy_id: + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putPolicy(array $params = []) + { + $policy_id = $this->extractArgument($params, 'policy_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyId($policy_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Refreshes search analyzers in real time. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function refreshSearchAnalyzers(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(RefreshSearchAnalyzers::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Removes a policy from an index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function removePolicy(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(RemovePolicy::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Retries the failed action for an index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function retryIndex(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RetryIndex::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/KnnNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/KnnNamespace.php new file mode 100644 index 0000000..989bfd0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/KnnNamespace.php @@ -0,0 +1,220 @@ +extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + + /** + * Used to retrieve information about models present in the cluster. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - model_id: The id of the model. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + + /** + * Use an OpenSearch query to search for models in the index. + * + * @param array{_source?: mixed, _source_excludes?: mixed, _source_includes?: mixed, allow_no_indices?: bool, allow_partial_search_results?: bool, analyze_wildcard?: bool, analyzer?: string, batched_reduce_size?: int, ccs_minimize_roundtrips?: bool, default_operator?: mixed, df?: string, docvalue_fields?: mixed, expand_wildcards?: mixed, explain?: bool, from?: int, ignore_throttled?: bool, ignore_unavailable?: bool, lenient?: bool, max_concurrent_shard_requests?: int, pre_filter_shard_size?: int, preference?: string, q?: string, request_cache?: bool, rest_total_hits_as_int?: bool, routing?: mixed, scroll?: string, search_type?: mixed, seq_no_primary_term?: bool, size?: int, sort?: mixed, stats?: mixed, stored_fields?: mixed, suggest_field?: string, suggest_mode?: mixed, suggest_size?: int, suggest_text?: string, terminate_after?: int, timeout?: string, track_scores?: bool, track_total_hits?: bool, typed_keys?: bool, version?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - _source: Set to `true` or `false` to return the `_source` field or not, or a list of fields to return. + * - _source_excludes: List of fields to exclude from the returned `_source` field. + * - _source_includes: List of fields to extract and return from the `_source` field. + * - allow_no_indices: Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes `_all` string or when no indexes have been specified). + * - allow_partial_search_results: Indicate if an error should be returned if there is a partial search failure or timeout. (Default: true) + * - analyze_wildcard: Specify whether wildcard and prefix queries should be analyzed. (Default: false) + * - analyzer: The analyzer to use for the query string. + * - batched_reduce_size: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. (Default: 512) + * - ccs_minimize_roundtrips: Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution. (Default: true) + * - default_operator: The default operator for query string query (AND or OR). (Options: and, AND, or, OR) + * - df: The field to use as default where no field prefix is given in the query string. + * - docvalue_fields: A comma-separated list of fields to return as the docvalue representation of a field for each hit. + * - expand_wildcards: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + * - explain: Specify whether to return detailed information about score computation as part of a hit. + * - from: Starting offset. (Default: 0) + * - ignore_throttled: Whether specified concrete, expanded or aliased indexes should be ignored when throttled. + * - ignore_unavailable: Whether specified concrete indexes should be ignored when unavailable (missing or closed). + * - lenient: Specify whether format-based query failures (such as providing text to a numeric field) should be ignored. + * - max_concurrent_shard_requests: The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. (Default: 5) + * - pre_filter_shard_size: Threshold that enforces a pre-filter round-trip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter round-trip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method, that is if date filters are mandatory to match but the shard bounds and the query are disjoint. + * - preference: Specify the node or shard the operation should be performed on. (Default: random) + * - q: Query in the Lucene query string syntax. + * - request_cache: Specify if request cache should be used for this request or not, defaults to index level setting. + * - rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. (Default: false) + * - routing: A comma-separated list of specific routing values. + * - scroll: Specify how long a consistent view of the index should be maintained for scrolled search. + * - search_type: Search operation type. + * - seq_no_primary_term: Specify whether to return sequence number and primary term of the last modification of each hit. + * - size: Number of hits to return. (Default: 10) + * - sort: A comma-separated list of : pairs. + * - stats: Specific 'tag' of the request for logging and statistical purposes. + * - stored_fields: A comma-separated list of stored fields to return. + * - suggest_field: Specify which field to use for suggestions. + * - suggest_mode: Specify suggest mode. (Options: always, missing, popular) + * - suggest_size: How many suggestions to return in response. + * - suggest_text: The source text for which the suggestions should be returned. + * - terminate_after: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * - timeout: Operation timeout. + * - track_scores: Whether to calculate and return scores even if they are not used for sorting. + * - track_total_hits: Indicate if the number of documents that match the query should be tracked. + * - typed_keys: Specify whether aggregation and suggester names should be prefixed by their respective types in the response. + * - version: Whether to return document version as part of a hit. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchModels(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchModels::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Provides information about the current status of the k-NN plugin. + * + * @param array{node_id?: mixed, stat?: mixed, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. + * - stat: A comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats. + * - timeout: Operation timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + + /** + * Create and train a model that can be used for initializing k-NN native library indexes during indexing. + * + * @param array{model_id?: string, preference?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: The id of the model. + * - preference: Preferred node to execute training. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function trainModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(TrainModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Preloads native library files into memory, reducing initial search latency for specified indexes. + * + * @param array{index?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function warmup(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Warmup::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ListNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ListNamespace.php new file mode 100644 index 0000000..c47a04c --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ListNamespace.php @@ -0,0 +1,125 @@ +endpointFactory->getEndpoint(Help::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns paginated information about indexes including number of primaries and replicas, document counts, disk size. + * + * @param array{index?: mixed, bytes?: mixed, cluster_manager_timeout?: string, expand_wildcards?: mixed, format?: string, h?: mixed, health?: mixed, help?: bool, include_unloaded_segments?: bool, local?: bool, master_timeout?: string, next_token?: array, pri?: bool, s?: mixed, size?: int, sort?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - bytes: The unit used to display byte values. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - expand_wildcards: The type of index that wildcard patterns can match. + * - format: A short version of the Accept header, such as `JSON`, `YAML`. + * - h: A comma-separated list of column names to display. + * - health: The health status used to limit returned indexes. By default, the response includes indexes of any health status. + * - help: Return help information. (Default: false) + * - include_unloaded_segments: If `true`, the response includes information from segments that are not loaded into memory. (Default: false) + * - local: Return local information, do not retrieve the state from cluster-manager node. (Default: false) + * - master_timeout: Operation timeout for connection to cluster-manager node. + * - next_token: Token to retrieve next page of indexes. + * - pri: If `true`, the response only includes information from primary shards. (Default: false) + * - s: A comma-separated list of column names or column aliases to sort by. + * - size: Maximum number of indexes to be displayed in a page. + * - sort: Defines order in which indexes will be displayed. Accepted values are `asc` and `desc`. If `desc`, most recently created indexes would be displayed first. (Options: asc, desc) + * - time: The unit used to display time values. + * - v: Verbose mode. Display column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function indices(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Indices::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Returns paginated details of shard allocation on nodes. + * + * @param array{index?: mixed, bytes?: mixed, cluster_manager_timeout?: string, format?: string, h?: mixed, help?: bool, local?: bool, master_timeout?: string, next_token?: array, s?: mixed, size?: int, sort?: mixed, time?: mixed, v?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * - bytes: The unit used to display byte values. + * - cluster_manager_timeout: Operation timeout for connection to cluster-manager node. + * - format: A short version of the Accept header, such as `JSON`, `YAML`. + * - h: A comma-separated list of column names to display. + * - help: Return help information. (Default: false) + * - local: Return local information, do not retrieve the state from cluster-manager node. (Default: false) + * - master_timeout: Operation timeout for connection to cluster-manager node. + * - next_token: Token to retrieve next page of shards. + * - s: A comma-separated list of column names or column aliases to sort by. + * - size: Maximum number of shards to be displayed in a page. + * - sort: Defines order in which shards will be displayed. Accepted values are `asc` and `desc`. If `desc`, most recently created shards would be displayed first. (Options: asc, desc) + * - time: The unit in which to display time values. + * - v: Verbose mode. Display column headers. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function shards(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Shards::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/LtrNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/LtrNamespace.php new file mode 100644 index 0000000..14eca40 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/LtrNamespace.php @@ -0,0 +1,729 @@ +extractArgument($params, 'name'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(AddFeaturesToSet::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Add features to an existing feature set in the default feature store. + * + * @param array{name?: string, query?: string, store?: string, merge?: bool, routing?: string, version?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the feature set to add features to. + * - query: Query string to filter existing features from the store by name. When provided, only features matching this query will be added to the feature set, and no request body should be included. + * - store: The name of the feature store. + * - merge: Whether to merge the feature list or append only. (Default: false) + * - routing: Specific routing value. + * - version: Version check to ensure feature set is modified with expected version. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function addFeaturesToSetByQuery(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $query = $this->extractArgument($params, 'query'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(AddFeaturesToSetByQuery::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setQuery($query); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves cache statistics for all feature stores. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function cacheStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(CacheStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Clears the store caches. + * + * @param array{store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store for which to clear the cache. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function clearCache(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(ClearCache::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Creates the default feature store. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function createDefaultStore(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(CreateDefaultStore::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Create or update a feature in the default feature store. + * + * @param array{id?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The name of the feature. (Required) + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createFeature(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateFeature::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create or update a feature set in the default feature store. + * + * @param array{id?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The name of the feature set. (Required) + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createFeatureset(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateFeatureset::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create or update a model in the default feature store. + * + * @param array{id?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The name of the model. (Required) + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createModel(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateModel::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create a model from an existing feature set in the default feature store. + * + * @param array{name?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: The name of the feature set to use for creating the model. + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createModelFromSet(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateModelFromSet::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a new feature store with the specified name. + * + * @param array{store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function createStore(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateStore::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the default feature store. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteDefaultStore(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteDefaultStore::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Delete a feature from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the feature. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteFeature(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteFeature::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Delete a feature set from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the feature set. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteFeatureset(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteFeatureset::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Delete a model from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the model. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteModel(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteModel::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a feature store with the specified name. + * + * @param array{store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteStore(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteStore::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Get a feature from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the feature. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getFeature(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(GetFeature::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Get a feature set from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the feature set. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getFeatureset(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(GetFeatureset::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Get a model from the default feature store. + * + * @param array{id?: string, store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The name of the model. (Required) + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getModel(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(GetModel::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Checks if a store exists. + * + * @param array{store?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStore(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(GetStore::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Lists all available feature stores. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function listStores(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListStores::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Search for features in a feature store. + * + * @param array{store?: string, from?: int, prefix?: string, size?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - from: The offset from the first result (for pagination). (Default: 0) + * - prefix: A name prefix to filter features by. + * - size: The number of features to return. (Default: 20) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function searchFeatures(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchFeatures::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Search for feature sets in a feature store. + * + * @param array{store?: string, from?: int, prefix?: string, size?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - from: The offset from the first result (for pagination). (Default: 0) + * - prefix: A name prefix to filter feature sets by. + * - size: The number of feature sets to return. (Default: 20) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function searchFeaturesets(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchFeaturesets::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Search for models in a feature store. + * + * @param array{store?: string, from?: int, prefix?: string, size?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - store: The name of the feature store. + * - from: The offset from the first result (for pagination). (Default: 0) + * - prefix: A name prefix to filter models by. + * - size: The number of models to return. (Default: 20) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function searchModels(array $params = []) + { + $store = $this->extractArgument($params, 'store'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchModels::class); + $endpoint->setParams($params); + $endpoint->setStore($store); + + return $this->performRequest($endpoint); + } + + /** + * Provides information about the current status of the LTR plugin. + * + * @param array{node_id?: mixed, stat?: mixed, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. + * - stat: A comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats. + * - timeout: The time in milliseconds to wait for a response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + + /** + * Update a feature in the default feature store. + * + * @param array{id?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The name of the feature. (Required) + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateFeature(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateFeature::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a feature set in the default feature store. + * + * @param array{id?: string, store?: string, routing?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The name of the feature set. (Required) + * - store: The name of the feature store. + * - routing: Specific routing value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateFeatureset(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $store = $this->extractArgument($params, 'store'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateFeatureset::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setStore($store); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MlNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MlNamespace.php new file mode 100644 index 0000000..35a93ac --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MlNamespace.php @@ -0,0 +1,1964 @@ +extractArgument($params, 'memory_container_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(AddAgenticMemory::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Uploads model chunk. + * + * @param array{chunk_number?: int, model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - chunk_number: + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function chunkModel(array $params = []) + { + $chunk_number = $this->extractArgument($params, 'chunk_number'); + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ChunkModel::class); + $endpoint->setParams($params); + $endpoint->setChunkNumber($chunk_number); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a controller. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createController(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateController::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create a memory. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createMemory(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateMemory::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create a memory container. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createMemoryContainer(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateMemoryContainer::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create session in a memory container. + * + * @param array{memory_container_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_container_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createMemoryContainerSession(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateMemoryContainerSession::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create a message. + * + * @param array{memory_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createMessage(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateMessage::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Registers model metadata. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function createModelMeta(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateModelMeta::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Delete an agent. + * + * @param array{agent_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - agent_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteAgent(array $params = []) + { + $agent_id = $this->extractArgument($params, 'agent_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteAgent::class); + $endpoint->setParams($params); + $endpoint->setAgentId($agent_id); + + return $this->performRequest($endpoint); + } + + /** + * Delete a specific memory by its type and ID. + * + * @param array{id?: string, memory_container_id?: string, type?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - memory_container_id: + * - type: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteAgenticMemory(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $type = $this->extractArgument($params, 'type'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteAgenticMemory::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setType($type); + + return $this->performRequest($endpoint); + } + + /** + * Delete multiple memories using a query to match specific criteria. + * + * @param array{memory_container_id?: string, type?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_container_id: + * - type: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function deleteAgenticMemoryQuery(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteAgenticMemoryQuery::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setType($type); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a controller. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteController(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteController::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + + /** + * Delete a memory. + * + * @param array{memory_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - memory_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteMemory(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteMemory::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + + return $this->performRequest($endpoint); + } + + /** + * Delete a memory container. + * + * @param array{memory_container_id?: string, delete_all_memories?: bool, delete_memories?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - memory_container_id: + * - delete_all_memories: (Default: false) + * - delete_memories: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteMemoryContainer(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteMemoryContainer::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a model. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteModel(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteModel::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a model group. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteModelGroup(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteModelGroup::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a task. + * + * @param array{task_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - task_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteTask(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteTask::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Execute an agent. + * + * @param array{agent_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - agent_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function executeAgent(array $params = []) + { + $agent_id = $this->extractArgument($params, 'agent_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ExecuteAgent::class); + $endpoint->setParams($params); + $endpoint->setAgentId($agent_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Execute an agent in streaming mode. + * + * @param array{agent_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - agent_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function executeAgentStream(array $params = []) + { + $agent_id = $this->extractArgument($params, 'agent_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ExecuteAgentStream::class); + $endpoint->setParams($params); + $endpoint->setAgentId($agent_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Execute an algorithm. + * + * @param array{algorithm_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - algorithm_name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function executeAlgorithm(array $params = []) + { + $algorithm_name = $this->extractArgument($params, 'algorithm_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ExecuteAlgorithm::class); + $endpoint->setParams($params); + $endpoint->setAlgorithmName($algorithm_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Execute a tool. + * + * @param array{tool_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - tool_name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function executeTool(array $params = []) + { + $tool_name = $this->extractArgument($params, 'tool_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ExecuteTool::class); + $endpoint->setParams($params); + $endpoint->setToolName($tool_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Get an agent. + * + * @param array{agent_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - agent_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAgent(array $params = []) + { + $agent_id = $this->extractArgument($params, 'agent_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetAgent::class); + $endpoint->setParams($params); + $endpoint->setAgentId($agent_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a specific memory by its type and ID. + * + * @param array{id?: string, memory_container_id?: string, type?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - memory_container_id: + * - type: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAgenticMemory(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $type = $this->extractArgument($params, 'type'); + + $endpoint = $this->endpointFactory->getEndpoint(GetAgenticMemory::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setType($type); + + return $this->performRequest($endpoint); + } + + /** + * Get all memories. + * + * @param array{max_results?: int, next_token?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - max_results: + * - next_token: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllMemories(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAllMemories::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Get all messages in a memory. + * + * @param array{memory_id?: string, max_results?: int, next_token?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - memory_id: + * - max_results: + * - next_token: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllMessages(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetAllMessages::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + + return $this->performRequest($endpoint); + } + + /** + * Get tools. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllTools(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAllTools::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a controller. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getController(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetController::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a memory. + * + * @param array{memory_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - memory_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getMemory(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetMemory::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a memory container. + * + * @param array{memory_container_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - memory_container_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getMemoryContainer(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetMemoryContainer::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a message. + * + * @param array{message_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - message_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getMessage(array $params = []) + { + $message_id = $this->extractArgument($params, 'message_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetMessage::class); + $endpoint->setParams($params); + $endpoint->setMessageId($message_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a message traces. + * + * @param array{message_id?: string, max_results?: int, next_token?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - message_id: + * - max_results: + * - next_token: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getMessageTraces(array $params = []) + { + $message_id = $this->extractArgument($params, 'message_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetMessageTraces::class); + $endpoint->setParams($params); + $endpoint->setMessageId($message_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a model group. + * + * @param array{model_group_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - model_group_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getModelGroup(array $params = []) + { + $model_group_id = $this->extractArgument($params, 'model_group_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetModelGroup::class); + $endpoint->setParams($params); + $endpoint->setModelGroupId($model_group_id); + + return $this->performRequest($endpoint); + } + + /** + * Get a profile. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function getProfile(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GetProfile::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Get a profile models. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function getProfileModels(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GetProfileModels::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Get a profile tasks. + * + * @param array{task_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - task_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function getProfileTasks(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GetProfileTasks::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Get stats. + * + * @param array{node_id?: string, stat?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: + * - stat: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStats(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a task. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getTask(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetTask::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Get tools. + * + * @param array{tool_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - tool_name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getTool(array $params = []) + { + $tool_name = $this->extractArgument($params, 'tool_name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetTool::class); + $endpoint->setParams($params); + $endpoint->setToolName($tool_name); + + return $this->performRequest($endpoint); + } + + /** + * Deploys a model. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function loadModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(LoadModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + + /** + * Predicts a model. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function predictModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PredictModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Predicts a model in streaming mode. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function predictModelStream(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PredictModelStream::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Register an agent. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function registerAgents(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RegisterAgents::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Registers a model. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function registerModel(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RegisterModel::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Registers a model group. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function registerModelGroup(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RegisterModelGroup::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Registers model metadata. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function registerModelMeta(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(RegisterModelMeta::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search for memories of a specific type within a memory container. + * + * @param array{memory_container_id?: string, type?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_container_id: + * - type: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchAgenticMemory(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchAgenticMemory::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setType($type); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search agents. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchAgents(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchAgents::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Searches for standalone connectors. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchConnectors(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchConnectors::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search memory. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchMemory(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchMemory::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search memory containers. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchMemoryContainer(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchMemoryContainer::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Search messages. + * + * @param array{memory_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchMessage(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchMessage::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Searches for model groups. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchModelGroup(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchModelGroup::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Searches for models. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchModels(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchModels::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Searches for tasks. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function searchTasks(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(SearchTasks::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Trains a model synchronously. + * + * @param array{algorithm_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - algorithm_name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function train(array $params = []) + { + $algorithm_name = $this->extractArgument($params, 'algorithm_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Train::class); + $endpoint->setParams($params); + $endpoint->setAlgorithmName($algorithm_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Trains a model and predicts against the same training dataset. + * + * @param array{algorithm_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - algorithm_name: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function trainPredict(array $params = []) + { + $algorithm_name = $this->extractArgument($params, 'algorithm_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(TrainPredict::class); + $endpoint->setParams($params); + $endpoint->setAlgorithmName($algorithm_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Unloads a model. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function unloadModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UnloadModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a specific memory by its type and ID. + * + * @param array{id?: string, memory_container_id?: string, type?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: (Required) + * - memory_container_id: + * - type: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateAgenticMemory(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateAgenticMemory::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setType($type); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates a standalone connector. + * + * @param array{connector_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - connector_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateConnector(array $params = []) + { + $connector_id = $this->extractArgument($params, 'connector_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateConnector::class); + $endpoint->setParams($params); + $endpoint->setConnectorId($connector_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates a controller. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateController(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateController::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a memory. + * + * @param array{memory_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateMemory(array $params = []) + { + $memory_id = $this->extractArgument($params, 'memory_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateMemory::class); + $endpoint->setParams($params); + $endpoint->setMemoryId($memory_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a memory container. + * + * @param array{memory_container_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - memory_container_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateMemoryContainer(array $params = []) + { + $memory_container_id = $this->extractArgument($params, 'memory_container_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateMemoryContainer::class); + $endpoint->setParams($params); + $endpoint->setMemoryContainerId($memory_container_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Update a message. + * + * @param array{message_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - message_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateMessage(array $params = []) + { + $message_id = $this->extractArgument($params, 'message_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateMessage::class); + $endpoint->setParams($params); + $endpoint->setMessageId($message_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates a model. + * + * @param array{model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateModel(array $params = []) + { + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Uploads model chunk. + * + * @param array{chunk_number?: int, model_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - chunk_number: + * - model_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function uploadChunk(array $params = []) + { + $chunk_number = $this->extractArgument($params, 'chunk_number'); + $model_id = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UploadChunk::class); + $endpoint->setParams($params); + $endpoint->setChunkNumber($chunk_number); + $endpoint->setModelId($model_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Registers a model. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function uploadModel(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UploadModel::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * $params['body'] = (string) The body of the request (Required) + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function createConnector(array $params = []): array + { + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(CreateConnector::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['connector_id'] = (string) The id of the connector (Required) + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function deleteConnector(array $params = []): array + { + $connectorId = $this->extractArgument($params, 'connector_id'); + $endpoint = $this->endpointFactory->getEndpoint(DeleteConnector::class); + $endpoint->setParams($params); + $endpoint->setConnectorId($connectorId); + + return $this->performRequest($endpoint); + } + /** + * $params['model_id'] = (string) The id of the model (Required) + * $params['body'] = (string) The body of the request + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function deployModel(array $params = []): array + { + $modelId = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(DeployModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($modelId); + if ($body) { + $endpoint->setBody($body); + } + + return $this->performRequest($endpoint); + } + /** + * $params['id'] = (string) The id of the connector (Required) + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function getConnector(array $params = []): array + { + $id = $this->extractArgument($params, 'id'); + $connector_id = $this->extractArgument($params, 'connector_id'); + $endpoint = $this->endpointFactory->getEndpoint(GetConnector::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setConnectorId($connector_id); + + return $this->performRequest($endpoint); + } + /** + * $params['body'] = (string) The body of the request + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function getConnectors(array $params = []): array + { + if (!isset($params['body'])) { + $params['body'] = [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(GetConnectors::class); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['body'] = (string) The body of the request + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function getModelGroups(array $params = []): array + { + if (!isset($params['body'])) { + $params['body'] = [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(GetModelGroups::class); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['id'] = (string) The id of the model (Required) + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function getModel(array $params = []): array + { + $id = $this->extractArgument($params, 'id'); + $model_id = $this->extractArgument($params, 'model_id'); + $endpoint = $this->endpointFactory->getEndpoint(GetModel::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setModelId($model_id); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to getModels() to prevent BC break. + * This API will be removed in a future version. Use 'searchModels' API instead. + */ + public function getModels(array $params = []) + { + if (!isset($params['body'])) { + $params['body'] = [ + 'query' => [ + 'match_all' => new \StdClass(), + ], + 'size' => 1000, + ]; + } + + return $this->searchModels($params); + } + /** + * $params['id'] = (string) The id of the model (Required) + * $params['body'] = (string) The body of the request + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function predict(array $params = []): array + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + $algorithm_name = $this->extractArgument($params, 'algorithm_name'); + $model_id = $this->extractArgument($params, 'model_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Predict::class); + $endpoint->setParams($params) + ->setId($id) + ->setBody($body) + ->setAlgorithmName($algorithm_name) + ->setModelId($model_id); + + return $this->performRequest($endpoint); + } + /** + * $params['model_id'] = (string) The id of the model (Required) + * $params['body'] = (string) The body of the request + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function undeployModel(array $params = []): array + { + $modelId = $this->extractArgument($params, 'model_id'); + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(UndeployModel::class); + $endpoint->setParams($params); + $endpoint->setModelId($modelId); + if ($body) { + $endpoint->setBody($body); + } + + return $this->performRequest($endpoint); + } + /** + * $params['id'] = (string) The id of the model group (Required) + * $params['body'] = (array) The body of the request (Required) + * + * @param array $params Associative array of parameters + * + * @return array + * The response. + */ + public function updateModelGroup(array $params = []): array + { + $id = $this->extractArgument($params, 'id'); + $model_group_id = $this->extractArgument($params, 'model_group_id'); + $body = $this->extractArgument($params, 'body'); + $endpoint = $this->endpointFactory->getEndpoint(UpdateModelGroup::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + $endpoint->setId($id); + $endpoint->setModelGroupId($model_group_id); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MonitoringNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MonitoringNamespace.php new file mode 100644 index 0000000..b4a8f04 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/MonitoringNamespace.php @@ -0,0 +1,58 @@ +extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Monitoring\Bulk'); + $endpoint->setParams($params); + $endpoint->setType($type); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NamespaceBuilderInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NamespaceBuilderInterface.php new file mode 100644 index 0000000..4c82be4 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NamespaceBuilderInterface.php @@ -0,0 +1,48 @@ +foo()` + */ + public function getName(): string; + + /** + * Returns the actual namespace object which contains your custom methods. The transport + * and serializer objects are provided so that your namespace may do whatever custom + * logic is required. + * + * @param Transport|TransportInterface $transport + * @param SerializerInterface $serializer + * @return Object + * + * @phpstan-ignore parameter.deprecatedClass + */ + public function getObject(Transport|TransportInterface $transport, SerializerInterface $serializer); +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NeuralNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NeuralNamespace.php new file mode 100644 index 0000000..61ccb32 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NeuralNamespace.php @@ -0,0 +1,58 @@ +extractArgument($params, 'node_id'); + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NodesNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NodesNamespace.php new file mode 100644 index 0000000..ce81e47 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NodesNamespace.php @@ -0,0 +1,188 @@ +extractArgument($params, 'node_id'); + + $endpoint = $this->endpointFactory->getEndpoint(HotThreads::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about nodes in the cluster. + * + * @param array{node_id_or_metric?: mixed, metric?: mixed, node_id?: mixed, flat_settings?: bool, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id_or_metric: Limits the information returned to a list of node IDs or specific metrics. Supports a comma-separated list, such as `node1,node2` or `http,ingest`. + * - metric: Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. + * - node_id: Comma-separated list of node IDs or names used to limit returned information. + * - flat_settings: When `true`, returns settings in flat format. (Default: false) + * - timeout: The amount of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function info(array $params = []) + { + $node_id_or_metric = $this->extractArgument($params, 'node_id_or_metric'); + $metric = $this->extractArgument($params, 'metric'); + $node_id = $this->extractArgument($params, 'node_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Info::class); + $endpoint->setParams($params); + $endpoint->setNodeIdOrMetric($node_id_or_metric); + $endpoint->setMetric($metric); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } + + /** + * Reloads secure settings. + * + * @param array{node_id?: mixed, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - node_id: The names of particular nodes in the cluster to target. + * - timeout: The amount of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: An object containing the password for the OpenSearch keystore. + * @return array + */ + public function reloadSecureSettings(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ReloadSecureSettings::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns statistical information about nodes in the cluster. + * + * @param array{node_id?: mixed, metric?: mixed, index_metric?: mixed, completion_fields?: mixed, fielddata_fields?: mixed, fields?: mixed, groups?: mixed, include_segment_file_sizes?: bool, level?: mixed, timeout?: string, types?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: A comma-separated list of node IDs or names used to limit returned information. + * - metric: Limit the information returned to the specified metrics. + * - index_metric: Limit the information returned for indexes metric to the specified index metrics. It can be used only if indexes (or all) metric is specified. + * - completion_fields: A comma-separated list or wildcard expressions of fields to include in field data and suggest statistics. + * - fielddata_fields: A comma-separated list or wildcard expressions of fields to include in field data statistics. + * - fields: A comma-separated list or wildcard expressions of fields to include in the statistics. + * - groups: A comma-separated list of search groups to include in the search statistics. + * - include_segment_file_sizes: When `true`, reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). (Default: false) + * - level: Indicates whether statistics are aggregated at the cluster, index, or shard level. (Options: cluster, indices, shards) + * - timeout: The amount of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - types: A comma-separated list of document types for the indexing index metric. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stats(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $metric = $this->extractArgument($params, 'metric'); + $index_metric = $this->extractArgument($params, 'index_metric'); + + $endpoint = $this->endpointFactory->getEndpoint(Stats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setMetric($metric); + $endpoint->setIndexMetric($index_metric); + + return $this->performRequest($endpoint); + } + + /** + * Returns low-level information about REST actions usage on nodes. + * + * @param array{node_id?: mixed, metric?: mixed, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * - metric: Limits the information returned to the specific metrics. A comma-separated list of the following options: `_all`, `rest_actions`. + * - timeout: Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function usage(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $metric = $this->extractArgument($params, 'metric'); + + $endpoint = $this->endpointFactory->getEndpoint(Usage::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setMetric($metric); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NotificationsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NotificationsNamespace.php new file mode 100644 index 0000000..dbf8800 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/NotificationsNamespace.php @@ -0,0 +1,278 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateConfig::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Delete a channel configuration. + * + * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - config_id: The ID of the channel configuration to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteConfig(array $params = []) + { + $config_id = $this->extractArgument($params, 'config_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteConfig::class); + $endpoint->setParams($params); + $endpoint->setConfigId($config_id); + + return $this->performRequest($endpoint); + } + + /** + * Delete multiple channel configurations. + * + * @param array{config_id?: string, config_id_list?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - config_id: The ID of the channel configuration to delete. + * - config_id_list: A comma-separated list of channel IDs to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteConfigs(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteConfigs::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Get a specific channel configuration. + * + * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - config_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getConfig(array $params = []) + { + $config_id = $this->extractArgument($params, 'config_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetConfig::class); + $endpoint->setParams($params); + $endpoint->setConfigId($config_id); + + return $this->performRequest($endpoint); + } + + /** + * Get multiple channel configurations with filtering. + * + * @param array{'chime.url'?: string, 'chime.url.keyword'?: string, config_id?: string, config_id_list?: mixed, config_type?: mixed, created_time_ms?: int, description?: string, 'description.keyword'?: string, 'email.email_account_id'?: string, 'email.email_group_id_list'?: string, 'email.recipient_list.recipient'?: string, 'email.recipient_list.recipient.keyword'?: string, 'email_group.recipient_list.recipient'?: string, 'email_group.recipient_list.recipient.keyword'?: string, is_enabled?: bool, last_updated_time_ms?: int, 'microsoft_teams.url'?: string, 'microsoft_teams.url.keyword'?: string, name?: string, 'name.keyword'?: string, query?: string, 'ses_account.from_address'?: string, 'ses_account.from_address.keyword'?: string, 'ses_account.region'?: string, 'ses_account.role_arn'?: string, 'ses_account.role_arn.keyword'?: string, 'slack.url'?: string, 'slack.url.keyword'?: string, 'smtp_account.from_address'?: string, 'smtp_account.from_address.keyword'?: string, 'smtp_account.host'?: string, 'smtp_account.host.keyword'?: string, 'smtp_account.method'?: string, 'sns.role_arn'?: string, 'sns.role_arn.keyword'?: string, 'sns.topic_arn'?: string, 'sns.topic_arn.keyword'?: string, text_query?: string, 'webhook.url'?: string, 'webhook.url.keyword'?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - chime.url: + * - chime.url.keyword: + * - config_id: Notification configuration ID. + * - config_id_list: Notification configuration IDs. + * - config_type: Type of notification configuration. (Options: chime, email, email_group, microsoft_teams, ses_account, slack, smtp_account, sns, webhook) + * - created_time_ms: + * - description: + * - description.keyword: + * - email.email_account_id: + * - email.email_group_id_list: + * - email.recipient_list.recipient: + * - email.recipient_list.recipient.keyword: + * - email_group.recipient_list.recipient: + * - email_group.recipient_list.recipient.keyword: + * - is_enabled: + * - last_updated_time_ms: + * - microsoft_teams.url: + * - microsoft_teams.url.keyword: + * - name: + * - name.keyword: + * - query: + * - ses_account.from_address: + * - ses_account.from_address.keyword: + * - ses_account.region: + * - ses_account.role_arn: + * - ses_account.role_arn.keyword: + * - slack.url: + * - slack.url.keyword: + * - smtp_account.from_address: + * - smtp_account.from_address.keyword: + * - smtp_account.host: + * - smtp_account.host.keyword: + * - smtp_account.method: + * - sns.role_arn: + * - sns.role_arn.keyword: + * - sns.topic_arn: + * - sns.topic_arn.keyword: + * - text_query: + * - webhook.url: + * - webhook.url.keyword: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function getConfigs(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GetConfigs::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * List created notification channels. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function listChannels(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListChannels::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * List supported channel configurations. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function listFeatures(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListFeatures::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Send a test notification. + * + * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - config_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function sendTest(array $params = []) + { + $config_id = $this->extractArgument($params, 'config_id'); + + $endpoint = $this->endpointFactory->getEndpoint(SendTest::class); + $endpoint->setParams($params); + $endpoint->setConfigId($config_id); + + return $this->performRequest($endpoint); + } + + /** + * Update channel configuration. + * + * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - config_id: + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateConfig(array $params = []) + { + $config_id = $this->extractArgument($params, 'config_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateConfig::class); + $endpoint->setParams($params); + $endpoint->setConfigId($config_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ObservabilityNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ObservabilityNamespace.php new file mode 100644 index 0000000..0d6cf0f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ObservabilityNamespace.php @@ -0,0 +1,190 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateObject::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes specific observability object specified by ID. + * + * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - object_id: The ID of the observability object to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteObject(array $params = []) + { + $object_id = $this->extractArgument($params, 'object_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteObject::class); + $endpoint->setParams($params); + $endpoint->setObjectId($object_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes specific observability objects specified by ID or a list of IDs. + * + * @param array{objectId?: string, objectIdList?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - objectId: The ID of a single observability object to delete. + * - objectIdList: A comma-separated list of observability object IDs to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteObjects(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DeleteObjects::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves local stats of all observability objects. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getLocalstats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetLocalstats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves specific observability object specified by ID. + * + * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - object_id: The ID of the observability object to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getObject(array $params = []) + { + $object_id = $this->extractArgument($params, 'object_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetObject::class); + $endpoint->setParams($params); + $endpoint->setObjectId($object_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves list of all observability objects. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function listObjects(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListObjects::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Updates an existing observability object. + * + * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - object_id: The ID of the observability object to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateObject(array $params = []) + { + $object_id = $this->extractArgument($params, 'object_id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateObject::class); + $endpoint->setParams($params); + $endpoint->setObjectId($object_id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/PplNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/PplNamespace.php new file mode 100644 index 0000000..14bafc0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/PplNamespace.php @@ -0,0 +1,127 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves performance metrics for the PPL plugin. + * + * @param array{format?: string, sanitize?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - format: Specifies the response format (JSON, YAML). + * - sanitize: Whether to escape special characters in the results. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves filtered performance metrics for the PPL plugin. + * + * @param array{format?: string, sanitize?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - format: Specifies the response format (JSON, YAML). + * - sanitize: Whether to escape special characters in the results. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function postStats(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PostStats::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Executes a PPL query against OpenSearch indexes. + * + * @param array{format?: string, sanitize?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - format: Specifies the response format (JSON OR YAML). + * - sanitize: Whether to sanitize special characters in the results. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function query(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Query::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/QueryNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/QueryNamespace.php new file mode 100644 index 0000000..d6d777b --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/QueryNamespace.php @@ -0,0 +1,143 @@ +extractArgument($params, 'datasource_name'); + + $endpoint = $this->endpointFactory->getEndpoint(DatasourceDelete::class); + $endpoint->setParams($params); + $endpoint->setDatasourceName($datasource_name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a specific data source by name. + * + * @param array{datasource_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - datasource_name: The name of the data source to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function datasourceRetrieve(array $params = []) + { + $datasource_name = $this->extractArgument($params, 'datasource_name'); + + $endpoint = $this->endpointFactory->getEndpoint(DatasourceRetrieve::class); + $endpoint->setParams($params); + $endpoint->setDatasourceName($datasource_name); + + return $this->performRequest($endpoint); + } + + /** + * Creates a new query data source. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function datasourcesCreate(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesCreate::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a list of all available data sources. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function datasourcesList(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesList::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Updates an existing query data source. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function datasourcesUpdate(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DatasourcesUpdate::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RemoteStoreNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RemoteStoreNamespace.php new file mode 100644 index 0000000..67957c0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RemoteStoreNamespace.php @@ -0,0 +1,52 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Restore::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ReplicationNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ReplicationNamespace.php new file mode 100644 index 0000000..9246bc3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/ReplicationNamespace.php @@ -0,0 +1,296 @@ +endpointFactory->getEndpoint(AutofollowStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Automatically starts the replication on indexes matching a specified pattern. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createReplicationRule(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateReplicationRule::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified replication rule. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function deleteReplicationRule(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteReplicationRule::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves information about any follower (syncing) indexes on a specified cluster. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function followerStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(FollowerStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves information about any replicated leader indexes on a specified cluster. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function leaderStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(LeaderStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Pauses the replication of the leader index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function pause(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Pause::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Resumes replication of the leader index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function resume(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Resume::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Initiates the replication of an index from the leader cluster to the follower cluster. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function start(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Start::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the the status of an index replication. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function status(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpoint = $this->endpointFactory->getEndpoint(Status::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + + /** + * Terminates the replication and converts the follower index to a standard index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function stop(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates any settings on the follower index. + * + * @param array{index?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - index: The name of the data stream, index, or index alias to perform bulk actions on. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateSettings(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateSettings::class); + $endpoint->setParams($params); + $endpoint->setIndex($index); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RollupsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RollupsNamespace.php new file mode 100644 index 0000000..7324a11 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/RollupsNamespace.php @@ -0,0 +1,175 @@ +extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the execution status information for an index rollup job. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The ID of the rollup job. (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function explain(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves an index rollup job configuration by ID. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The ID of the rollup job. (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Creates or updates an index rollup job configuration. + * + * @param array{id?: string, if_primary_term?: int|float, if_seq_no?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: The ID of the rollup job. (Required) + * - if_primary_term: Only performs the operation if the document has the specified primary term. + * - if_seq_no: Only performs the operation if the document has the specified sequence number. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function put(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Put::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Starts the execution of an index rollup job. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The ID of the rollup job. (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function start(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Start::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Stops the execution of an index rollup job. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: The ID of the rollup job. (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stop(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchPipelineNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchPipelineNamespace.php new file mode 100644 index 0000000..a1b7cb1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchPipelineNamespace.php @@ -0,0 +1,106 @@ +extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves information about a specified search pipeline. + * + * @param array{id?: string, cluster_manager_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Comma-separated list of search pipeline ids. Wildcards supported. (Required) + * - cluster_manager_timeout: operation timeout for connection to cluster-manager node. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Creates or replaces the specified search pipeline. + * + * @param array{id?: string, cluster_manager_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: Pipeline ID. (Required) + * - cluster_manager_timeout: operation timeout for connection to cluster-manager node. + * - timeout: Operation timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function put(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Put::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchRelevanceNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchRelevanceNamespace.php new file mode 100644 index 0000000..641503a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchRelevanceNamespace.php @@ -0,0 +1,471 @@ +extractArgument($params, 'experiment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteExperiments::class); + $endpoint->setParams($params); + $endpoint->setExperimentId($experiment_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a specified judgment. + * + * @param array{judgment_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - judgment_id: The judgment id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteJudgments(array $params = []) + { + $judgment_id = $this->extractArgument($params, 'judgment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteJudgments::class); + $endpoint->setParams($params); + $endpoint->setJudgmentId($judgment_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a query set. + * + * @param array{query_set_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - query_set_id: The query set id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteQuerySets(array $params = []) + { + $query_set_id = $this->extractArgument($params, 'query_set_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteQuerySets::class); + $endpoint->setParams($params); + $endpoint->setQuerySetId($query_set_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a specified scheduled experiment. + * + * @param array{experiment_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - experiment_id: The experiment id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteScheduledExperiments(array $params = []) + { + $experiment_id = $this->extractArgument($params, 'experiment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteScheduledExperiments::class); + $endpoint->setParams($params); + $endpoint->setExperimentId($experiment_id); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a specified search configuration. + * + * @param array{search_configuration_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - search_configuration_id: The search configuration id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteSearchConfigurations(array $params = []) + { + $search_configuration_id = $this->extractArgument($params, 'search_configuration_id'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteSearchConfigurations::class); + $endpoint->setParams($params); + $endpoint->setSearchConfigurationId($search_configuration_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets experiments. + * + * @param array{experiment_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - experiment_id: The experiment id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getExperiments(array $params = []) + { + $experiment_id = $this->extractArgument($params, 'experiment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetExperiments::class); + $endpoint->setParams($params); + $endpoint->setExperimentId($experiment_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets judgments. + * + * @param array{judgment_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - judgment_id: The judgment id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getJudgments(array $params = []) + { + $judgment_id = $this->extractArgument($params, 'judgment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetJudgments::class); + $endpoint->setParams($params); + $endpoint->setJudgmentId($judgment_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets stats by node. + * + * @param array{node_id?: string, stat?: string, flat_stat_paths?: string, include_all_nodes?: string, include_individual_nodes?: string, include_info?: string, include_metadata?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: The node id + * - stat: The statistic to return + * - flat_stat_paths: Requests flattened stat paths as keys + * - include_all_nodes: Whether to include all nodes + * - include_individual_nodes: Whether to include individual nodes + * - include_info: Whether to include info + * - include_metadata: Whether to include metadata + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getNodeStats(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(GetNodeStats::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + + /** + * Lists the current query sets available. + * + * @param array{query_set_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - query_set_id: The query set id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getQuerySets(array $params = []) + { + $query_set_id = $this->extractArgument($params, 'query_set_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetQuerySets::class); + $endpoint->setParams($params); + $endpoint->setQuerySetId($query_set_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets the scheduled experiments. + * + * @param array{experiment_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - experiment_id: The experiment id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getScheduledExperiments(array $params = []) + { + $experiment_id = $this->extractArgument($params, 'experiment_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetScheduledExperiments::class); + $endpoint->setParams($params); + $endpoint->setExperimentId($experiment_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets the search configurations. + * + * @param array{search_configuration_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - search_configuration_id: The search configuration id + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSearchConfigurations(array $params = []) + { + $search_configuration_id = $this->extractArgument($params, 'search_configuration_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetSearchConfigurations::class); + $endpoint->setParams($params); + $endpoint->setSearchConfigurationId($search_configuration_id); + + return $this->performRequest($endpoint); + } + + /** + * Gets stats. + * + * @param array{stat?: string, flat_stat_paths?: string, include_all_nodes?: string, include_individual_nodes?: string, include_info?: string, include_metadata?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - stat: The statistic to return + * - flat_stat_paths: Requests flattened stat paths as keys + * - include_all_nodes: Whether to include all nodes + * - include_individual_nodes: Whether to include individual nodes + * - include_info: Whether to include info + * - include_metadata: Whether to include metadata + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStats(array $params = []) + { + $stat = $this->extractArgument($params, 'stat'); + + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); + $endpoint->setParams($params); + $endpoint->setStat($stat); + + return $this->performRequest($endpoint); + } + + /** + * Creates a new query set by sampling queries from the user behavior data. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function postQuerySets(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PostQuerySets::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a scheduled experiment. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function postScheduledExperiments(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PostScheduledExperiments::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates an experiment. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putExperiments(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutExperiments::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a judgment. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putJudgments(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutJudgments::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a new query set by uploading manually. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putQuerySets(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutQuerySets::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a search configuration. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function putSearchConfigurations(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PutSearchConfigurations::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php new file mode 100644 index 0000000..e96c70a --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php @@ -0,0 +1,126 @@ +extractArgument($params, 'index'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchableSnapshots\ClearCache'); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } + /** + * $params['repository'] = (string) The name of the repository containing the snapshot of the index to mount + * $params['snapshot'] = (string) The name of the snapshot of the index to mount + * $params['cluster_manager_timeout'] = (time) Explicit operation timeout for connection to cluster_manager node + * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false) + * $params['body'] = (array) The restore configuration for mounting the snapshot as searchable (Required) + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + */ + public function mount(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchableSnapshots\Mount'); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * $params['repository'] = (string) The repository for which to get the stats for + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + */ + public function repositoryStats(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchableSnapshots\RepositoryStats'); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + /** + * $params['index'] = (list) A comma-separated list of index names + * + * @param array $params Associative array of parameters + * @return array + + * + * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release + * + */ + public function stats(array $params = []) + { + $index = $this->extractArgument($params, 'index'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('SearchableSnapshots\Stats'); + $endpoint->setParams($params); + $endpoint->setIndex($index); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityAnalyticsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityAnalyticsNamespace.php new file mode 100644 index 0000000..28e0162 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityAnalyticsNamespace.php @@ -0,0 +1,118 @@ +endpointFactory->getEndpoint(GetAlerts::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieve findings related to a specific detector type or detector ID. + * + * @param array{detectionType?: mixed, detectorType?: string, detector_id?: string, endTime?: string, findingIds?: string, missing?: string, searchString?: string, severity?: mixed, size?: int, sortOrder?: mixed, sortString?: string, startIndex?: int, startTime?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - detectionType: The detection type that dictates the retrieval type for the findings. When the detection type is `threat`, it fetches threat intelligence feeds. When the detection type is `rule`, findings are fetched based on the detector’s rule. Optional. (Options: rule, threat) + * - detectorType: The type of detector used to fetch alerts. Optional when the `detector_id` is specified. Otherwise required. + * - detector_id: The ID of the detector used to fetch alerts. Optional when the `detectorType` is specified. Otherwise required. + * - endTime: The end timestamp (in ms) of the time window in which you want to retrieve findings. Optional. + * - findingIds: The comma-separated id list of findings for which you want retrieve details. Optional. + * - missing: Used to sort by whether the field `missing` exists or not in the documents associated with the finding. Optional. + * - searchString: The finding attribute you want returned in the search. To search in a specific index, specify the index name in the request path. For example, to search findings in the indexABC index, use `searchString=indexABC’. Optional. + * - severity: The rule severity for which retrieve findings. Severity can be `critical`, `high`, `medium`, or `low`. Optional. (Options: critical, high, low, medium) + * - size: The maximum number of results returned in the response. Optional. (Default: 20) + * - sortOrder: The order used to sort the list of findings. Possible values are `asc` or `desc`. Optional. (Options: asc, desc) + * - sortString: The string used by the Alerting plugin to sort the findings. Optional. (Default: timestamp) + * - startIndex: The pagination index. Optional. (Default: 0) + * - startTime: The beginning timestamp (in ms) of the time window in which you want to retrieve findings. Optional. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getFindings(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetFindings::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * List correlations for a finding. + * + * @param array{detector_type?: string, finding?: string, nearby_findings?: int, time_window?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - detector_type: The log type of findings you want to correlate with the specified finding. Required. + * - finding: The finding ID for which you want to find other findings that are correlated. Required. + * - nearby_findings: The number of nearby findings you want to return. Optional. (Default: 10) + * - time_window: The time window (in ms) in which all of the correlations must have occurred together. Optional. (Default: 300000) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function searchFindingCorrelations(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(SearchFindingCorrelations::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityNamespace.php new file mode 100644 index 0000000..81ec80f --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SecurityNamespace.php @@ -0,0 +1,2026 @@ +endpointFactory->getEndpoint(Authinfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns the authorization token for the current user. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function authtoken(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Authtoken::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Not supported for the Cache API. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function cache(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Cache::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Checks whether or not an upgrade can be performed and which security resources can be updated. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function configUpgradeCheck(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ConfigUpgradeCheck::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Assists the cluster operator with upgrading missing default values and stale default definitions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function configUpgradePerform(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(ConfigUpgradePerform::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or replaces APIs permitted for users on the allow list. Requires a super admin certificate or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createAllowlist(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateAllowlist::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or replaces the multi-tenancy configuration. Requires super admin or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createUpdateTenancyConfig(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateUpdateTenancyConfig::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates or replaces the specified user. Legacy API. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - username: The name of the user to create. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function createUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateUserLegacy::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified action group. + * + * @param array{action_group?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - action_group: The name of the action group to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteActionGroup::class); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + + return $this->performRequest($endpoint); + } + + /** + * Deletes all distinguished names in the specified cluster or node allowlist. Requires super admin or REST API permissions. + * + * @param array{cluster_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_name: The cluster name to delete from list of distinguished names. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteDistinguishedName::class); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified role. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - role: The name of the role to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteRole::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified role mapping. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - role: The name of the role for which to delete the role's mappings. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteRoleMapping::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified tenant. + * + * @param array{tenant?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - tenant: The name of the tenant to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteTenant::class); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified internal user. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteUser::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Delete the specified user. Legacy API. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteUserLegacy::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Flushes the Security plugin's user, authentication, and authorization cache. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function flushCache(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(FlushCache::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Generates a `On-Behalf-Of` token for the current user. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function generateOboToken(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(GenerateOboToken::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Generates an authorization token for the specified user. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user for whom to issue an authorization token. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function generateUserToken(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(GenerateUserToken::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Generates authorization token for the given user. Legacy API. Not Implemented. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user for whom to issue an authorization token. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function generateUserTokenLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(GenerateUserTokenLegacy::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Returns account information for the current user. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAccountDetails(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAccountDetails::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves one action group. + * + * @param array{action_group?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - action_group: The name of the action group to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroup::class); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the cluster security certificates. + * + * @param array{cert_type?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cert_type: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from all nodes. + * - timeout: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllCertificates(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAllCertificates::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the current list of allowed APIs accessible to a normal user. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAllowlist(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAllowlist::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the audit configuration. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getAuditConfiguration(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetAuditConfiguration::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the cluster security certificates. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getCertificates(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetCertificates::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Returns the current Security plugin configuration in a JSON format. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getConfiguration(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetConfiguration::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the current values for dynamic security settings for OpenSearch Dashboards. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getDashboardsInfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetDashboardsInfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves all node distinguished names. Requires super admin or REST API permissions. + * + * @param array{cluster_name?: string, show_all?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - cluster_name: The name of the cluster to retrieve that cluster's nodes DN settings. + * - show_all: Whether to include or exclude any static node's DN settings from the final result. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedName::class); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the specified node's security certificates. + * + * @param array{node_id?: string, cert_type?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - node_id: The node ID to retrieve certificates for. + * - cert_type: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from a node. + * - timeout: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getNodeCertificates(array $params = []) + { + $node_id = $this->extractArgument($params, 'node_id'); + + $endpoint = $this->endpointFactory->getEndpoint(GetNodeCertificates::class); + $endpoint->setParams($params); + $endpoint->setNodeId($node_id); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the evaluated REST API permissions for the currently logged in user. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPermissionsInfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetPermissionsInfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves one role. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - role: The name of the role to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + + $endpoint = $this->endpointFactory->getEndpoint(GetRole::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the specified role mapping. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - role: The name of the role mapping to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMapping::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves information about the SSL configuration. + * + * @param array{show_dn?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - show_dn: Whether to include all domain names in the response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getSslinfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetSslinfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the multi-tenancy configuration. Requires super admin or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getTenancyConfig(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetTenancyConfig::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the specified tenant. + * + * @param array{tenant?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - tenant: The name of the tenant to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + + $endpoint = $this->endpointFactory->getEndpoint(GetTenant::class); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + + return $this->performRequest($endpoint); + } + + /** + * Retrieve information about the specified internal user. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(GetUser::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Retrieve one user. Legacy API. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - username: The name of the user to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpoint = $this->endpointFactory->getEndpoint(GetUserLegacy::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + + return $this->performRequest($endpoint); + } + + /** + * Retrieve all internal users. Legacy API. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getUsersLegacy(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetUsersLegacy::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Checks to see if the Security plugin is running. + * + * @param array{mode?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - mode: A flag that determines whether to consider the security status before returning a response for a health query response. For example, `strict` mode indicates service should check the Security plugin status. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function health(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Health::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Migrates the security configuration from v6 to v7. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function migrate(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Migrate::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Updates the individual attributes of an action group. + * + * @param array{action_group?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - action_group: The name of the action group to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroup::class); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the current list of APIs accessible for users on the allow list. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchAllowlist(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchAllowlist::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the specified fields in the audit configuration. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchAuditConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchAuditConfiguration::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the existing security configuration using the REST API. Requires super admin or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchConfiguration::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the distinguished cluster name for the specified cluster. Requires super admin or REST API permissions. + * + * @param array{cluster_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - cluster_name: The cluster name to update the `nodesDn` value. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function patchDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchDistinguishedName::class); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Bulk updates specified node distinguished names. Requires super admin or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchDistinguishedNames(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchDistinguishedNames::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the individual attributes of a role. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - role: The name of the role to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchRole::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the individual attributes of a role mapping. + * + * @param array{role?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - role: The name of the role to update a role mapping for + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMapping::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Adds, deletes, or modifies a single tenant. + * + * @param array{tenant?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - tenant: The name of the tenant to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchTenant::class); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates individual attributes for an internal user. + * + * @param array{username?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - username: The name of the user to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function patchUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PatchUser::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the current values for dynamic security settings for OpenSearch Dashboards. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function postDashboardsInfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(PostDashboardsInfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Reloads the HTTP communication certificates. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function reloadHttpCertificates(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ReloadHttpCertificates::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Reloads the transport communication certificates. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function reloadTransportCertificates(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ReloadTransportCertificates::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function tenantInfo(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(TenantInfo::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Updates the audit configuration. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateAuditConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateAuditConfiguration::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates the settings for an existing security configuration. Requires super admin or REST API permissions. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateConfiguration::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Adds or updates the specified distinguished names in the cluster or node allowlist. Requires super admin or REST API permissions. + * + * @param array{cluster_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - cluster_name: The name of the cluster containing the `nodesDn` value to create or update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updateDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateDistinguishedName::class); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Checks whether the v6 security configuration is valid and ready to be migrated to v7. + * + * @param array{accept_invalid?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - accept_invalid: Whether an invalid v6 configuration should be allowed. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function validate(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Validate::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Gets the identity information for the user currently logged in. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function whoAmI(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(WhoAmI::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Gets the identity information for the user currently logged in. To use this operation, you must have access to this endpoint when authorization at REST layer is enabled. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function whoAmIProtected(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(WhoAmIProtected::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Changes the password for the current user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['current_password'] = (string) The current password + * $params['password'] = (string) New password + * + * @param array $params Associative array of parameters + * @return array + */ + public function changePassword(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'current_password' => $this->extractArgument($params, 'current_password'), + 'password' => $this->extractArgument($params, 'password'), + ]; + } + + $endpoint = $this->endpointFactory->getEndpoint(ChangePassword::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified action group. + * + * $params['action_group'] = (string) The name of the action group to create or replace. (Required) + * $params['allowed_actions'] = (array) list of allowed actions + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'allowed_actions' => $this->extractArgument($params, 'allowed_actions'), + ]; + } + + $endpoint = $this->endpointFactory->getEndpoint(CreateActionGroup::class); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['backend_roles'] = (array) + * $params['hosts'] = (array) + * $params['users'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'backend_roles' => $this->extractArgument($params, 'backend_roles'), + 'hosts' => $this->extractArgument($params, 'hosts'), + 'users' => $this->extractArgument($params, 'users'), + ]); + } + + $endpoint = $this->endpointFactory->getEndpoint(CreateRoleMapping::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['cluster_permissions'] = (array) + * $params['index_permissions'] = (array) + * $params['tenant_permissions'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'cluster_permissions' => $this->extractArgument($params, 'cluster_permissions'), + 'index_permissions' => $this->extractArgument($params, 'index_permissions'), + 'tenant_permissions' => $this->extractArgument($params, 'tenant_permissions'), + ]); + } + + $endpoint = $this->endpointFactory->getEndpoint(CreateRole::class); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified tenant. + * + * $params['tenant'] = (string) The name of the tenant to create + * $params['description'] = (string) Description of the tenant + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'description' => $this->extractArgument($params, 'description'), + ]; + } + + $endpoint = $this->endpointFactory->getEndpoint(CreateTenant::class); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['password'] = (string) + * $params['opendistro_security_roles'] = (array) + * $params['backend_roles'] = (array) + * $params['attributes'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'password' => $this->extractArgument($params, 'password'), + 'opendistro_security_roles' => $this->extractArgument($params, 'opendistro_security_roles'), + 'backend_roles' => $this->extractArgument($params, 'backend_roles'), + 'attributes' => $this->extractArgument($params, 'attributes'), + ]); + } + + $endpoint = $this->endpointFactory->getEndpoint(CreateUser::class); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to deleteDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'deleteDistinguishedName' API instead. + */ + public function deleteDistinguishedNames(array $params = []) + { + return $this->deleteDistinguishedName($params); + } + /** + * Proxy function to getAccount() to prevent BC break. + * This API will be removed in a future version. Use 'getAccountDetails' API instead. + */ + public function getAccount(array $params = []) + { + return $this->getAccountDetails($params); + } + /** + * Retrieves all action groups. + * If 'action_group' is provided in $params, calls 'getActionGroup'. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getActionGroups(array $params = []) + { + if (isset($params['action_group'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroup::class); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetActionGroups::class); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to getConfig() to prevent BC break. + * This API will be removed in a future version. Use 'getConfiguration' API instead. + */ + public function getConfig(array $params = []) + { + return $this->getConfiguration($params); + } + /** + * Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'cluster_name' is provided in $params, calls GetDistinguishedName. + * + * $params['cluster_name'] = (string) Name of the cluster. + * $params['show_all'] = (boolean) Show all DN. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getDistinguishedNames(array $params = []) + { + if (isset($params['cluster_name'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedName::class); + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $endpoint->setClusterName($cluster_name); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetDistinguishedNames::class); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves role mappings. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'role' is provided in $params, calls GetRoleMapping. + * + * $params['role'] = (string) Name of the role. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getRoleMappings(array $params = []) + { + if (isset($params['role'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMapping::class); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetRoleMappings::class); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves roles. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'role' is provided in $params, calls getRole. + * + * $params['role'] = (string) Name of the role. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getRoles(array $params = []) + { + if (isset($params['role'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetRole::class); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetRoles::class); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves tenants. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'tenant' is provided in $params, calls GetTenant. + * + * $params['tenant'] = (string) Name of the tenant. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getTenants(array $params = []) + { + if (isset($params['tenant'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetTenant::class); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetTenants::class); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieve all internal users. + * If 'username' is provided in $params, calls 'getUser'. + * + * $params['username'] = (string) The username of the user to fetch, omit to fetch all (optional). + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getUsers(array $params = []): array + { + $endpointBuilder = $this->endpoints; + + if (isset($params['username'])) { + $endpoint = $this->endpointFactory->getEndpoint(GetUser::class); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); + } else { + $endpoint = $this->endpointFactory->getEndpoint(GetUsers::class); + } + + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple action groups in a single call. + * If 'action_group' is provided in $params, calls patchActionGroup. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchActionGroups(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + if (isset($params['action_group'])) { + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroup::class); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); + } else { + $endpoint = $this->endpointFactory->getEndpoint(PatchActionGroups::class); + } + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to patchConfig() to prevent BC break. + * This API will be removed in a future version. Use 'patchConfiguration' API instead. + */ + public function patchConfig(array $params = []) + { + $ops = $this->extractArgument($params, 'ops'); + if ($ops !== null) { + $params['body'] = $ops; + } + return $this->patchConfiguration($params); + } + /** + * Creates or updates multiple role mappings in a single call. + * If 'role' is provided in $params, calls patchRoleMappings. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRoleMappings(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + if (isset($params['role'])) { + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMapping::class); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $this->endpointFactory->getEndpoint(PatchRoleMappings::class); + } + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple roles in a single call. + * If 'role' is provided in $params, calls patchRole. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRoles(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + if (isset($params['role'])) { + $endpoint = $this->endpointFactory->getEndpoint(PatchRole::class); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $this->endpointFactory->getEndpoint(PatchRoles::class); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Add, delete, or modify multiple tenants in a single call. + * If 'tenant' is provided in $params, calls 'patchTenant'. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchTenants(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + if (isset($params['tenant'])) { + $endpoint = $this->endpointFactory->getEndpoint(PatchTenant::class); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); + } else { + $endpoint = $this->endpointFactory->getEndpoint(PatchTenants::class); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple internal users in a single call. + * If 'username' is provided in $params, calls patchUser. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchUsers(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + if (isset($params['username'])) { + $endpoint = $this->endpointFactory->getEndpoint(PatchUser::class); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); + } else { + $endpoint = $this->endpointFactory->getEndpoint(PatchUsers::class); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to updateConfig() to prevent BC break. + * This API will be removed in a future version. Use 'updateConfiguration' API instead. + */ + public function updateConfig(array $params = []) + { + $body = [ 'dynamic' => $this->extractArgument($params, 'dynamic')]; + $params['body'] = $body; + return $this->updateConfiguration($params); + } + /** + * Proxy function to updateDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'updateDistinguishedName' API instead. + */ + public function updateDistinguishedNames(array $params = []) + { + $body = [ 'nodes_dn' => $this->extractArgument($params, 'nodes_dn')]; + $params['body'] = $body; + return $this->updateDistinguishedName($params); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SmNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SmNamespace.php new file mode 100644 index 0000000..cc745f1 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SmNamespace.php @@ -0,0 +1,228 @@ +extractArgument($params, 'policy_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreatePolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a snapshot management policy. + * + * @param array{policy_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_name: The name of the snapshot management policy to delete. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deletePolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + + return $this->performRequest($endpoint); + } + + /** + * Explains the state of the snapshot management policy. + * + * @param array{policy_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_name: The name of the snapshot management policy to explain. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function explainPolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + + $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves all snapshot management policies with optional pagination and filtering. + * + * @param array{from?: int, queryString?: string, size?: int, sortField?: string, sortOrder?: mixed, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - from: The starting index from which to retrieve snapshot management policies. (Default: 0) + * - queryString: The query string to filter the returned snapshot management policies. + * - size: The number of snapshot management policies to return. + * - sortField: The name of the field to sort the snapshot management policies by. + * - sortOrder: The order to sort the snapshot management policies. (Options: asc, desc) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPolicies(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves a specific snapshot management policy by name. + * + * @param array{policy_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_name: The name of the snapshot management policy to retrieve. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getPolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + + return $this->performRequest($endpoint); + } + + /** + * Starts a snapshot management policy. + * + * @param array{policy_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_name: The name of the snapshot management policy to start. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function startPolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + + $endpoint = $this->endpointFactory->getEndpoint(StartPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + + return $this->performRequest($endpoint); + } + + /** + * Stops a snapshot management policy. + * + * @param array{policy_name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - policy_name: The name of the snapshot management policy to stop. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stopPolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + + $endpoint = $this->endpointFactory->getEndpoint(StopPolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + + return $this->performRequest($endpoint); + } + + /** + * Updates an existing snapshot management policy. Requires `if_seq_no` and `if_primary_term`. + * + * @param array{policy_name?: string, if_primary_term?: int, if_seq_no?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - policy_name: The name of the snapshot management policy to update. + * - if_primary_term: The primary term of the policy to update. + * - if_seq_no: The sequence number of the policy to update. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function updatePolicy(array $params = []) + { + $policy_name = $this->extractArgument($params, 'policy_name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdatePolicy::class); + $endpoint->setParams($params); + $endpoint->setPolicyName($policy_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SnapshotNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SnapshotNamespace.php new file mode 100644 index 0000000..62854c0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SnapshotNamespace.php @@ -0,0 +1,362 @@ +extractArgument($params, 'repository'); + + $endpoint = $this->endpointFactory->getEndpoint(CleanupRepository::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + + /** + * Creates a clone of all or part of a snapshot in the same repository as the original snapshot. + * + * @param array{repository?: string, snapshot?: string, target_snapshot?: string, cluster_manager_timeout?: string, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - repository: The name of repository which will contain the snapshots clone. + * - snapshot: The name of the original snapshot. + * - target_snapshot: The name of the cloned snapshot. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The snapshot clone definition. (Required) + * @return array + */ + public function clone(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + $target_snapshot = $this->extractArgument($params, 'target_snapshot'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CloneSnapshot::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + $endpoint->setTargetSnapshot($target_snapshot); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a snapshot within an existing repository. + * + * @param array{repository?: string, snapshot?: string, cluster_manager_timeout?: string, master_timeout?: string, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - repository: The name of the repository where the snapshot will be stored. + * - snapshot: The name of the snapshot. Must be unique in the repository. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - wait_for_completion: When `true`, the request returns a response when the snapshot is complete. When `false`, the request returns a response when the snapshot initializes. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The snapshot definition. + * @return array + */ + public function create(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Create::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Creates a snapshot repository. + * + * @param array{repository?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, verify?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - repository: The name for the newly registered repository. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - timeout: The amount of time to wait for a response. + * - verify: When `true`, verifies the creation of the snapshot repository. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: The repository definition. (Required) + * @return array + */ + public function createRepository(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateRepository::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a snapshot. + * + * @param array{repository?: string, snapshot?: string, cluster_manager_timeout?: string, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: The name of the snapshot repository to delete. + * - snapshot: A comma-separated list of snapshot names to delete from the repository. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function delete(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + + return $this->performRequest($endpoint); + } + + /** + * Deletes a snapshot repository. + * + * @param array{repository?: mixed, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: The name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - timeout: The amount of time to wait for a response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteRepository(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteRepository::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about a snapshot. + * + * @param array{repository?: string, snapshot?: mixed, cluster_manager_timeout?: string, ignore_unavailable?: bool, master_timeout?: string, verbose?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: A comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported. + * - snapshot: A comma-separated list of snapshot names to retrieve. Also accepts wildcard expressions. (`*`). - To get information about all snapshots in a registered repository, use a wildcard (`*`) or `_all`. - To get information about any snapshots that are currently running, use `_current`. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - ignore_unavailable: When `false`, the request returns an error for any snapshots that are unavailable. (Default: false) + * - master_timeout: Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error. + * - verbose: When `true`, returns additional information about each snapshot, such as the version of OpenSearch which took the snapshot, the start and end times of the snapshot, and the number of shards contained in the snapshot. When `false`, returns only snapshot names and contained indexes. This is useful when the snapshots belong to a cloud-based repository, where each blob read is a cost or performance concern. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about a snapshot repository. + * + * @param array{repository?: mixed, cluster_manager_timeout?: string, local?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: A comma-separated list of repository names. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - local: Whether to get information from the local node. (Default: false) + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getRepository(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + + $endpoint = $this->endpointFactory->getEndpoint(GetRepository::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + + /** + * Restores a snapshot. + * + * @param array{repository?: string, snapshot?: string, cluster_manager_timeout?: string, master_timeout?: string, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - repository: The name of the repository containing the snapshot + * - snapshot: The name of the snapshot to restore. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - wait_for_completion: -| Whether to return a response after the restore operation has completed. When `false`, the request returns a response when the restore operation initializes. When `true`, the request returns a response when the restore operation completes. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: Determines which settings and indexes to restore when restoring a snapshot + * @return array + */ + public function restore(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Restore::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about the status of a snapshot. + * + * @param array{repository?: string, snapshot?: mixed, cluster_manager_timeout?: string, ignore_unavailable?: bool, master_timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: The name of the repository containing the snapshot. + * - snapshot: A comma-separated list of snapshot names. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - ignore_unavailable: Whether to ignore any unavailable snapshots, When `false`, a `SnapshotMissingException` is thrown. (Default: false) + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function status(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + $snapshot = $this->extractArgument($params, 'snapshot'); + + $endpoint = $this->endpointFactory->getEndpoint(Status::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + $endpoint->setSnapshot($snapshot); + + return $this->performRequest($endpoint); + } + + /** + * Verifies a repository. + * + * @param array{repository?: string, cluster_manager_timeout?: string, master_timeout?: string, timeout?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - repository: The name of the repository containing the snapshot. + * - cluster_manager_timeout: The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). + * - master_timeout: Explicit operation timeout for connection to cluster-manager node + * - timeout: The amount of time to wait for a response. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function verifyRepository(array $params = []) + { + $repository = $this->extractArgument($params, 'repository'); + + $endpoint = $this->endpointFactory->getEndpoint(VerifyRepository::class); + $endpoint->setParams($params); + $endpoint->setRepository($repository); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SqlNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SqlNamespace.php new file mode 100644 index 0000000..bf63538 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SqlNamespace.php @@ -0,0 +1,189 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Close::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves performance metrics for the SQL plugin. + * + * @param array{format?: string, sanitize?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - format: Specifies the response format (JSON or YAML). + * - sanitize: Whether to escape special characters in the results. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getStats(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(GetStats::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves filtered performance metrics for the SQL plugin. + * + * @param array{format?: string, sanitize?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - format: Specifies the response format (JSON or YAML). + * - sanitize: Whether to escape special characters in the results. (Default: true) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function postStats(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(PostStats::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Updates SQL plugin settings in the OpenSearch cluster configuration. + * + * @param array{format?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - format: Specifies the response format (JSON or YAML). + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function settings(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Settings::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * This API will be removed in a future version. Use 'close' API instead. + * + * $params['cursor'] = (string) The cursor given by the server + * + * @param array{'cursor': string} $params Associative array of parameters + * @return array + */ + public function closeCursor(array $params): array + { + $endpoint = $this->endpointFactory->getEndpoint(Close::class); + $endpoint->setBody(array_filter([ + 'cursor' => $this->extractArgument($params, 'cursor'), + ])); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } /** + * $params['query'] = (string) The SQL Query + * + * @param array{'query': string} $params Associative array of parameters + * @return array + * + * Note: Use of query parameter is deprecated. Pass it in `body` instead. + */ + public function explain(array $params): array + { + $body = $this->extractArgument($params, 'body') ?? []; + $query = $this->extractArgument($params, 'query'); + + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); + $endpoint->setBody(array_merge($body, [ + 'query' => $query, + ])); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } /** + * $params['query'] = (string) The SQL Query + * $params['format'] = (string) The response format + * $params['cursor'] = (string) The cursor given by the server + * $params['fetch_size'] = (int) The fetch size + * + * @param array{'query'?: string, 'cursor'?: string, 'fetch_size'?: int} $params Associative array of parameters + * @return array + * + * Note: Use of `query`, `cursor` and `fetch_size` parameters is deprecated. Pass them in `body` instead. + * + */ + public function query(array $params): array + { + $endpoint = $this->endpointFactory->getEndpoint(Query::class); + $body = $this->extractArgument($params, 'body') ?? []; + $endpoint->setBody(array_merge($body, array_filter([ + 'query' => $this->extractArgument($params, 'query'), + 'cursor' => $this->extractArgument($params, 'cursor'), + 'fetch_size' => $this->extractArgument($params, 'fetch_size'), + ]))); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SslNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SslNamespace.php new file mode 100644 index 0000000..95d96a3 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/SslNamespace.php @@ -0,0 +1,40 @@ +getCertificates($params); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TasksNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TasksNamespace.php new file mode 100644 index 0000000..cb0b4e0 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TasksNamespace.php @@ -0,0 +1,121 @@ +extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Cancel::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Returns information about a task. + * + * @param array{task_id?: string, timeout?: string, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - task_id: The task ID. + * - timeout: The amount of time to wait for a response. + * - wait_for_completion: Waits for the matching task to complete. When `true`, the request is blocked until the task has completed. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $task_id = $this->extractArgument($params, 'task_id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setTaskId($task_id); + + return $this->performRequest($endpoint); + } + + /** + * Returns a list of tasks. + * + * @param array{actions?: mixed, detailed?: bool, group_by?: mixed, nodes?: mixed, parent_task_id?: string, timeout?: string, wait_for_completion?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - actions: A comma-separated list of actions that should be returned. Keep empty to return all. + * - detailed: When `true`, the response includes detailed information about shard recoveries. (Default: false) + * - group_by: Groups tasks by parent/child relationships or nodes. (Options: nodes, none, parents) + * - nodes: A comma-separated list of node IDs or names used to limit the returned information. Use `_local` to return information from the node you're connecting to, specify the node name to get information from a specific node, or keep the parameter empty to get information from all nodes. + * - parent_task_id: Returns tasks with a specified parent task ID (`node_id:task_number`). Keep empty or set to -1 to return all. + * - timeout: The amount of time to wait for a response. + * - wait_for_completion: Waits for the matching task to complete. When `true`, the request is blocked until the task has completed. (Default: false) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function list(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(ListTasks::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Proxy function to list() to prevent BC break since 7.4.0 + */ + public function tasksList(array $params = []) + { + return $this->list($params); + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TransformsNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TransformsNamespace.php new file mode 100644 index 0000000..11db9a2 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/TransformsNamespace.php @@ -0,0 +1,225 @@ +extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Delete::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns the status and metadata of a transform job. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Transform to explain (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function explain(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Explain::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns the status and metadata of a transform job. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Transform to access (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function get(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Get::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Returns a preview of what a transformed index would look like. + * + * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function preview(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Preview::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Create an index transform, or update a transform if `if_seq_no` and `if_primary_term` are provided. + * + * @param array{id?: string, if_primary_term?: int|float, if_seq_no?: int, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - id: Transform to create/update (Required) + * - if_primary_term: Only perform the operation if the document has this primary term. + * - if_seq_no: Only perform the operation if the document has this sequence number. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: + * @return array + */ + public function put(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(Put::class); + $endpoint->setParams($params); + $endpoint->setId($id); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Returns the details of all transform jobs. + * + * @param array{from?: int|float, search?: string, size?: int|float, sortDirection?: string, sortField?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - from: The starting transform to return. Default is `0`. + * - search: The search term to use to filter results. + * - size: Specifies the number of transforms to return. Default is `10`. + * - sortDirection: Specifies the direction to sort results in. Can be `ASC` or `DESC`. Default is `ASC`. + * - sortField: The field to sort results with. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function search(array $params = []) + { + + $endpoint = $this->endpointFactory->getEndpoint(Search::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + + /** + * Start transform. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Transform to start (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function start(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Start::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + + /** + * Stop transform. + * + * @param array{id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - id: Transform to stop (Required) + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function stop(array $params = []) + { + $id = $this->extractArgument($params, 'id'); + + $endpoint = $this->endpointFactory->getEndpoint(Stop::class); + $endpoint->setParams($params); + $endpoint->setId($id); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/UbiNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/UbiNamespace.php new file mode 100644 index 0000000..d26ae64 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/UbiNamespace.php @@ -0,0 +1,47 @@ +endpointFactory->getEndpoint(Initialize::class); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/WlmNamespace.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/WlmNamespace.php new file mode 100644 index 0000000..944ff37 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Namespaces/WlmNamespace.php @@ -0,0 +1,125 @@ +extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(CreateQueryGroup::class); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + + /** + * Deletes the specified query group. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the query group. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function deleteQueryGroup(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(DeleteQueryGroup::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Retrieves the specified query group. If no query group is specified, all query groups in the cluster are retrieved. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params + * - name: The name of the query group. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * @return array + */ + public function getQueryGroup(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + + $endpoint = $this->endpointFactory->getEndpoint(GetQueryGroup::class); + $endpoint->setParams($params); + $endpoint->setName($name); + + return $this->performRequest($endpoint); + } + + /** + * Updates the specified query group. + * + * @param array{name?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params + * - name: The name of the query group. + * - pretty: Whether to pretty-format the returned JSON response. (Default: false) + * - human: Whether to return human-readable values for statistics. (Default: false) + * - error_trace: Whether to include the stack trace of returned errors. (Default: false) + * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. + * - body: (Required) + * @return array + */ + public function updateQueryGroup(array $params = []) + { + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + $endpoint = $this->endpointFactory->getEndpoint(UpdateQueryGroup::class); + $endpoint->setParams($params); + $endpoint->setName($name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactory.php new file mode 100644 index 0000000..d08f6be --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactory.php @@ -0,0 +1,65 @@ +uriFactory->createUri($uri); + $uri = $uri->withQuery($this->createQuery($params)); + $request = $this->psrRequestFactory->createRequest($method, $uri); + if ($body !== null) { + $bodyJson = $this->serializer->serialize($body); + $bodyStream = $this->streamFactory->createStream($bodyJson); + $request = $request->withBody($bodyStream); + } + foreach ($headers as $name => $value) { + $request = $request->withHeader($name, $value); + } + return $request; + } + + /** + * Create a query string from an array of parameters. + */ + private function createQuery(array $params): string + { + return http_build_query(array_map(function ($value) { + // Ensure boolean values are serialized as strings. + if ($value === true) { + return 'true'; + } + if ($value === false) { + return 'false'; + } + return $value; + }, $params)); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactoryInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactoryInterface.php new file mode 100644 index 0000000..4656249 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/RequestFactoryInterface.php @@ -0,0 +1,23 @@ + $params + * @param string|array|null $body + * @param array $headers + */ + public function createRequest( + string $method, + string $uri, + array $params = [], + string|array|null $body = null, + array $headers = [], + ): RequestInterface; +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Serializers/ArrayToJSONSerializer.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Serializers/ArrayToJSONSerializer.php new file mode 100644 index 0000000..6237258 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Serializers/ArrayToJSONSerializer.php @@ -0,0 +1,66 @@ +isJson($headers)) { + return $this->decode($data); + } + return $data; + } + + /** + * Decode JSON data. + * + * @throws \OpenSearch\Exception\JsonException + */ + private function decode(?string $data): array + { + if ($data === null || strlen($data) === 0) { + return []; + } + + try { + return json_decode($data, true, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new JsonException($e->getCode(), $data, $e); + } + } + + /** + * Check the response content type to see if it is JSON. + * + * @param array $headers + */ + private function isJson(array $headers): bool + { + // Legacy support for 'transfer_stats'. + if (!empty($headers['content_type'])) { + return str_contains($headers['content_type'], 'json'); + } + + // Check PSR-7 headers. + $lowercaseHeaders = array_change_key_case($headers, CASE_LOWER); + if (array_key_exists('content-type', $lowercaseHeaders)) { + foreach ($lowercaseHeaders['content-type'] as $type) { + if (str_contains($type, 'json')) { + return true; + } + } + return false; + } + + // No content type header, so assume it is JSON. + return true; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/SymfonyClientFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/SymfonyClientFactory.php new file mode 100644 index 0000000..738f874 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/SymfonyClientFactory.php @@ -0,0 +1,72 @@ + $options + * The Symfony HTTP Client options. + */ + public function create(array $options): Client + { + // Clean up the options array for the Symfony HTTP Client. + if (isset($options['auth_aws'])) { + $awsAuth = $options['auth_aws']; + unset($options['auth_aws']); + } + + $httpClient = (new SymfonyHttpClientFactory($this->maxRetries, $this->logger))->create($options); + $serializer = new SmartSerializer(); + + $requestFactory = new RequestFactory( + $httpClient, + $httpClient, + $httpClient, + $serializer, + ); + + $transportFactory = (new TransportFactory()) + ->setRequestFactory($requestFactory); + + if (isset($awsAuth)) { + if (!isset($awsAuth['host'])) { + $awsAuth['host'] = parse_url($options['base_uri'], PHP_URL_HOST); + } + $signingClient = $this->getSigningClientFactory()->create($httpClient, $awsAuth); + $transportFactory->setHttpClient($signingClient); + } else { + $transportFactory->setHttpClient($httpClient); + } + + return new Client($transportFactory->create(), new EndpointFactory($serializer)); + } + + /** + * Gets the AWS signing client factory. + */ + protected function getSigningClientFactory(): SigningClientFactory + { + if ($this->awsSigningHttpClientFactory === null) { + $this->awsSigningHttpClientFactory = new SigningClientFactory(); + } + return $this->awsSigningHttpClientFactory; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php new file mode 100644 index 0000000..c4061ec --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php @@ -0,0 +1,183 @@ +log = $log; + $this->connectionPool = $connectionPool; + $this->retries = $retries; + + if ($sniffOnStart === true) { + $this->log->notice('Sniff on Start.'); + $this->connectionPool->scheduleCheck(); + } + } + + /** + * Returns a single connection from the connection pool + * Potentially performs a sniffing step before returning + */ + public function getConnection(): ConnectionInterface + { + return $this->connectionPool->nextConnection(); + } + + /** + * Perform a request to the Cluster + * + * @param string $method HTTP method to use + * @param string $uri HTTP URI to send request to + * @param array $params Optional query parameters + * @param mixed|null $body Optional query body + * @param array $options + * + * @throws Common\Exceptions\NoNodesAvailableException|\Exception + */ + public function performRequest(string $method, string $uri, array $params = [], $body = null, array $options = []): FutureArrayInterface + { + try { + $connection = $this->getConnection(); + } catch (Exceptions\NoNodesAvailableException $exception) { + $this->log->critical('No alive nodes found in cluster'); + throw $exception; + } + + $response = []; + $caughtException = null; + $this->lastConnection = $connection; + + $future = $connection->performRequest( + $method, + $uri, + $params, + $body, + $options, + $this + ); + + $future->promise()->then( + //onSuccess + function ($response) { + $this->retryAttempts = 0; + // Note, this could be a 4xx or 5xx error + }, + //onFailure + function ($response) { + $code = $response->getCode(); + // Ignore 400 level errors, as that means the server responded just fine + if ($code < 400 || $code >= 500) { + // Otherwise schedule a check + $this->connectionPool->scheduleCheck(); + } + } + ); + + return $future; + } + + /** + * @param FutureArrayInterface $result Response of a request (promise) + * @param array $options Options for transport + * + * @return callable|array + */ + public function resultOrFuture(FutureArrayInterface $result, array $options = []) + { + $response = null; + $async = isset($options['client']['future']) ? $options['client']['future'] : null; + if (is_null($async) || $async === false) { + do { + $result = $result->wait(); + } while ($result instanceof FutureArrayInterface); + } + return $result; + } + + public function shouldRetry(array $request): bool + { + if ($this->retryAttempts < $this->retries) { + $this->retryAttempts += 1; + + return true; + } + + return false; + } + + /** + * Returns the last used connection so that it may be inspected. Mainly + * for debugging/testing purposes. + */ + public function getLastConnection(): ConnectionInterface + { + return $this->lastConnection; + } +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportFactory.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportFactory.php new file mode 100644 index 0000000..47b1d33 --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportFactory.php @@ -0,0 +1,134 @@ +httpClient; + } + + public function setHttpClient(?ClientInterface $httpClient): static + { + $this->httpClient = $httpClient; + return $this; + } + + protected function getRequestFactory(): ?RequestFactoryInterface + { + return $this->requestFactory; + } + + public function setRequestFactory(?RequestFactoryInterface $requestFactory): static + { + $this->requestFactory = $requestFactory; + return $this; + } + + protected function getPsrRequestFactory(): PsrRequestFactoryInterface + { + if ($this->psrRequestFactory === null) { + $this->psrRequestFactory = Psr17FactoryDiscovery::findRequestFactory(); + } + return $this->psrRequestFactory; + } + + public function setPsrRequestFactory(PsrRequestFactoryInterface $psrRequestFactory): static + { + $this->psrRequestFactory = $psrRequestFactory; + return $this; + } + + protected function getStreamFactory(): StreamFactoryInterface + { + if ($this->streamFactory === null) { + $this->streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + } + return $this->streamFactory; + } + + public function setStreamFactory(StreamFactoryInterface $streamFactory): static + { + $this->streamFactory = $streamFactory; + return $this; + } + + protected function getUriFactory(): UriFactoryInterface + { + if ($this->uriFactory === null) { + $this->uriFactory = Psr17FactoryDiscovery::findUriFactory(); + } + return $this->uriFactory; + } + + public function setUriFactory(UriFactoryInterface $uriFactory): static + { + $this->uriFactory = $uriFactory; + return $this; + } + + protected function getSerializer(): SerializerInterface + { + if ($this->serializer === null) { + $this->serializer = new SmartSerializer(); + } + return $this->serializer; + } + + public function setSerializer(SerializerInterface $serializer): static + { + $this->serializer = $serializer; + return $this; + } + + /** + * Creates a new transport. + */ + public function create(): HttpTransport + { + if ($this->requestFactory === null) { + $psrRequestFactory = $this->getPsrRequestFactory(); + $streamFactory = $this->getStreamFactory(); + $uriFactory = $this->getUriFactory(); + $serializer = $this->getSerializer(); + + $this->requestFactory = new RequestFactory( + $psrRequestFactory, + $streamFactory, + $uriFactory, + $serializer + ); + } + if ($this->httpClient === null) { + $this->httpClient = Psr18ClientDiscovery::find(); + } + + return new HttpTransport($this->httpClient, $this->requestFactory, $this->getSerializer()); + } + +} diff --git a/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportInterface.php b/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportInterface.php new file mode 100644 index 0000000..91a45da --- /dev/null +++ b/vendor/opensearch-project/opensearch-php/src/OpenSearch/TransportInterface.php @@ -0,0 +1,28 @@ + $params + * @param string|array|null $body + * @param array $headers + * + * @throws \Psr\Http\Client\ClientExceptionInterface + * @throws \OpenSearch\Exception\HttpExceptionInterface + */ + public function sendRequest( + string $method, + string $uri, + array $params = [], + string|array|null $body = null, + array $headers = [], + ): iterable|string|null; + +} diff --git a/vendor/php-http/discovery/.php-cs-fixer.php b/vendor/php-http/discovery/.php-cs-fixer.php new file mode 100644 index 0000000..4256eee --- /dev/null +++ b/vendor/php-http/discovery/.php-cs-fixer.php @@ -0,0 +1,17 @@ +in(__DIR__.'/src') + ->name('*.php') +; + +$config = (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + 'trailing_comma_in_multiline' => false, // for methods this is incompatible with PHP 7 + ]) + ->setFinder($finder) +; + +return $config; diff --git a/vendor/php-http/discovery/CHANGELOG.md b/vendor/php-http/discovery/CHANGELOG.md new file mode 100644 index 0000000..a74e5cd --- /dev/null +++ b/vendor/php-http/discovery/CHANGELOG.md @@ -0,0 +1,392 @@ +# Change Log + +## 1.20.0 - 2024-10-02 + +- [#268](https://github.com/php-http/discovery/pull/268) - Do not attempt to update lock file when it is not existing. +- [#267](https://github.com/php-http/discovery/pull/267) - Test with PHP 8.3 and 8.4 +- [#266](https://github.com/php-http/discovery/pull/266) - If wrapped client implements factories, use those instead of discovering new factories. + +## 1.19.4 - 2024-03-29 + +- [#264](https://github.com/php-http/discovery/pull/264) - Do not report a general conflict with `sebastian/comparator` but make sure we install the correct version for our tests. + +## 1.19.3 - 2024-03-28 + +- [#261](https://github.com/php-http/discovery/pull/261) - explicitly mark nullable parameters as nullable (avoid deprecation in PHP 8.4) + +## 1.19.2 - 2023-11-30 + +- [#253](https://github.com/php-http/discovery/pull/253) - Symfony 7 dropped the deprecated PHP-HTTP `HttpClient` interface from their HTTP client, do not discover the version 7 client when looking for the old interface. + +## 1.19.1 - 2023-07-11 + +- [#250](https://github.com/php-http/discovery/pull/250) - Fix: Buzz client instantiation using deprecated Message Factory Discovery, use PSR-17 factory discovery instead. + +## 1.19.0 - 2023-06-19 + +- [#249](https://github.com/php-http/discovery/pull/249) - Have composer plugin correctly install Symfony http client when nothing explicitly requires psr 18 resp. httplug. +- [#241](https://github.com/php-http/discovery/pull/241) - Support discovering PSR-17 factories of `httpsoft/http-message` package + +## 1.18.1 - 2023-05-17 + +- [#242](https://github.com/php-http/discovery/pull/242) - Better exception message when no legacy php-http message factories can be built. Also needs php-http/message-factory package and they are deprecated in favor of PSR-17 anyways. + +## 1.18.0 - 2023-05-03 + +- [#235](https://github.com/php-http/discovery/pull/235) - Deprecate HttpClientDiscovery, use Psr18ClientDiscovery instead +- [#238](https://github.com/php-http/discovery/pull/238) - Skip requiring php-http/message-factory when installing symfony/http-client 6.3+ +- [#239](https://github.com/php-http/discovery/pull/239) - Skip auto-installing when the root package's extra.discovery is enough + +## 1.17.0 - 2023-04-26 + +- [#230](https://github.com/php-http/discovery/pull/230) - Add Psr18Client to make it straightforward to use PSR-18 +- [#232](https://github.com/php-http/discovery/pull/232) - Allow pinning the preferred implementations in composer.json +- [#233](https://github.com/php-http/discovery/pull/233) - Fix Psr17Factory::createServerRequestFromGlobals() when uploaded files have been moved + +## 1.16.0 - 2023-04-26 + +- [#225](https://github.com/php-http/discovery/pull/225) - Remove support for the abandoned Zend Diactoros which has been replaced with Laminas Diactoros; marked the zend library as conflict in composer.json to avoid confusion +- [#227](https://github.com/php-http/discovery/pull/227) - Fix handling requests with nested files + +## 1.15.3 - 2023-03-31 + +- [#224](https://github.com/php-http/discovery/pull/224) - Fix regression with Magento classloader + +## 1.15.2 - 2023-02-11 + +- [#219](https://github.com/php-http/discovery/pull/219) - Fix handling of replaced packages + +## 1.15.1 - 2023-02-10 + +- [#214](https://github.com/php-http/discovery/pull/214) - Fix resolving deps for psr/http-message-implementation +- [#216](https://github.com/php-http/discovery/pull/216) - Fix keeping platform requirements when rebooting composer +- [#217](https://github.com/php-http/discovery/pull/217) - Set extra.plugin-optional composer flag + +## 1.15.0 - 2023-02-09 + +- [#209](https://github.com/php-http/discovery/pull/209) - Add generic `Psr17Factory` class +- [#208](https://github.com/php-http/discovery/pull/208) - Add composer plugin to auto-install missing implementations. + When libraries require an http implementation but no packages providing that implementation is installed in the application, the plugin will automatically install one. + This is only done for libraries that directly require php-http/discovery to avoid unexpected dependency installation. + +## 1.14.3 - 2022-07-11 + +- [#207](https://github.com/php-http/discovery/pull/207) - Updates Exception to extend Throwable solving static analysis errors for consumers + +## 1.14.2 - 2022-05-25 + +- [#202](https://github.com/php-http/discovery/pull/202) - Avoid error when the Symfony PSR-18 client exists but its dependencies are not installed + +## 1.14.1 - 2021-09-18 + +- [#199](https://github.com/php-http/discovery/pull/199) - Fixes message factory discovery for `laminas-diactoros ^2.7` + +## 1.14.0 - 2021-06-21 + +- Deprecate puli as it has been unmaintained for a long time and is not compatible with composer 2 https://github.com/php-http/discovery/pull/195 + +## 1.13.0 - 2020-11-27 + +- Support discovering PSR-17 factories of `slim/psr7` package https://github.com/php-http/discovery/pull/192 + +## 1.12.0 - 2020-09-22 + +- Support discovering HttpClient of `php-http/guzzle7-adapter` https://github.com/php-http/discovery/pull/189 + +## 1.11.0 - 2020-09-22 + +- Use correct method name to find Uri Factory in PSR17 https://github.com/php-http/discovery/pull/181 + +## 1.10.0 - 2020-09-04 + +- Discover PSR-18 implementation of phalcon + +## 1.9.1 - 2020-07-13 + +### Fixed + +- Support PHP 7.4 and 8.0 + +## 1.9.0 - 2020-07-02 + +### Added + +- Support discovering PSR-18 factories of `guzzlehttp/guzzle` 7+ + +## 1.8.0 - 2020-06-14 + +### Added + +- Support discovering PSR-17 factories of `guzzlehttp/psr7` package +- Support discovering PSR-17 factories of `laminas/laminas-diactoros` package +- `ClassDiscovery::getStrategies()` to retrieve the list of current strategies. + +### Fixed + +- Ignore exception during discovery when Symfony HttplugClient checks if HTTPlug is available. + +## 1.7.4 - 2020-01-03 + +### Fixed + +- Improve conditions on Symfony's async HTTPlug client. + +## 1.7.3 - 2019-12-27 + +### Fixed + +- Enough conditions to only use Symfony HTTP client if all needed components are available. + +## 1.7.2 - 2019-12-27 + +### Fixed + +- Allow a condition to specify an interface and not just classes. + +## 1.7.1 - 2019-12-26 + +### Fixed + +- Better conditions to see if Symfony's HTTP clients are available. + +## 1.7.0 - 2019-06-30 + +### Added + +- Dropped support for PHP < 7.1 +- Support for `symfony/http-client` + +## 1.6.1 - 2019-02-23 + +### Fixed + +- MockClientStrategy also provides the mock client when requesting an async client + +## 1.6.0 - 2019-01-23 + +### Added + +- Support for PSR-17 factories +- Support for PSR-18 clients + +## 1.5.2 - 2018-12-31 + +Corrected mistakes in 1.5.1. The different between 1.5.2 and 1.5.0 is that +we removed some PHP 7 code. + +https://github.com/php-http/discovery/compare/1.5.0...1.5.2 + +## 1.5.1 - 2018-12-31 + +This version added new features by mistake. These are reverted in 1.5.2. + +Do not use 1.5.1. + +### Fixed + +- Removed PHP 7 code + +## 1.5.0 - 2018-12-30 + +### Added + +- Support for `nyholm/psr7` version 1.0. +- `ClassDiscovery::safeClassExists` which will help Magento users. +- Support for HTTPlug 2.0 +- Support for Buzz 1.0 +- Better error message when nothing found by introducing a new exception: `NoCandidateFoundException`. + +### Fixed + +- Fixed condition evaluation, it should stop after first invalid condition. + +## 1.4.0 - 2018-02-06 + +### Added + +- Discovery support for nyholm/psr7 + +## 1.3.0 - 2017-08-03 + +### Added + +- Discovery support for CakePHP adapter +- Discovery support for Zend adapter +- Discovery support for Artax adapter + +## 1.2.1 - 2017-03-02 + +### Fixed + +- Fixed minor issue with `MockClientStrategy`, also added more tests. + +## 1.2.0 - 2017-02-12 + +### Added + +- MockClientStrategy class. + +## 1.1.1 - 2016-11-27 + +### Changed + +- Made exception messages clearer. `StrategyUnavailableException` is no longer the previous exception to `DiscoveryFailedException`. +- `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final. + +## 1.1.0 - 2016-10-20 + +### Added + +- Discovery support for Slim Framework factories + +## 1.0.0 - 2016-07-18 + +### Added + +- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version. You may upgrade from 0.8.x and 0.9.x to 1.0.0 without any BC breaks. +- Added interface `Http\Discovery\Exception` which is implemented by all our exceptions + +### Changed + +- Puli strategy renamed to Puli Beta strategy to prevent incompatibility with a future Puli stable + +### Deprecated + +- For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0 + + +## 0.9.1 - 2016-06-28 + +### Changed + +- Dropping PHP 5.4 support because we use the ::class constant. + + +## 0.9.0 - 2016-06-25 + +### Added + +- Discovery strategies to find classes + +### Changed + +- [Puli](http://puli.io) made optional +- Improved exceptions +- **[BC] `NotFoundException` moved to `Http\Discovery\Exception\NotFoundException`** + + +## 0.8.0 - 2016-02-11 + +### Changed + +- Puli composer plugin must be installed separately + + +## 0.7.0 - 2016-01-15 + +### Added + +- Temporary puli.phar (Beta 10) executable + +### Changed + +- Updated HTTPlug dependencies +- Updated Puli dependencies +- Local configuration to make tests passing + +### Removed + +- Puli CLI dependency + + +## 0.6.4 - 2016-01-07 + +### Fixed + +- Puli [not working](https://twitter.com/PuliPHP/status/685132540588507137) with the latest json-schema + + +## 0.6.3 - 2016-01-04 + +### Changed + +- Adjust Puli dependencies + + +## 0.6.2 - 2016-01-04 + +### Changed + +- Make Puli CLI a requirement + + +## 0.6.1 - 2016-01-03 + +### Changed + +- More flexible Puli requirement + + +## 0.6.0 - 2015-12-30 + +### Changed + +- Use [Puli](http://puli.io) for discovery +- Improved exception messages + + +## 0.5.0 - 2015-12-25 + +### Changed + +- Updated message factory dependency (php-http/message) + + +## 0.4.0 - 2015-12-17 + +### Added + +- Array condition evaluation in the Class Discovery + +### Removed + +- Message factories (moved to php-http/utils) + + +## 0.3.0 - 2015-11-18 + +### Added + +- HTTP Async Client Discovery +- Stream factories + +### Changed + +- Discoveries and Factories are final +- Message and Uri factories have the type in their names +- Diactoros Message factory uses Stream factory internally + +### Fixed + +- Improved docblocks for API documentation generation + + +## 0.2.0 - 2015-10-31 + +### Changed + +- Renamed AdapterDiscovery to ClientDiscovery + + +## 0.1.1 - 2015-06-13 + +### Fixed + +- Bad HTTP Adapter class name for Guzzle 5 + + +## 0.1.0 - 2015-06-12 + +### Added + +- Initial release diff --git a/vendor/php-http/discovery/LICENSE b/vendor/php-http/discovery/LICENSE new file mode 100644 index 0000000..4558d6f --- /dev/null +++ b/vendor/php-http/discovery/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 PHP HTTP Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/php-http/discovery/README.md b/vendor/php-http/discovery/README.md new file mode 100644 index 0000000..2b5e8e5 --- /dev/null +++ b/vendor/php-http/discovery/README.md @@ -0,0 +1,122 @@ +# HTTPlug Discovery + +[![Latest Version](https://img.shields.io/github/release/php-http/discovery.svg?style=flat-square)](https://github.com/php-http/discovery/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Tests](https://github.com/php-http/discovery/actions/workflows/ci.yml/badge.svg?branch=1.x)](https://github.com/php-http/discovery/actions/workflows/ci.yml?query=branch%3A1.x) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/discovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/discovery) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/discovery.svg?style=flat-square)](https://packagist.org/packages/php-http/discovery) + +**This library provides auto-discovery and auto-installation of well-known PSR-17, PSR-18 and HTTPlug implementations.** + + +## Install + +Via Composer + +``` bash +composer require php-http/discovery +``` + + +## Usage as a library author + +Please see the [official documentation](http://php-http.readthedocs.org/en/latest/discovery.html). + +If your library/SDK needs a PSR-18 client, here is a quick example. + +First, you need to install a PSR-18 client and a PSR-17 factory implementations. +This should be done only for dev dependencies as you don't want to force a +specific implementation on your users: + +```bash +composer require --dev symfony/http-client +composer require --dev nyholm/psr7 +``` + +Then, you can disable the Composer plugin embeded in `php-http/discovery` +because you just installed the dev dependencies you need for testing: + +```bash +composer config allow-plugins.php-http/discovery false +``` + +Finally, you need to require `php-http/discovery` and the generic implementations +that your library is going to need: + +```bash +composer require 'php-http/discovery:^1.17' +composer require 'psr/http-client-implementation:*' +composer require 'psr/http-factory-implementation:*' +``` + +Now, you're ready to make an HTTP request: + +```php +use Http\Discovery\Psr18Client; + +$client = new Psr18Client(); + +$request = $client->createRequest('GET', 'https://example.com'); +$response = $client->sendRequest($request); +``` + +Internally, this code will use whatever PSR-7, PSR-17 and PSR-18 implementations +that your users have installed. + + +## Usage as a library user + +If you use a library/SDK that requires `php-http/discovery`, you can configure +the auto-discovery mechanism to use a specific implementation when many are +available in your project. + +For example, if you have both `nyholm/psr7` and `guzzlehttp/guzzle` in your +project, you can tell `php-http/discovery` to use `guzzlehttp/guzzle` instead of +`nyholm/psr7` by running the following command: + +```bash +composer config extra.discovery.psr/http-factory-implementation GuzzleHttp\\Psr7\\HttpFactory +``` + +This will update your `composer.json` file to add the following configuration: + +```json +{ + "extra": { + "discovery": { + "psr/http-factory-implementation": "GuzzleHttp\\Psr7\\HttpFactory" + } + } +} +``` + +Don't forget to run `composer install` to apply the changes, and ensure that +the composer plugin is enabled: + +```bash +composer config allow-plugins.php-http/discovery true +composer install +``` + + +## Testing + +``` bash +composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/discovery/composer.json b/vendor/php-http/discovery/composer.json new file mode 100644 index 0000000..9d718bb --- /dev/null +++ b/vendor/php-http/discovery/composer.json @@ -0,0 +1,64 @@ +{ + "name": "php-http/discovery", + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "type": "composer-plugin", + "license": "MIT", + "keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7", "psr17"], + "homepage": "http://php-http.org", + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require": { + "php": "^7.1 || ^8.0", + "composer-plugin-api": "^1.0|^2.0" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1", + "sebastian/comparator": "^3.0.5 || ^4.0.8" + }, + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] + }, + "autoload-dev": { + "psr-4": { + "spec\\Http\\Discovery\\": "spec/" + } + }, + "scripts": { + "test": [ + "vendor/bin/phpspec run", + "vendor/bin/simple-phpunit --group NothingInstalled" + ], + "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" + }, + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "conflict": { + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "prefer-stable": true, + "minimum-stability": "beta" +} diff --git a/vendor/php-http/discovery/src/ClassDiscovery.php b/vendor/php-http/discovery/src/ClassDiscovery.php new file mode 100644 index 0000000..5ea4697 --- /dev/null +++ b/vendor/php-http/discovery/src/ClassDiscovery.php @@ -0,0 +1,255 @@ + + * @author Márk Sági-Kazár + * @author Tobias Nyholm + */ +abstract class ClassDiscovery +{ + /** + * A list of strategies to find classes. + * + * @var DiscoveryStrategy[] + */ + private static $strategies = [ + Strategy\GeneratedDiscoveryStrategy::class, + Strategy\CommonClassesStrategy::class, + Strategy\CommonPsr17ClassesStrategy::class, + Strategy\PuliBetaStrategy::class, + ]; + + private static $deprecatedStrategies = [ + Strategy\PuliBetaStrategy::class => true, + ]; + + /** + * Discovery cache to make the second time we use discovery faster. + * + * @var array + */ + private static $cache = []; + + /** + * Finds a class. + * + * @param string $type + * + * @return string|\Closure + * + * @throws DiscoveryFailedException + */ + protected static function findOneByType($type) + { + // Look in the cache + if (null !== ($class = self::getFromCache($type))) { + return $class; + } + + static $skipStrategy; + $skipStrategy ?? $skipStrategy = self::safeClassExists(Strategy\GeneratedDiscoveryStrategy::class) ? false : Strategy\GeneratedDiscoveryStrategy::class; + + $exceptions = []; + foreach (self::$strategies as $strategy) { + if ($skipStrategy === $strategy) { + continue; + } + + try { + $candidates = $strategy::getCandidates($type); + } catch (StrategyUnavailableException $e) { + if (!isset(self::$deprecatedStrategies[$strategy])) { + $exceptions[] = $e; + } + + continue; + } + + foreach ($candidates as $candidate) { + if (isset($candidate['condition'])) { + if (!self::evaluateCondition($candidate['condition'])) { + continue; + } + } + + // save the result for later use + self::storeInCache($type, $candidate); + + return $candidate['class']; + } + + $exceptions[] = new NoCandidateFoundException($strategy, $candidates); + } + + throw DiscoveryFailedException::create($exceptions); + } + + /** + * Get a value from cache. + * + * @param string $type + * + * @return string|null + */ + private static function getFromCache($type) + { + if (!isset(self::$cache[$type])) { + return; + } + + $candidate = self::$cache[$type]; + if (isset($candidate['condition'])) { + if (!self::evaluateCondition($candidate['condition'])) { + return; + } + } + + return $candidate['class']; + } + + /** + * Store a value in cache. + * + * @param string $type + * @param string $class + */ + private static function storeInCache($type, $class) + { + self::$cache[$type] = $class; + } + + /** + * Set new strategies and clear the cache. + * + * @param string[] $strategies list of fully qualified class names that implement DiscoveryStrategy + */ + public static function setStrategies(array $strategies) + { + self::$strategies = $strategies; + self::clearCache(); + } + + /** + * Returns the currently configured discovery strategies as fully qualified class names. + * + * @return string[] + */ + public static function getStrategies(): iterable + { + return self::$strategies; + } + + /** + * Append a strategy at the end of the strategy queue. + * + * @param string $strategy Fully qualified class name of a DiscoveryStrategy + */ + public static function appendStrategy($strategy) + { + self::$strategies[] = $strategy; + self::clearCache(); + } + + /** + * Prepend a strategy at the beginning of the strategy queue. + * + * @param string $strategy Fully qualified class name to a DiscoveryStrategy + */ + public static function prependStrategy($strategy) + { + array_unshift(self::$strategies, $strategy); + self::clearCache(); + } + + public static function clearCache() + { + self::$cache = []; + } + + /** + * Evaluates conditions to boolean. + * + * @return bool + */ + protected static function evaluateCondition($condition) + { + if (is_string($condition)) { + // Should be extended for functions, extensions??? + return self::safeClassExists($condition); + } + if (is_callable($condition)) { + return (bool) $condition(); + } + if (is_bool($condition)) { + return $condition; + } + if (is_array($condition)) { + foreach ($condition as $c) { + if (false === static::evaluateCondition($c)) { + // Immediately stop execution if the condition is false + return false; + } + } + + return true; + } + + return false; + } + + /** + * Get an instance of the $class. + * + * @param string|\Closure $class a FQCN of a class or a closure that instantiate the class + * + * @return object + * + * @throws ClassInstantiationFailedException + */ + protected static function instantiateClass($class) + { + try { + if (is_string($class)) { + return new $class(); + } + + if (is_callable($class)) { + return $class(); + } + } catch (\Exception $e) { + throw new ClassInstantiationFailedException('Unexpected exception when instantiating class.', 0, $e); + } + + throw new ClassInstantiationFailedException('Could not instantiate class because parameter is neither a callable nor a string'); + } + + /** + * We need a "safe" version of PHP's "class_exists" because Magento has a bug + * (or they call it a "feature"). Magento is throwing an exception if you do class_exists() + * on a class that ends with "Factory" and if that file does not exits. + * + * This function catches all potential exceptions and makes sure to always return a boolean. + * + * @param string $class + * + * @return bool + */ + public static function safeClassExists($class) + { + try { + return class_exists($class) || interface_exists($class); + } catch (\Exception $e) { + return false; + } + } +} diff --git a/vendor/php-http/discovery/src/Composer/Plugin.php b/vendor/php-http/discovery/src/Composer/Plugin.php new file mode 100644 index 0000000..9339f8b --- /dev/null +++ b/vendor/php-http/discovery/src/Composer/Plugin.php @@ -0,0 +1,474 @@ + + * + * @internal + */ +class Plugin implements PluginInterface, EventSubscriberInterface +{ + /** + * Describes, for every supported virtual implementation, which packages + * provide said implementation and which extra dependencies each package + * requires to provide the implementation. + */ + private const PROVIDE_RULES = [ + 'php-http/async-client-implementation' => [ + 'symfony/http-client:>=6.3' => ['guzzlehttp/promises', 'psr/http-factory-implementation', 'php-http/httplug'], + 'symfony/http-client' => ['guzzlehttp/promises', 'php-http/message-factory', 'psr/http-factory-implementation', 'php-http/httplug'], + 'php-http/guzzle7-adapter' => [], + 'php-http/guzzle6-adapter' => [], + 'php-http/curl-client' => [], + 'php-http/react-adapter' => [], + ], + 'php-http/client-implementation' => [ + 'symfony/http-client:>=6.3' => ['psr/http-factory-implementation', 'php-http/httplug'], + 'symfony/http-client' => ['php-http/message-factory', 'psr/http-factory-implementation', 'php-http/httplug'], + 'php-http/guzzle7-adapter' => [], + 'php-http/guzzle6-adapter' => [], + 'php-http/cakephp-adapter' => [], + 'php-http/curl-client' => [], + 'php-http/react-adapter' => [], + 'php-http/buzz-adapter' => [], + 'php-http/artax-adapter' => [], + 'kriswallsmith/buzz:^1' => [], + ], + 'psr/http-client-implementation' => [ + 'symfony/http-client' => ['psr/http-factory-implementation', 'psr/http-client'], + 'guzzlehttp/guzzle' => [], + 'kriswallsmith/buzz:^1' => [], + ], + 'psr/http-message-implementation' => [ + 'php-http/discovery' => ['psr/http-factory-implementation'], + ], + 'psr/http-factory-implementation' => [ + 'nyholm/psr7' => [], + 'guzzlehttp/psr7:>=2' => [], + 'slim/psr7' => [], + 'laminas/laminas-diactoros' => [], + 'phalcon/cphalcon:^4' => [], + 'http-interop/http-factory-guzzle' => [], + 'http-interop/http-factory-diactoros' => [], + 'http-interop/http-factory-slim' => [], + 'httpsoft/http-message' => [], + ], + ]; + + /** + * Describes which package should be preferred on the left side + * depending on which one is already installed on the right side. + */ + private const STICKYNESS_RULES = [ + 'symfony/http-client' => 'symfony/framework-bundle', + 'php-http/guzzle7-adapter' => 'guzzlehttp/guzzle:^7', + 'php-http/guzzle6-adapter' => 'guzzlehttp/guzzle:^6', + 'php-http/guzzle5-adapter' => 'guzzlehttp/guzzle:^5', + 'php-http/cakephp-adapter' => 'cakephp/cakephp', + 'php-http/react-adapter' => 'react/event-loop', + 'php-http/buzz-adapter' => 'kriswallsmith/buzz:^0.15.1', + 'php-http/artax-adapter' => 'amphp/artax:^3', + 'http-interop/http-factory-guzzle' => 'guzzlehttp/psr7:^1', + 'http-interop/http-factory-slim' => 'slim/slim:^3', + ]; + + private const INTERFACE_MAP = [ + 'php-http/async-client-implementation' => [ + 'Http\Client\HttpAsyncClient', + ], + 'php-http/client-implementation' => [ + 'Http\Client\HttpClient', + ], + 'psr/http-client-implementation' => [ + 'Psr\Http\Client\ClientInterface', + ], + 'psr/http-factory-implementation' => [ + 'Psr\Http\Message\RequestFactoryInterface', + 'Psr\Http\Message\ResponseFactoryInterface', + 'Psr\Http\Message\ServerRequestFactoryInterface', + 'Psr\Http\Message\StreamFactoryInterface', + 'Psr\Http\Message\UploadedFileFactoryInterface', + 'Psr\Http\Message\UriFactoryInterface', + ], + ]; + + public static function getSubscribedEvents(): array + { + return [ + ScriptEvents::PRE_AUTOLOAD_DUMP => 'preAutoloadDump', + ScriptEvents::POST_UPDATE_CMD => 'postUpdate', + ]; + } + + public function activate(Composer $composer, IOInterface $io): void + { + } + + public function deactivate(Composer $composer, IOInterface $io) + { + } + + public function uninstall(Composer $composer, IOInterface $io) + { + } + + public function postUpdate(Event $event) + { + $composer = $event->getComposer(); + $repo = $composer->getRepositoryManager()->getLocalRepository(); + $requires = [ + $composer->getPackage()->getRequires(), + $composer->getPackage()->getDevRequires(), + ]; + $pinnedAbstractions = []; + $pinned = $composer->getPackage()->getExtra()['discovery'] ?? []; + foreach (self::INTERFACE_MAP as $abstraction => $interfaces) { + foreach (isset($pinned[$abstraction]) ? [] : $interfaces as $interface) { + if (!isset($pinned[$interface])) { + continue 2; + } + } + $pinnedAbstractions[$abstraction] = true; + } + + $missingRequires = $this->getMissingRequires($repo, $requires, 'project' === $composer->getPackage()->getType(), $pinnedAbstractions); + $missingRequires = [ + 'require' => array_fill_keys(array_merge([], ...array_values($missingRequires[0])), '*'), + 'require-dev' => array_fill_keys(array_merge([], ...array_values($missingRequires[1])), '*'), + 'remove' => array_fill_keys(array_merge([], ...array_values($missingRequires[2])), '*'), + ]; + + if (!$missingRequires = array_filter($missingRequires)) { + return; + } + + $composerJsonContents = file_get_contents(Factory::getComposerFile()); + $this->updateComposerJson($missingRequires, $composer->getConfig()->get('sort-packages')); + + $installer = null; + // Find the composer installer, hack borrowed from symfony/flex + foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) { + if (isset($trace['object']) && $trace['object'] instanceof Installer) { + $installer = $trace['object']; + break; + } + } + + if (!$installer) { + return; + } + + $event->stopPropagation(); + + $dispatcher = $composer->getEventDispatcher(); + $disableScripts = !method_exists($dispatcher, 'setRunScripts') || !((array) $dispatcher)["\0*\0runScripts"]; + $composer = Factory::create($event->getIO(), null, false, $disableScripts); + + /** @var Installer $installer */ + $installer = clone $installer; + if (method_exists($installer, 'setAudit')) { + $trace['object']->setAudit(false); + } + // we need a clone of the installer to preserve its configuration state but with our own service objects + $installer->__construct( + $event->getIO(), + $composer->getConfig(), + $composer->getPackage(), + $composer->getDownloadManager(), + $composer->getRepositoryManager(), + $composer->getLocker(), + $composer->getInstallationManager(), + $composer->getEventDispatcher(), + $composer->getAutoloadGenerator() + ); + if (method_exists($installer, 'setPlatformRequirementFilter')) { + $installer->setPlatformRequirementFilter(((array) $trace['object'])["\0*\0platformRequirementFilter"]); + } + + if (0 !== $installer->run()) { + file_put_contents(Factory::getComposerFile(), $composerJsonContents); + + return; + } + + $versionSelector = new VersionSelector(ClassDiscovery::safeClassExists(RepositorySet::class) ? new RepositorySet() : new Pool()); + $updateComposerJson = false; + + foreach ($composer->getRepositoryManager()->getLocalRepository()->getPackages() as $package) { + foreach (['require', 'require-dev'] as $key) { + if (!isset($missingRequires[$key][$package->getName()])) { + continue; + } + $updateComposerJson = true; + $missingRequires[$key][$package->getName()] = $versionSelector->findRecommendedRequireVersion($package); + } + } + + if ($updateComposerJson) { + $this->updateComposerJson($missingRequires, $composer->getConfig()->get('sort-packages')); + $this->updateComposerLock($composer, $event->getIO()); + } + } + + public function getMissingRequires(InstalledRepositoryInterface $repo, array $requires, bool $isProject, array $pinnedAbstractions): array + { + $allPackages = []; + $devPackages = method_exists($repo, 'getDevPackageNames') ? array_fill_keys($repo->getDevPackageNames(), true) : []; + + // One must require "php-http/discovery" + // to opt-in for auto-installation of virtual package implementations + if (!isset($requires[0]['php-http/discovery'])) { + $requires = [[], []]; + } + + foreach ($repo->getPackages() as $package) { + $allPackages[$package->getName()] = true; + + if (1 < \count($names = $package->getNames(false))) { + $allPackages += array_fill_keys($names, false); + + if (isset($devPackages[$package->getName()])) { + $devPackages += $names; + } + } + + if (isset($package->getRequires()['php-http/discovery'])) { + $requires[(int) isset($devPackages[$package->getName()])] += $package->getRequires(); + } + } + + $missingRequires = [[], [], []]; + $versionParser = new VersionParser(); + + if (ClassDiscovery::safeClassExists(\Phalcon\Http\Message\RequestFactory::class, false)) { + $missingRequires[0]['psr/http-factory-implementation'] = []; + $missingRequires[1]['psr/http-factory-implementation'] = []; + } + + foreach ($requires as $dev => $rules) { + $abstractions = []; + $rules = array_intersect_key(self::PROVIDE_RULES, $rules); + + while ($rules) { + $abstraction = key($rules); + + if (isset($pinnedAbstractions[$abstraction])) { + unset($rules[$abstraction]); + continue; + } + + $abstractions[] = $abstraction; + + foreach (array_shift($rules) as $candidate => $deps) { + [$candidate, $version] = explode(':', $candidate, 2) + [1 => null]; + + if (!isset($allPackages[$candidate])) { + continue; + } + if (null !== $version && !$repo->findPackage($candidate, $versionParser->parseConstraints($version))) { + continue; + } + if ($isProject && !$dev && isset($devPackages[$candidate])) { + $missingRequires[0][$abstraction] = [$candidate]; + $missingRequires[2][$abstraction] = [$candidate]; + } else { + $missingRequires[$dev][$abstraction] = []; + } + + foreach ($deps as $dep) { + if (isset(self::PROVIDE_RULES[$dep])) { + $rules[$dep] = self::PROVIDE_RULES[$dep]; + } elseif (!isset($allPackages[$dep])) { + $missingRequires[$dev][$abstraction][] = $dep; + } elseif ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[0][$abstraction][] = $dep; + $missingRequires[2][$abstraction][] = $dep; + } + } + break; + } + } + + while ($abstractions) { + $abstraction = array_shift($abstractions); + + if (isset($missingRequires[$dev][$abstraction])) { + continue; + } + $candidates = self::PROVIDE_RULES[$abstraction]; + + foreach ($candidates as $candidate => $deps) { + [$candidate, $version] = explode(':', $candidate, 2) + [1 => null]; + + if (null !== $version && !$repo->findPackage($candidate, $versionParser->parseConstraints($version))) { + continue; + } + if (isset($allPackages[$candidate]) && (!$isProject || $dev || !isset($devPackages[$candidate]))) { + continue 2; + } + } + + foreach (array_intersect_key(self::STICKYNESS_RULES, $candidates) as $candidate => $stickyRule) { + [$stickyName, $stickyVersion] = explode(':', $stickyRule, 2) + [1 => null]; + if (!isset($allPackages[$stickyName]) || ($isProject && !$dev && isset($devPackages[$stickyName]))) { + continue; + } + if (null !== $stickyVersion && !$repo->findPackage($stickyName, $versionParser->parseConstraints($stickyVersion))) { + continue; + } + + $candidates = [$candidate => $candidates[$candidate]]; + break; + } + + $dep = key($candidates); + [$dep] = explode(':', $dep, 2); + $missingRequires[$dev][$abstraction] = [$dep]; + + if ($isProject && !$dev && isset($devPackages[$dep])) { + $missingRequires[2][$abstraction][] = $dep; + } + } + } + + $missingRequires[1] = array_diff_key($missingRequires[1], $missingRequires[0]); + + return $missingRequires; + } + + public function preAutoloadDump(Event $event) + { + $filesystem = new Filesystem(); + // Double realpath() on purpose, see https://bugs.php.net/72738 + $vendorDir = $filesystem->normalizePath(realpath(realpath($event->getComposer()->getConfig()->get('vendor-dir')))); + $filesystem->ensureDirectoryExists($vendorDir.'/composer'); + $pinned = $event->getComposer()->getPackage()->getExtra()['discovery'] ?? []; + $candidates = []; + + $allInterfaces = array_merge(...array_values(self::INTERFACE_MAP)); + foreach ($pinned as $abstraction => $class) { + if (isset(self::INTERFACE_MAP[$abstraction])) { + $interfaces = self::INTERFACE_MAP[$abstraction]; + } elseif (false !== $k = array_search($abstraction, $allInterfaces, true)) { + $interfaces = [$allInterfaces[$k]]; + } else { + throw new \UnexpectedValueException(sprintf('Invalid "extra.discovery" pinned in composer.json: "%s" is not one of ["%s"].', $abstraction, implode('", "', array_keys(self::INTERFACE_MAP)))); + } + + foreach ($interfaces as $interface) { + $candidates[] = sprintf("case %s: return [['class' => %s]];\n", var_export($interface, true), var_export($class, true)); + } + } + + $file = $vendorDir.'/composer/GeneratedDiscoveryStrategy.php'; + + if (!$candidates) { + if (file_exists($file)) { + unlink($file); + } + + return; + } + + $candidates = implode(' ', $candidates); + $code = <<getComposer()->getPackage(); + $autoload = $rootPackage->getAutoload(); + $autoload['classmap'][] = $vendorDir.'/composer/GeneratedDiscoveryStrategy.php'; + $rootPackage->setAutoload($autoload); + } + + private function updateComposerJson(array $missingRequires, bool $sortPackages) + { + $file = Factory::getComposerFile(); + $contents = file_get_contents($file); + + $manipulator = new JsonManipulator($contents); + + foreach ($missingRequires as $key => $packages) { + foreach ($packages as $package => $constraint) { + if ('remove' === $key) { + $manipulator->removeSubNode('require-dev', $package); + } else { + $manipulator->addLink($key, $package, $constraint, $sortPackages); + } + } + } + + file_put_contents($file, $manipulator->getContents()); + } + + private function updateComposerLock(Composer $composer, IOInterface $io) + { + if (false === $composer->getConfig()->get('lock')) { + return; + } + + $lock = substr(Factory::getComposerFile(), 0, -4).'lock'; + $composerJson = file_get_contents(Factory::getComposerFile()); + $lockFile = new JsonFile($lock, null, $io); + $locker = ClassDiscovery::safeClassExists(RepositorySet::class) + ? new Locker($io, $lockFile, $composer->getInstallationManager(), $composerJson) + : new Locker($io, $lockFile, $composer->getRepositoryManager(), $composer->getInstallationManager(), $composerJson); + + if (!$locker->isLocked()) { + return; + } + + $lockData = $locker->getLockData(); + $lockData['content-hash'] = Locker::getContentHash($composerJson); + $lockFile->write($lockData); + } +} diff --git a/vendor/php-http/discovery/src/Exception.php b/vendor/php-http/discovery/src/Exception.php new file mode 100644 index 0000000..0fa8c76 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception.php @@ -0,0 +1,12 @@ + + */ +interface Exception extends \Throwable +{ +} diff --git a/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php b/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php new file mode 100644 index 0000000..e95bf5d --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/ClassInstantiationFailedException.php @@ -0,0 +1,14 @@ + + */ +final class ClassInstantiationFailedException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php b/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php new file mode 100644 index 0000000..304b727 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php @@ -0,0 +1,51 @@ + + */ +final class DiscoveryFailedException extends \Exception implements Exception +{ + /** + * @var \Exception[] + */ + private $exceptions; + + /** + * @param string $message + * @param \Exception[] $exceptions + */ + public function __construct($message, array $exceptions = []) + { + $this->exceptions = $exceptions; + + parent::__construct($message); + } + + /** + * @param \Exception[] $exceptions + */ + public static function create($exceptions) + { + $message = 'Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors'; + foreach ($exceptions as $e) { + $message .= "\n - ".$e->getMessage(); + } + $message .= "\n\n"; + + return new self($message, $exceptions); + } + + /** + * @return \Exception[] + */ + public function getExceptions() + { + return $this->exceptions; + } +} diff --git a/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php b/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php new file mode 100644 index 0000000..32f65db --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/NoCandidateFoundException.php @@ -0,0 +1,47 @@ + + */ +final class NoCandidateFoundException extends \Exception implements Exception +{ + /** + * @param string $strategy + */ + public function __construct($strategy, array $candidates) + { + $classes = array_map( + function ($a) { + return $a['class']; + }, + $candidates + ); + + $message = sprintf( + 'No valid candidate found using strategy "%s". We tested the following candidates: %s.', + $strategy, + implode(', ', array_map([$this, 'stringify'], $classes)) + ); + + parent::__construct($message); + } + + private function stringify($mixed) + { + if (is_string($mixed)) { + return $mixed; + } + + if (is_array($mixed) && 2 === count($mixed)) { + return sprintf('%s::%s', $this->stringify($mixed[0]), $mixed[1]); + } + + return is_object($mixed) ? get_class($mixed) : gettype($mixed); + } +} diff --git a/vendor/php-http/discovery/src/Exception/NotFoundException.php b/vendor/php-http/discovery/src/Exception/NotFoundException.php new file mode 100644 index 0000000..ef8b9c5 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/NotFoundException.php @@ -0,0 +1,16 @@ + + */ +/* final */ class NotFoundException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php b/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php new file mode 100644 index 0000000..a6ade73 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php @@ -0,0 +1,12 @@ + + */ +final class PuliUnavailableException extends StrategyUnavailableException +{ +} diff --git a/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php b/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php new file mode 100644 index 0000000..89ecf35 --- /dev/null +++ b/vendor/php-http/discovery/src/Exception/StrategyUnavailableException.php @@ -0,0 +1,15 @@ + + */ +class StrategyUnavailableException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php b/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php new file mode 100644 index 0000000..a0c4d5b --- /dev/null +++ b/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php @@ -0,0 +1,32 @@ + + */ +final class HttpAsyncClientDiscovery extends ClassDiscovery +{ + /** + * Finds an HTTP Async Client. + * + * @return HttpAsyncClient + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $asyncClient = static::findOneByType(HttpAsyncClient::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e); + } + + return static::instantiateClass($asyncClient); + } +} diff --git a/vendor/php-http/discovery/src/HttpClientDiscovery.php b/vendor/php-http/discovery/src/HttpClientDiscovery.php new file mode 100644 index 0000000..2501e5b --- /dev/null +++ b/vendor/php-http/discovery/src/HttpClientDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr18ClientDiscovery. + */ +final class HttpClientDiscovery extends ClassDiscovery +{ + /** + * Finds an HTTP Client. + * + * @return HttpClient + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $client = static::findOneByType(HttpClient::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".', 0, $e); + } + + return static::instantiateClass($client); + } +} diff --git a/vendor/php-http/discovery/src/MessageFactoryDiscovery.php b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php new file mode 100644 index 0000000..4ae104a --- /dev/null +++ b/vendor/php-http/discovery/src/MessageFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class MessageFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a Message Factory. + * + * @return MessageFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $messageFactory = static::findOneByType(MessageFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No php-http message factories found. Note that the php-http message factories are deprecated in favor of the PSR-17 message factories. To use the legacy Guzzle, Diactoros or Slim Framework factories of php-http, install php-http/message and php-http/message-factory and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($messageFactory); + } +} diff --git a/vendor/php-http/discovery/src/NotFoundException.php b/vendor/php-http/discovery/src/NotFoundException.php new file mode 100644 index 0000000..559afac --- /dev/null +++ b/vendor/php-http/discovery/src/NotFoundException.php @@ -0,0 +1,16 @@ + + * + * @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead. + */ +final class NotFoundException extends RealNotFoundException +{ +} diff --git a/vendor/php-http/discovery/src/Psr17Factory.php b/vendor/php-http/discovery/src/Psr17Factory.php new file mode 100644 index 0000000..f8fbfd1 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr17Factory.php @@ -0,0 +1,303 @@ + + * Copyright (c) 2015 Michael Dowling + * Copyright (c) 2015 Márk Sági-Kazár + * Copyright (c) 2015 Graham Campbell + * Copyright (c) 2016 Tobias Schultze + * Copyright (c) 2016 George Mponos + * Copyright (c) 2016-2018 Tobias Nyholm + * + * @author Nicolas Grekas + */ +class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface +{ + private $requestFactory; + private $responseFactory; + private $serverRequestFactory; + private $streamFactory; + private $uploadedFileFactory; + private $uriFactory; + + public function __construct( + ?RequestFactoryInterface $requestFactory = null, + ?ResponseFactoryInterface $responseFactory = null, + ?ServerRequestFactoryInterface $serverRequestFactory = null, + ?StreamFactoryInterface $streamFactory = null, + ?UploadedFileFactoryInterface $uploadedFileFactory = null, + ?UriFactoryInterface $uriFactory = null + ) { + $this->requestFactory = $requestFactory; + $this->responseFactory = $responseFactory; + $this->serverRequestFactory = $serverRequestFactory; + $this->streamFactory = $streamFactory; + $this->uploadedFileFactory = $uploadedFileFactory; + $this->uriFactory = $uriFactory; + + $this->setFactory($requestFactory); + $this->setFactory($responseFactory); + $this->setFactory($serverRequestFactory); + $this->setFactory($streamFactory); + $this->setFactory($uploadedFileFactory); + $this->setFactory($uriFactory); + } + + /** + * @param UriInterface|string $uri + */ + public function createRequest(string $method, $uri): RequestInterface + { + $factory = $this->requestFactory ?? $this->setFactory(Psr17FactoryDiscovery::findRequestFactory()); + + return $factory->createRequest(...\func_get_args()); + } + + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + $factory = $this->responseFactory ?? $this->setFactory(Psr17FactoryDiscovery::findResponseFactory()); + + return $factory->createResponse(...\func_get_args()); + } + + /** + * @param UriInterface|string $uri + */ + public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface + { + $factory = $this->serverRequestFactory ?? $this->setFactory(Psr17FactoryDiscovery::findServerRequestFactory()); + + return $factory->createServerRequest(...\func_get_args()); + } + + public function createServerRequestFromGlobals(?array $server = null, ?array $get = null, ?array $post = null, ?array $cookie = null, ?array $files = null, ?StreamInterface $body = null): ServerRequestInterface + { + $server = $server ?? $_SERVER; + $request = $this->createServerRequest($server['REQUEST_METHOD'] ?? 'GET', $this->createUriFromGlobals($server), $server); + + return $this->buildServerRequestFromGlobals($request, $server, $files ?? $_FILES) + ->withQueryParams($get ?? $_GET) + ->withParsedBody($post ?? $_POST) + ->withCookieParams($cookie ?? $_COOKIE) + ->withBody($body ?? $this->createStreamFromFile('php://input', 'r+')); + } + + public function createStream(string $content = ''): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStream($content); + } + + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStreamFromFile($filename, $mode); + } + + /** + * @param resource $resource + */ + public function createStreamFromResource($resource): StreamInterface + { + $factory = $this->streamFactory ?? $this->setFactory(Psr17FactoryDiscovery::findStreamFactory()); + + return $factory->createStreamFromResource($resource); + } + + public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null): UploadedFileInterface + { + $factory = $this->uploadedFileFactory ?? $this->setFactory(Psr17FactoryDiscovery::findUploadedFileFactory()); + + return $factory->createUploadedFile(...\func_get_args()); + } + + public function createUri(string $uri = ''): UriInterface + { + $factory = $this->uriFactory ?? $this->setFactory(Psr17FactoryDiscovery::findUriFactory()); + + return $factory->createUri(...\func_get_args()); + } + + public function createUriFromGlobals(?array $server = null): UriInterface + { + return $this->buildUriFromGlobals($this->createUri(''), $server ?? $_SERVER); + } + + private function setFactory($factory) + { + if (!$this->requestFactory && $factory instanceof RequestFactoryInterface) { + $this->requestFactory = $factory; + } + if (!$this->responseFactory && $factory instanceof ResponseFactoryInterface) { + $this->responseFactory = $factory; + } + if (!$this->serverRequestFactory && $factory instanceof ServerRequestFactoryInterface) { + $this->serverRequestFactory = $factory; + } + if (!$this->streamFactory && $factory instanceof StreamFactoryInterface) { + $this->streamFactory = $factory; + } + if (!$this->uploadedFileFactory && $factory instanceof UploadedFileFactoryInterface) { + $this->uploadedFileFactory = $factory; + } + if (!$this->uriFactory && $factory instanceof UriFactoryInterface) { + $this->uriFactory = $factory; + } + + return $factory; + } + + private function buildServerRequestFromGlobals(ServerRequestInterface $request, array $server, array $files): ServerRequestInterface + { + $request = $request + ->withProtocolVersion(isset($server['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $server['SERVER_PROTOCOL']) : '1.1') + ->withUploadedFiles($this->normalizeFiles($files)); + + $headers = []; + foreach ($server as $k => $v) { + if (0 === strpos($k, 'HTTP_')) { + $k = substr($k, 5); + } elseif (!\in_array($k, ['CONTENT_TYPE', 'CONTENT_LENGTH', 'CONTENT_MD5'], true)) { + continue; + } + $k = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $k)))); + + $headers[$k] = $v; + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $headers['Authorization'] = 'Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].':'.($_SERVER['PHP_AUTH_PW'] ?? '')); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + foreach ($headers as $k => $v) { + try { + $request = $request->withHeader($k, $v); + } catch (\InvalidArgumentException $e) { + // ignore invalid headers + } + } + + return $request; + } + + private function buildUriFromGlobals(UriInterface $uri, array $server): UriInterface + { + $uri = $uri->withScheme(!empty($server['HTTPS']) && 'off' !== strtolower($server['HTTPS']) ? 'https' : 'http'); + + $hasPort = false; + if (isset($server['HTTP_HOST'])) { + $parts = parse_url('http://'.$server['HTTP_HOST']); + + $uri = $uri->withHost($parts['host'] ?? 'localhost'); + + if ($parts['port'] ?? false) { + $hasPort = true; + $uri = $uri->withPort($parts['port']); + } + } else { + $uri = $uri->withHost($server['SERVER_NAME'] ?? $server['SERVER_ADDR'] ?? 'localhost'); + } + + if (!$hasPort && isset($server['SERVER_PORT'])) { + $uri = $uri->withPort($server['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($server['REQUEST_URI'])) { + $requestUriParts = explode('?', $server['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($server['QUERY_STRING'])) { + $uri = $uri->withQuery($server['QUERY_STRING']); + } + + return $uri; + } + + private function normalizeFiles(array $files): array + { + foreach ($files as $k => $v) { + if ($v instanceof UploadedFileInterface) { + continue; + } + if (!\is_array($v)) { + unset($files[$k]); + } elseif (!isset($v['tmp_name'])) { + $files[$k] = $this->normalizeFiles($v); + } else { + $files[$k] = $this->createUploadedFileFromSpec($v); + } + } + + return $files; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * @param array $value $_FILES struct + * + * @return UploadedFileInterface|UploadedFileInterface[] + */ + private function createUploadedFileFromSpec(array $value) + { + if (!is_array($tmpName = $value['tmp_name'])) { + $file = is_file($tmpName) ? $this->createStreamFromFile($tmpName, 'r') : $this->createStream(); + + return $this->createUploadedFile($file, $value['size'], $value['error'], $value['name'], $value['type']); + } + + foreach ($tmpName as $k => $v) { + $tmpName[$k] = $this->createUploadedFileFromSpec([ + 'tmp_name' => $v, + 'size' => $value['size'][$k] ?? null, + 'error' => $value['error'][$k] ?? null, + 'name' => $value['name'][$k] ?? null, + 'type' => $value['type'][$k] ?? null, + ]); + } + + return $tmpName; + } +} diff --git a/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php b/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php new file mode 100644 index 0000000..e4348b4 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php @@ -0,0 +1,137 @@ + + */ +final class Psr17FactoryDiscovery extends ClassDiscovery +{ + private static function createException($type, Exception $e) + { + return new RealNotFoundException( + 'No PSR-17 '.$type.' found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation', + 0, + $e + ); + } + + /** + * @return RequestFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findRequestFactory() + { + try { + $messageFactory = static::findOneByType(RequestFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('request factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return ResponseFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findResponseFactory() + { + try { + $messageFactory = static::findOneByType(ResponseFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('response factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return ServerRequestFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findServerRequestFactory() + { + try { + $messageFactory = static::findOneByType(ServerRequestFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('server request factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return StreamFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findStreamFactory() + { + try { + $messageFactory = static::findOneByType(StreamFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('stream factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UploadedFileFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findUploadedFileFactory() + { + try { + $messageFactory = static::findOneByType(UploadedFileFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('uploaded file factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UriFactoryInterface + * + * @throws RealNotFoundException + */ + public static function findUriFactory() + { + try { + $messageFactory = static::findOneByType(UriFactoryInterface::class); + } catch (DiscoveryFailedException $e) { + throw self::createException('url factory', $e); + } + + return static::instantiateClass($messageFactory); + } + + /** + * @return UriFactoryInterface + * + * @throws RealNotFoundException + * + * @deprecated This will be removed in 2.0. Consider using the findUriFactory() method. + */ + public static function findUrlFactory() + { + return static::findUriFactory(); + } +} diff --git a/vendor/php-http/discovery/src/Psr18Client.php b/vendor/php-http/discovery/src/Psr18Client.php new file mode 100644 index 0000000..48df783 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr18Client.php @@ -0,0 +1,52 @@ + + */ +class Psr18Client extends Psr17Factory implements ClientInterface +{ + private $client; + + public function __construct( + ?ClientInterface $client = null, + ?RequestFactoryInterface $requestFactory = null, + ?ResponseFactoryInterface $responseFactory = null, + ?ServerRequestFactoryInterface $serverRequestFactory = null, + ?StreamFactoryInterface $streamFactory = null, + ?UploadedFileFactoryInterface $uploadedFileFactory = null, + ?UriFactoryInterface $uriFactory = null + ) { + $requestFactory ?? $requestFactory = $client instanceof RequestFactoryInterface ? $client : null; + $responseFactory ?? $responseFactory = $client instanceof ResponseFactoryInterface ? $client : null; + $serverRequestFactory ?? $serverRequestFactory = $client instanceof ServerRequestFactoryInterface ? $client : null; + $streamFactory ?? $streamFactory = $client instanceof StreamFactoryInterface ? $client : null; + $uploadedFileFactory ?? $uploadedFileFactory = $client instanceof UploadedFileFactoryInterface ? $client : null; + $uriFactory ?? $uriFactory = $client instanceof UriFactoryInterface ? $client : null; + + parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory); + + $this->client = $client ?? Psr18ClientDiscovery::find(); + } + + public function sendRequest(RequestInterface $request): ResponseInterface + { + return $this->client->sendRequest($request); + } +} diff --git a/vendor/php-http/discovery/src/Psr18ClientDiscovery.php b/vendor/php-http/discovery/src/Psr18ClientDiscovery.php new file mode 100644 index 0000000..3f95418 --- /dev/null +++ b/vendor/php-http/discovery/src/Psr18ClientDiscovery.php @@ -0,0 +1,33 @@ + + */ +final class Psr18ClientDiscovery extends ClassDiscovery +{ + /** + * Finds a PSR-18 HTTP Client. + * + * @return ClientInterface + * + * @throws RealNotFoundException + */ + public static function find() + { + try { + $client = static::findOneByType(ClientInterface::class); + } catch (DiscoveryFailedException $e) { + throw new RealNotFoundException('No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter".', 0, $e); + } + + return static::instantiateClass($client); + } +} diff --git a/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php new file mode 100644 index 0000000..0fa4240 --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php @@ -0,0 +1,185 @@ + + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. + */ +final class CommonClassesStrategy implements DiscoveryStrategy +{ + /** + * @var array + */ + private static $classes = [ + MessageFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]], + ['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]], + ['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]], + ], + StreamFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]], + ['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]], + ['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]], + ], + UriFactory::class => [ + ['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]], + ['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]], + ['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]], + ['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]], + ], + HttpAsyncClient::class => [ + ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, Promise::class, [self::class, 'isPsr17FactoryInstalled']]], + ['class' => Guzzle7::class, 'condition' => Guzzle7::class], + ['class' => Guzzle6::class, 'condition' => Guzzle6::class], + ['class' => Curl::class, 'condition' => Curl::class], + ['class' => React::class, 'condition' => React::class], + ], + HttpClient::class => [ + ['class' => SymfonyHttplug::class, 'condition' => [SymfonyHttplug::class, [self::class, 'isPsr17FactoryInstalled'], [self::class, 'isSymfonyImplementingHttpClient']]], + ['class' => Guzzle7::class, 'condition' => Guzzle7::class], + ['class' => Guzzle6::class, 'condition' => Guzzle6::class], + ['class' => Guzzle5::class, 'condition' => Guzzle5::class], + ['class' => Curl::class, 'condition' => Curl::class], + ['class' => Socket::class, 'condition' => Socket::class], + ['class' => Buzz::class, 'condition' => Buzz::class], + ['class' => React::class, 'condition' => React::class], + ['class' => Cake::class, 'condition' => Cake::class], + ['class' => Artax::class, 'condition' => Artax::class], + [ + 'class' => [self::class, 'buzzInstantiate'], + 'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class], + ], + ], + Psr18Client::class => [ + [ + 'class' => [self::class, 'symfonyPsr18Instantiate'], + 'condition' => [SymfonyPsr18::class, Psr17RequestFactory::class], + ], + [ + 'class' => GuzzleHttp::class, + 'condition' => [self::class, 'isGuzzleImplementingPsr18'], + ], + [ + 'class' => [self::class, 'buzzInstantiate'], + 'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class], + ], + ], + ]; + + public static function getCandidates($type) + { + if (Psr18Client::class === $type) { + return self::getPsr18Candidates(); + } + + return self::$classes[$type] ?? []; + } + + /** + * @return array The return value is always an array with zero or more elements. Each + * element is an array with two keys ['class' => string, 'condition' => mixed]. + */ + private static function getPsr18Candidates() + { + $candidates = self::$classes[Psr18Client::class]; + + // HTTPlug 2.0 clients implements PSR18Client too. + foreach (self::$classes[HttpClient::class] as $c) { + if (!is_string($c['class'])) { + continue; + } + try { + if (ClassDiscovery::safeClassExists($c['class']) && is_subclass_of($c['class'], Psr18Client::class)) { + $candidates[] = $c; + } + } catch (\Throwable $e) { + trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-18 Client is available', get_class($e), $e->getMessage()), E_USER_WARNING); + } + } + + return $candidates; + } + + public static function buzzInstantiate() + { + return new \Buzz\Client\FileGetContents(Psr17FactoryDiscovery::findResponseFactory()); + } + + public static function symfonyPsr18Instantiate() + { + return new SymfonyPsr18(null, Psr17FactoryDiscovery::findResponseFactory(), Psr17FactoryDiscovery::findStreamFactory()); + } + + public static function isGuzzleImplementingPsr18() + { + return defined('GuzzleHttp\ClientInterface::MAJOR_VERSION'); + } + + public static function isSymfonyImplementingHttpClient() + { + return is_subclass_of(SymfonyHttplug::class, HttpClient::class); + } + + /** + * Can be used as a condition. + * + * @return bool + */ + public static function isPsr17FactoryInstalled() + { + try { + Psr17FactoryDiscovery::findResponseFactory(); + } catch (NotFoundException $e) { + return false; + } catch (\Throwable $e) { + trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-17 ResponseFactory is available', get_class($e), $e->getMessage()), E_USER_WARNING); + + return false; + } + + return true; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php new file mode 100644 index 0000000..04cf4ba --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php @@ -0,0 +1,104 @@ + + * + * Don't miss updating src/Composer/Plugin.php when adding a new supported class. + */ +final class CommonPsr17ClassesStrategy implements DiscoveryStrategy +{ + /** + * @var array + */ + private static $classes = [ + RequestFactoryInterface::class => [ + 'Phalcon\Http\Message\RequestFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\RequestFactory', + 'Http\Factory\Guzzle\RequestFactory', + 'Http\Factory\Slim\RequestFactory', + 'Laminas\Diactoros\RequestFactory', + 'Slim\Psr7\Factory\RequestFactory', + 'HttpSoft\Message\RequestFactory', + ], + ResponseFactoryInterface::class => [ + 'Phalcon\Http\Message\ResponseFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\ResponseFactory', + 'Http\Factory\Guzzle\ResponseFactory', + 'Http\Factory\Slim\ResponseFactory', + 'Laminas\Diactoros\ResponseFactory', + 'Slim\Psr7\Factory\ResponseFactory', + 'HttpSoft\Message\ResponseFactory', + ], + ServerRequestFactoryInterface::class => [ + 'Phalcon\Http\Message\ServerRequestFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\ServerRequestFactory', + 'Http\Factory\Guzzle\ServerRequestFactory', + 'Http\Factory\Slim\ServerRequestFactory', + 'Laminas\Diactoros\ServerRequestFactory', + 'Slim\Psr7\Factory\ServerRequestFactory', + 'HttpSoft\Message\ServerRequestFactory', + ], + StreamFactoryInterface::class => [ + 'Phalcon\Http\Message\StreamFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\StreamFactory', + 'Http\Factory\Guzzle\StreamFactory', + 'Http\Factory\Slim\StreamFactory', + 'Laminas\Diactoros\StreamFactory', + 'Slim\Psr7\Factory\StreamFactory', + 'HttpSoft\Message\StreamFactory', + ], + UploadedFileFactoryInterface::class => [ + 'Phalcon\Http\Message\UploadedFileFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\UploadedFileFactory', + 'Http\Factory\Guzzle\UploadedFileFactory', + 'Http\Factory\Slim\UploadedFileFactory', + 'Laminas\Diactoros\UploadedFileFactory', + 'Slim\Psr7\Factory\UploadedFileFactory', + 'HttpSoft\Message\UploadedFileFactory', + ], + UriFactoryInterface::class => [ + 'Phalcon\Http\Message\UriFactory', + 'Nyholm\Psr7\Factory\Psr17Factory', + 'GuzzleHttp\Psr7\HttpFactory', + 'Http\Factory\Diactoros\UriFactory', + 'Http\Factory\Guzzle\UriFactory', + 'Http\Factory\Slim\UriFactory', + 'Laminas\Diactoros\UriFactory', + 'Slim\Psr7\Factory\UriFactory', + 'HttpSoft\Message\UriFactory', + ], + ]; + + public static function getCandidates($type) + { + $candidates = []; + if (isset(self::$classes[$type])) { + foreach (self::$classes[$type] as $class) { + $candidates[] = ['class' => $class, 'condition' => [$class]]; + } + } + + return $candidates; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php b/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php new file mode 100644 index 0000000..1eadb14 --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php @@ -0,0 +1,23 @@ + + */ +interface DiscoveryStrategy +{ + /** + * Find a resource of a specific type. + * + * @param string $type + * + * @return array The return value is always an array with zero or more elements. Each + * element is an array with two keys ['class' => string, 'condition' => mixed]. + * + * @throws StrategyUnavailableException if we cannot use this strategy + */ + public static function getCandidates($type); +} diff --git a/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php b/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php new file mode 100644 index 0000000..77b9d27 --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php @@ -0,0 +1,24 @@ + + */ +final class MockClientStrategy implements DiscoveryStrategy +{ + public static function getCandidates($type) + { + if (is_a(HttpClient::class, $type, true) || is_a(HttpAsyncClient::class, $type, true)) { + return [['class' => Mock::class, 'condition' => Mock::class]]; + } + + return []; + } +} diff --git a/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php new file mode 100644 index 0000000..74b78b8 --- /dev/null +++ b/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php @@ -0,0 +1,90 @@ + + * @author Márk Sági-Kazár + */ +class PuliBetaStrategy implements DiscoveryStrategy +{ + /** + * @var GeneratedPuliFactory + */ + protected static $puliFactory; + + /** + * @var Discovery + */ + protected static $puliDiscovery; + + /** + * @return GeneratedPuliFactory + * + * @throws PuliUnavailableException + */ + private static function getPuliFactory() + { + if (null === self::$puliFactory) { + if (!defined('PULI_FACTORY_CLASS')) { + throw new PuliUnavailableException('Puli Factory is not available'); + } + + $puliFactoryClass = PULI_FACTORY_CLASS; + + if (!ClassDiscovery::safeClassExists($puliFactoryClass)) { + throw new PuliUnavailableException('Puli Factory class does not exist'); + } + + self::$puliFactory = new $puliFactoryClass(); + } + + return self::$puliFactory; + } + + /** + * Returns the Puli discovery layer. + * + * @return Discovery + * + * @throws PuliUnavailableException + */ + private static function getPuliDiscovery() + { + if (!isset(self::$puliDiscovery)) { + $factory = self::getPuliFactory(); + $repository = $factory->createRepository(); + + self::$puliDiscovery = $factory->createDiscovery($repository); + } + + return self::$puliDiscovery; + } + + public static function getCandidates($type) + { + $returnData = []; + $bindings = self::getPuliDiscovery()->findBindings($type); + + foreach ($bindings as $binding) { + $condition = true; + if ($binding->hasParameterValue('depends')) { + $condition = $binding->getParameterValue('depends'); + } + $returnData[] = ['class' => $binding->getClassName(), 'condition' => $condition]; + } + + return $returnData; + } +} diff --git a/vendor/php-http/discovery/src/StreamFactoryDiscovery.php b/vendor/php-http/discovery/src/StreamFactoryDiscovery.php new file mode 100644 index 0000000..e11c49a --- /dev/null +++ b/vendor/php-http/discovery/src/StreamFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class StreamFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a Stream Factory. + * + * @return StreamFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $streamFactory = static::findOneByType(StreamFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($streamFactory); + } +} diff --git a/vendor/php-http/discovery/src/UriFactoryDiscovery.php b/vendor/php-http/discovery/src/UriFactoryDiscovery.php new file mode 100644 index 0000000..db3add2 --- /dev/null +++ b/vendor/php-http/discovery/src/UriFactoryDiscovery.php @@ -0,0 +1,34 @@ + + * + * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery. + */ +final class UriFactoryDiscovery extends ClassDiscovery +{ + /** + * Finds a URI Factory. + * + * @return UriFactory + * + * @throws Exception\NotFoundException + */ + public static function find() + { + try { + $uriFactory = static::findOneByType(UriFactory::class); + } catch (DiscoveryFailedException $e) { + throw new NotFoundException('No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.', 0, $e); + } + + return static::instantiateClass($uriFactory); + } +} diff --git a/vendor/react/promise/CHANGELOG.md b/vendor/react/promise/CHANGELOG.md new file mode 100644 index 0000000..c5d7303 --- /dev/null +++ b/vendor/react/promise/CHANGELOG.md @@ -0,0 +1,156 @@ +# Changelog + +## 3.2.0 (2024-05-24) + +* Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations. + (#260 by @Ayesh) + +* Feature: Include previous exceptions when reporting unhandled promise rejections. + (#262 by @clue) + +* Update test suite to improve PHP 8.4+ support. + (#261 by @SimonFrings) + +## 3.1.0 (2023-11-16) + +* Feature: Full PHP 8.3 compatibility. + (#255 by @clue) + +* Feature: Describe all callable arguments with types for `Promise` and `Deferred`. + (#253 by @clue) + +* Update test suite and minor documentation improvements. + (#251 by @ondrejmirtes and #250 by @SQKo) + +## 3.0.0 (2023-07-11) + +A major new feature release, see [**release announcement**](https://clue.engineering/2023/announcing-reactphp-promise-v3). + +* We'd like to emphasize that this component is production ready and battle-tested. + We plan to support all long-term support (LTS) releases for at least 24 months, + so you have a rock-solid foundation to build on top of. + +* The v3 release will be the way forward for this package. However, we will still + actively support v2 and v1 to provide a smooth upgrade path for those not yet + on the latest versions. + +This update involves some major new features and a minor BC break over the +`v2.0.0` release. We've tried hard to avoid BC breaks where possible and +minimize impact otherwise. We expect that most consumers of this package will be +affected by BC breaks, but updating should take no longer than a few minutes. +See below for more details: + +* BC break: PHP 8.1+ recommended, PHP 7.1+ required. + (#138 and #149 by @WyriHaximus) + +* Feature / BC break: The `PromiseInterface` now includes the functionality of the old ~~`ExtendedPromiseInterface`~~ and ~~`CancellablePromiseInterface`~~. + Each promise now always includes the `then()`, `catch()`, `finally()` and `cancel()` methods. + The new `catch()` and `finally()` methods replace the deprecated ~~`otherwise()`~~ and ~~`always()`~~ methods which continue to exist for BC reasons. + The old ~~`ExtendedPromiseInterface`~~ and ~~`CancellablePromiseInterface`~~ are no longer needed and have been removed as a consequence. + (#75 by @jsor and #208 by @clue and @WyriHaximus) + + ```php + // old (multiple interfaces may or may not be implemented) + assert($promise instanceof PromiseInterface); + assert(method_exists($promise, 'then')); + if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'otherwise')); } + if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'always')); } + if ($promise instanceof CancellablePromiseInterface) { assert(method_exists($promise, 'cancel')); } + + // new (single PromiseInterface with all methods) + assert($promise instanceof PromiseInterface); + assert(method_exists($promise, 'then')); + assert(method_exists($promise, 'catch')); + assert(method_exists($promise, 'finally')); + assert(method_exists($promise, 'cancel')); + ``` + +* Feature / BC break: Improve type safety of promises. Require `mixed` fulfillment value argument and `Throwable` (or `Exception`) as rejection reason. + Add PHPStan template types to ensure strict types for `resolve(T $value): PromiseInterface` and `reject(Throwable $reason): PromiseInterface`. + It is no longer possible to resolve a promise without a value (use `null` instead) or reject a promise without a reason (use `Throwable` instead). + (#93, #141 and #142 by @jsor, #138, #149 and #247 by @WyriHaximus and #213 and #246 by @clue) + + ```php + // old (arguments used to be optional) + $promise = resolve(); + $promise = reject(); + + // new (already supported before) + $promise = resolve(null); + $promise = reject(new RuntimeException()); + ``` + +* Feature / BC break: Report all unhandled rejections by default and remove ~~`done()`~~ method. + Add new `set_rejection_handler()` function to set the global rejection handler for unhandled promise rejections. + (#248, #249 and #224 by @clue) + + ```php + // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 + reject(new RuntimeException('Unhandled')); + ``` + +* BC break: Remove all deprecated APIs and reduce API surface. + Remove ~~`some()`~~, ~~`map()`~~, ~~`reduce()`~~ functions, use `any()` and `all()` functions instead. + Remove internal ~~`FulfilledPromise`~~ and ~~`RejectedPromise`~~ classes, use `resolve()` and `reject()` functions instead. + Remove legacy promise progress API (deprecated third argument to `then()` method) and deprecated ~~`LazyPromise`~~ class. + (#32 and #98 by @jsor and #164, #219 and #220 by @clue) + +* BC break: Make all classes final to encourage composition over inheritance. + (#80 by @jsor) + +* Feature / BC break: Require `array` (or `iterable`) type for `all()` + `race()` + `any()` functions and bring in line with ES6 specification. + These functions now require a single argument with a variable number of promises or values as input. + (#225 by @clue and #35 by @jsor) + +* Fix / BC break: Fix `race()` to return a forever pending promise when called with an empty `array` (or `iterable`) and bring in line with ES6 specification. + (#83 by @jsor and #225 by @clue) + +* Minor performance improvements by initializing `Deferred` in the constructor and avoiding `call_user_func()` calls. + (#151 by @WyriHaximus and #171 by @Kubo2) + +* Minor documentation improvements. + (#110 by @seregazhuk, #132 by @CharlotteDunois, #145 by @danielecr, #178 by @WyriHaximus, #189 by @srdante, #212 by @clue, #214, #239 and #243 by @SimonFrings and #231 by @nhedger) + +The following changes had to be ported to this release due to our branching +strategy, but also appeared in the [`2.x` branch](https://github.com/reactphp/promise/tree/2.x): + +* Feature: Support union types and address deprecation of `ReflectionType::getClass()` (PHP 8+). + (#197 by @cdosoftei and @SimonFrings) + +* Feature: Support intersection types (PHP 8.1+). + (#209 by @bzikarsky) + +* Feature: Support DNS types (PHP 8.2+). + (#236 by @nhedger) + +* Feature: Port all memory improvements from `2.x` to `3.x`. + (#150 by @clue and @WyriHaximus) + +* Fix: Fix checking whether cancellable promise is an object and avoid possible warning. + (#161 by @smscr) + +* Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. + (#134 by @WyriHaximus) + +* Improve test suite, update PHPUnit and PHP versions and add `.gitattributes` to exclude dev files from exports. + (#107 by @carusogabriel, #148 and #234 by @WyriHaximus, #153 by @reedy, #162, #230 and #240 by @clue, #173, #177, #185 and #199 by @SimonFrings, #193 by @woodongwong and #210 by @bzikarsky) + +The following changes were originally planned for this release but later reverted +and are not part of the final release: + +* Add iterative callback queue handler to avoid recursion (later removed to improve Fiber support). + (#28, #82 and #86 by @jsor, #158 by @WyriHaximus and #229 and #238 by @clue) + +* Trigger an `E_USER_ERROR` instead of throwing an exception from `done()` (later removed entire `done()` method to globally report unhandled rejections). + (#97 by @jsor and #224 and #248 by @clue) + +* Add type declarations for `some()` (later removed entire `some()` function). + (#172 by @WyriHaximus and #219 by @clue) + +## 2.0.0 (2013-12-10) + +See [`2.x` CHANGELOG](https://github.com/reactphp/promise/blob/2.x/CHANGELOG.md) for more details. + +## 1.0.0 (2012-11-07) + +See [`1.x` CHANGELOG](https://github.com/reactphp/promise/blob/1.x/CHANGELOG.md) for more details. diff --git a/vendor/react/promise/LICENSE b/vendor/react/promise/LICENSE new file mode 100644 index 0000000..21c1357 --- /dev/null +++ b/vendor/react/promise/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/react/promise/README.md b/vendor/react/promise/README.md new file mode 100644 index 0000000..2108d98 --- /dev/null +++ b/vendor/react/promise/README.md @@ -0,0 +1,722 @@ +Promise +======= + +A lightweight implementation of +[CommonJS Promises/A](http://wiki.commonjs.org/wiki/Promises/A) for PHP. + +[![CI status](https://github.com/reactphp/promise/workflows/CI/badge.svg)](https://github.com/reactphp/promise/actions) +[![installs on Packagist](https://img.shields.io/packagist/dt/react/promise?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/react/promise) + +Table of Contents +----------------- + +1. [Introduction](#introduction) +2. [Concepts](#concepts) + * [Deferred](#deferred) + * [Promise](#promise-1) +3. [API](#api) + * [Deferred](#deferred-1) + * [Deferred::promise()](#deferredpromise) + * [Deferred::resolve()](#deferredresolve) + * [Deferred::reject()](#deferredreject) + * [PromiseInterface](#promiseinterface) + * [PromiseInterface::then()](#promiseinterfacethen) + * [PromiseInterface::catch()](#promiseinterfacecatch) + * [PromiseInterface::finally()](#promiseinterfacefinally) + * [PromiseInterface::cancel()](#promiseinterfacecancel) + * [~~PromiseInterface::otherwise()~~](#promiseinterfaceotherwise) + * [~~PromiseInterface::always()~~](#promiseinterfacealways) + * [Promise](#promise-2) + * [Functions](#functions) + * [resolve()](#resolve) + * [reject()](#reject) + * [all()](#all) + * [race()](#race) + * [any()](#any) + * [set_rejection_handler()](#set_rejection_handler) +4. [Examples](#examples) + * [How to use Deferred](#how-to-use-deferred) + * [How promise forwarding works](#how-promise-forwarding-works) + * [Resolution forwarding](#resolution-forwarding) + * [Rejection forwarding](#rejection-forwarding) + * [Mixed resolution and rejection forwarding](#mixed-resolution-and-rejection-forwarding) +5. [Install](#install) +6. [Tests](#tests) +7. [Credits](#credits) +8. [License](#license) + +Introduction +------------ + +Promise is a library implementing +[CommonJS Promises/A](http://wiki.commonjs.org/wiki/Promises/A) for PHP. + +It also provides several other useful promise-related concepts, such as joining +multiple promises and mapping and reducing collections of promises. + +If you've never heard about promises before, +[read this first](https://gist.github.com/domenic/3889970). + +Concepts +-------- + +### Deferred + +A **Deferred** represents a computation or unit of work that may not have +completed yet. Typically (but not always), that computation will be something +that executes asynchronously and completes at some point in the future. + +### Promise + +While a deferred represents the computation itself, a **Promise** represents +the result of that computation. Thus, each deferred has a promise that acts as +a placeholder for its actual result. + +API +--- + +### Deferred + +A deferred represents an operation whose resolution is pending. It has separate +promise and resolver parts. + +```php +$deferred = new React\Promise\Deferred(); + +$promise = $deferred->promise(); + +$deferred->resolve(mixed $value); +$deferred->reject(\Throwable $reason); +``` + +The `promise` method returns the promise of the deferred. + +The `resolve` and `reject` methods control the state of the deferred. + +The constructor of the `Deferred` accepts an optional `$canceller` argument. +See [Promise](#promise-2) for more information. + +#### Deferred::promise() + +```php +$promise = $deferred->promise(); +``` + +Returns the promise of the deferred, which you can hand out to others while +keeping the authority to modify its state to yourself. + +#### Deferred::resolve() + +```php +$deferred->resolve(mixed $value); +``` + +Resolves the promise returned by `promise()`. All consumers are notified by +having `$onFulfilled` (which they registered via `$promise->then()`) called with +`$value`. + +If `$value` itself is a promise, the promise will transition to the state of +this promise once it is resolved. + +See also the [`resolve()` function](#resolve). + +#### Deferred::reject() + +```php +$deferred->reject(\Throwable $reason); +``` + +Rejects the promise returned by `promise()`, signalling that the deferred's +computation failed. +All consumers are notified by having `$onRejected` (which they registered via +`$promise->then()`) called with `$reason`. + +See also the [`reject()` function](#reject). + +### PromiseInterface + +The promise interface provides the common interface for all promise +implementations. +See [Promise](#promise-2) for the only public implementation exposed by this +package. + +A promise represents an eventual outcome, which is either fulfillment (success) +and an associated value, or rejection (failure) and an associated reason. + +Once in the fulfilled or rejected state, a promise becomes immutable. +Neither its state nor its result (or error) can be modified. + +#### PromiseInterface::then() + +```php +$transformedPromise = $promise->then(callable $onFulfilled = null, callable $onRejected = null); +``` + +Transforms a promise's value by applying a function to the promise's fulfillment +or rejection value. Returns a new promise for the transformed result. + +The `then()` method registers new fulfilled and rejection handlers with a promise +(all parameters are optional): + + * `$onFulfilled` will be invoked once the promise is fulfilled and passed + the result as the first argument. + * `$onRejected` will be invoked once the promise is rejected and passed the + reason as the first argument. + +It returns a new promise that will fulfill with the return value of either +`$onFulfilled` or `$onRejected`, whichever is called, or will reject with +the thrown exception if either throws. + +A promise makes the following guarantees about handlers registered in +the same call to `then()`: + + 1. Only one of `$onFulfilled` or `$onRejected` will be called, + never both. + 2. `$onFulfilled` and `$onRejected` will never be called more + than once. + +#### See also + +* [resolve()](#resolve) - Creating a resolved promise +* [reject()](#reject) - Creating a rejected promise + +#### PromiseInterface::catch() + +```php +$promise->catch(callable $onRejected); +``` + +Registers a rejection handler for promise. It is a shortcut for: + +```php +$promise->then(null, $onRejected); +``` + +Additionally, you can type hint the `$reason` argument of `$onRejected` to catch +only specific errors. + +```php +$promise + ->catch(function (\RuntimeException $reason) { + // Only catch \RuntimeException instances + // All other types of errors will propagate automatically + }) + ->catch(function (\Throwable $reason) { + // Catch other errors + }); +``` + +#### PromiseInterface::finally() + +```php +$newPromise = $promise->finally(callable $onFulfilledOrRejected); +``` + +Allows you to execute "cleanup" type tasks in a promise chain. + +It arranges for `$onFulfilledOrRejected` to be called, with no arguments, +when the promise is either fulfilled or rejected. + +* If `$promise` fulfills, and `$onFulfilledOrRejected` returns successfully, + `$newPromise` will fulfill with the same value as `$promise`. +* If `$promise` fulfills, and `$onFulfilledOrRejected` throws or returns a + rejected promise, `$newPromise` will reject with the thrown exception or + rejected promise's reason. +* If `$promise` rejects, and `$onFulfilledOrRejected` returns successfully, + `$newPromise` will reject with the same reason as `$promise`. +* If `$promise` rejects, and `$onFulfilledOrRejected` throws or returns a + rejected promise, `$newPromise` will reject with the thrown exception or + rejected promise's reason. + +`finally()` behaves similarly to the synchronous finally statement. When combined +with `catch()`, `finally()` allows you to write code that is similar to the familiar +synchronous catch/finally pair. + +Consider the following synchronous code: + +```php +try { + return doSomething(); +} catch (\Throwable $e) { + return handleError($e); +} finally { + cleanup(); +} +``` + +Similar asynchronous code (with `doSomething()` that returns a promise) can be +written: + +```php +return doSomething() + ->catch('handleError') + ->finally('cleanup'); +``` + +#### PromiseInterface::cancel() + +``` php +$promise->cancel(); +``` + +The `cancel()` method notifies the creator of the promise that there is no +further interest in the results of the operation. + +Once a promise is settled (either fulfilled or rejected), calling `cancel()` on +a promise has no effect. + +#### ~~PromiseInterface::otherwise()~~ + +> Deprecated since v3.0.0, see [`catch()`](#promiseinterfacecatch) instead. + +The `otherwise()` method registers a rejection handler for a promise. + +This method continues to exist only for BC reasons and to ease upgrading +between versions. It is an alias for: + +```php +$promise->catch($onRejected); +``` + +#### ~~PromiseInterface::always()~~ + +> Deprecated since v3.0.0, see [`finally()`](#promiseinterfacefinally) instead. + +The `always()` method allows you to execute "cleanup" type tasks in a promise chain. + +This method continues to exist only for BC reasons and to ease upgrading +between versions. It is an alias for: + +```php +$promise->finally($onFulfilledOrRejected); +``` + +### Promise + +Creates a promise whose state is controlled by the functions passed to +`$resolver`. + +```php +$resolver = function (callable $resolve, callable $reject) { + // Do some work, possibly asynchronously, and then + // resolve or reject. + + $resolve($awesomeResult); + // or throw new Exception('Promise rejected'); + // or $resolve($anotherPromise); + // or $reject($nastyError); +}; + +$canceller = function () { + // Cancel/abort any running operations like network connections, streams etc. + + // Reject promise by throwing an exception + throw new Exception('Promise cancelled'); +}; + +$promise = new React\Promise\Promise($resolver, $canceller); +``` + +The promise constructor receives a resolver function and an optional canceller +function which both will be called with two arguments: + + * `$resolve($value)` - Primary function that seals the fate of the + returned promise. Accepts either a non-promise value, or another promise. + When called with a non-promise value, fulfills promise with that value. + When called with another promise, e.g. `$resolve($otherPromise)`, promise's + fate will be equivalent to that of `$otherPromise`. + * `$reject($reason)` - Function that rejects the promise. It is recommended to + just throw an exception instead of using `$reject()`. + +If the resolver or canceller throw an exception, the promise will be rejected +with that thrown exception as the rejection reason. + +The resolver function will be called immediately, the canceller function only +once all consumers called the `cancel()` method of the promise. + +### Functions + +Useful functions for creating and joining collections of promises. + +All functions working on promise collections (like `all()`, `race()`, +etc.) support cancellation. This means, if you call `cancel()` on the returned +promise, all promises in the collection are cancelled. + +#### resolve() + +```php +$promise = React\Promise\resolve(mixed $promiseOrValue); +``` + +Creates a promise for the supplied `$promiseOrValue`. + +If `$promiseOrValue` is a value, it will be the resolution value of the +returned promise. + +If `$promiseOrValue` is a thenable (any object that provides a `then()` method), +a trusted promise that follows the state of the thenable is returned. + +If `$promiseOrValue` is a promise, it will be returned as is. + +The resulting `$promise` implements the [`PromiseInterface`](#promiseinterface) +and can be consumed like any other promise: + +```php +$promise = React\Promise\resolve(42); + +$promise->then(function (int $result): void { + var_dump($result); +}, function (\Throwable $e): void { + echo 'Error: ' . $e->getMessage() . PHP_EOL; +}); +``` + +#### reject() + +```php +$promise = React\Promise\reject(\Throwable $reason); +``` + +Creates a rejected promise for the supplied `$reason`. + +Note that the [`\Throwable`](https://www.php.net/manual/en/class.throwable.php) interface introduced in PHP 7 covers +both user land [`\Exception`](https://www.php.net/manual/en/class.exception.php)'s and +[`\Error`](https://www.php.net/manual/en/class.error.php) internal PHP errors. By enforcing `\Throwable` as reason to +reject a promise, any language error or user land exception can be used to reject a promise. + +The resulting `$promise` implements the [`PromiseInterface`](#promiseinterface) +and can be consumed like any other promise: + +```php +$promise = React\Promise\reject(new RuntimeException('Request failed')); + +$promise->then(function (int $result): void { + var_dump($result); +}, function (\Throwable $e): void { + echo 'Error: ' . $e->getMessage() . PHP_EOL; +}); +``` + +Note that rejected promises should always be handled similar to how any +exceptions should always be caught in a `try` + `catch` block. If you remove the +last reference to a rejected promise that has not been handled, it will +report an unhandled promise rejection: + +```php +function incorrect(): int +{ + $promise = React\Promise\reject(new RuntimeException('Request failed')); + + // Commented out: No rejection handler registered here. + // $promise->then(null, function (\Throwable $e): void { /* ignore */ }); + + // Returning from a function will remove all local variable references, hence why + // this will report an unhandled promise rejection here. + return 42; +} + +// Calling this function will log an error message plus its stack trace: +// Unhandled promise rejection with RuntimeException: Request failed in example.php:10 +incorrect(); +``` + +A rejected promise will be considered "handled" if you catch the rejection +reason with either the [`then()` method](#promiseinterfacethen), the +[`catch()` method](#promiseinterfacecatch), or the +[`finally()` method](#promiseinterfacefinally). Note that each of these methods +return a new promise that may again be rejected if you re-throw an exception. + +A rejected promise will also be considered "handled" if you abort the operation +with the [`cancel()` method](#promiseinterfacecancel) (which in turn would +usually reject the promise if it is still pending). + +See also the [`set_rejection_handler()` function](#set_rejection_handler). + +#### all() + +```php +$promise = React\Promise\all(iterable $promisesOrValues); +``` + +Returns a promise that will resolve only once all the items in +`$promisesOrValues` have resolved. The resolution value of the returned promise +will be an array containing the resolution values of each of the items in +`$promisesOrValues`. + +#### race() + +```php +$promise = React\Promise\race(iterable $promisesOrValues); +``` + +Initiates a competitive race that allows one winner. Returns a promise which is +resolved in the same way the first settled promise resolves. + +The returned promise will become **infinitely pending** if `$promisesOrValues` +contains 0 items. + +#### any() + +```php +$promise = React\Promise\any(iterable $promisesOrValues); +``` + +Returns a promise that will resolve when any one of the items in +`$promisesOrValues` resolves. The resolution value of the returned promise +will be the resolution value of the triggering item. + +The returned promise will only reject if *all* items in `$promisesOrValues` are +rejected. The rejection value will be a `React\Promise\Exception\CompositeException` +which holds all rejection reasons. The rejection reasons can be obtained with +`CompositeException::getThrowables()`. + +The returned promise will also reject with a `React\Promise\Exception\LengthException` +if `$promisesOrValues` contains 0 items. + +#### set_rejection_handler() + +```php +React\Promise\set_rejection_handler(?callable $callback): ?callable; +``` + +Sets the global rejection handler for unhandled promise rejections. + +Note that rejected promises should always be handled similar to how any +exceptions should always be caught in a `try` + `catch` block. If you remove +the last reference to a rejected promise that has not been handled, it will +report an unhandled promise rejection. See also the [`reject()` function](#reject) +for more details. + +The `?callable $callback` argument MUST be a valid callback function that +accepts a single `Throwable` argument or a `null` value to restore the +default promise rejection handler. The return value of the callback function +will be ignored and has no effect, so you SHOULD return a `void` value. The +callback function MUST NOT throw or the program will be terminated with a +fatal error. + +The function returns the previous rejection handler or `null` if using the +default promise rejection handler. + +The default promise rejection handler will log an error message plus its stack +trace: + +```php +// Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 +React\Promise\reject(new RuntimeException('Unhandled')); +``` + +The promise rejection handler may be used to use customize the log message or +write to custom log targets. As a rule of thumb, this function should only be +used as a last resort and promise rejections are best handled with either the +[`then()` method](#promiseinterfacethen), the +[`catch()` method](#promiseinterfacecatch), or the +[`finally()` method](#promiseinterfacefinally). +See also the [`reject()` function](#reject) for more details. + +Examples +-------- + +### How to use Deferred + +```php +function getAwesomeResultPromise() +{ + $deferred = new React\Promise\Deferred(); + + // Execute a Node.js-style function using the callback pattern + computeAwesomeResultAsynchronously(function (\Throwable $error, $result) use ($deferred) { + if ($error) { + $deferred->reject($error); + } else { + $deferred->resolve($result); + } + }); + + // Return the promise + return $deferred->promise(); +} + +getAwesomeResultPromise() + ->then( + function ($value) { + // Deferred resolved, do something with $value + }, + function (\Throwable $reason) { + // Deferred rejected, do something with $reason + } + ); +``` + +### How promise forwarding works + +A few simple examples to show how the mechanics of Promises/A forwarding works. +These examples are contrived, of course, and in real usage, promise chains will +typically be spread across several function calls, or even several levels of +your application architecture. + +#### Resolution forwarding + +Resolved promises forward resolution values to the next promise. +The first promise, `$deferred->promise()`, will resolve with the value passed +to `$deferred->resolve()` below. + +Each call to `then()` returns a new promise that will resolve with the return +value of the previous handler. This creates a promise "pipeline". + +```php +$deferred = new React\Promise\Deferred(); + +$deferred->promise() + ->then(function ($x) { + // $x will be the value passed to $deferred->resolve() below + // and returns a *new promise* for $x + 1 + return $x + 1; + }) + ->then(function ($x) { + // $x === 2 + // This handler receives the return value of the + // previous handler. + return $x + 1; + }) + ->then(function ($x) { + // $x === 3 + // This handler receives the return value of the + // previous handler. + return $x + 1; + }) + ->then(function ($x) { + // $x === 4 + // This handler receives the return value of the + // previous handler. + echo 'Resolve ' . $x; + }); + +$deferred->resolve(1); // Prints "Resolve 4" +``` + +#### Rejection forwarding + +Rejected promises behave similarly, and also work similarly to try/catch: +When you catch an exception, you must rethrow for it to propagate. + +Similarly, when you handle a rejected promise, to propagate the rejection, +"rethrow" it by either returning a rejected promise, or actually throwing +(since promise translates thrown exceptions into rejections) + +```php +$deferred = new React\Promise\Deferred(); + +$deferred->promise() + ->then(function ($x) { + throw new \Exception($x + 1); + }) + ->catch(function (\Exception $x) { + // Propagate the rejection + throw $x; + }) + ->catch(function (\Exception $x) { + // Can also propagate by returning another rejection + return React\Promise\reject( + new \Exception($x->getMessage() + 1) + ); + }) + ->catch(function ($x) { + echo 'Reject ' . $x->getMessage(); // 3 + }); + +$deferred->resolve(1); // Prints "Reject 3" +``` + +#### Mixed resolution and rejection forwarding + +Just like try/catch, you can choose to propagate or not. Mixing resolutions and +rejections will still forward handler results in a predictable way. + +```php +$deferred = new React\Promise\Deferred(); + +$deferred->promise() + ->then(function ($x) { + return $x + 1; + }) + ->then(function ($x) { + throw new \Exception($x + 1); + }) + ->catch(function (\Exception $x) { + // Handle the rejection, and don't propagate. + // This is like catch without a rethrow + return $x->getMessage() + 1; + }) + ->then(function ($x) { + echo 'Mixed ' . $x; // 4 + }); + +$deferred->resolve(1); // Prints "Mixed 4" +``` + +Install +------- + +The recommended way to install this library is [through Composer](https://getcomposer.org/). +[New to Composer?](https://getcomposer.org/doc/00-intro.md) + +This project follows [SemVer](https://semver.org/). +This will install the latest supported version from this branch: + +```bash +composer require react/promise:^3.2 +``` + +See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. + +This project aims to run on any platform and thus does not require any PHP +extensions and supports running on PHP 7.1 through current PHP 8+. +It's *highly recommended to use the latest supported PHP version* for this project. + +We're committed to providing long-term support (LTS) options and to provide a +smooth upgrade path. If you're using an older PHP version, you may use the +[`2.x` branch](https://github.com/reactphp/promise/tree/2.x) (PHP 5.4+) or +[`1.x` branch](https://github.com/reactphp/promise/tree/1.x) (PHP 5.3+) which both +provide a compatible API but do not take advantage of newer language features. +You may target multiple versions at the same time to support a wider range of +PHP versions like this: + +```bash +composer require "react/promise:^3 || ^2 || ^1" +``` + +## Tests + +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](https://getcomposer.org/): + +```bash +composer install +``` + +To run the test suite, go to the project root and run: + +```bash +vendor/bin/phpunit +``` + +On top of this, we use PHPStan on max level to ensure type safety across the project: + +```bash +vendor/bin/phpstan +``` + +Credits +------- + +Promise is a port of [when.js](https://github.com/cujojs/when) +by [Brian Cavalier](https://github.com/briancavalier). + +Also, large parts of the documentation have been ported from the when.js +[Wiki](https://github.com/cujojs/when/wiki) and the +[API docs](https://github.com/cujojs/when/blob/master/docs/api.md). + +License +------- + +Released under the [MIT](LICENSE) license. diff --git a/vendor/react/promise/composer.json b/vendor/react/promise/composer.json new file mode 100644 index 0000000..6bf687d --- /dev/null +++ b/vendor/react/promise/composer.json @@ -0,0 +1,57 @@ +{ + "name": "react/promise", + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "license": "MIT", + "authors": [ + { + "name": "Jan Sorgalla", + "homepage": "https://sorgalla.com/", + "email": "jsorgalla@gmail.com" + }, + { + "name": "Christian Lück", + "homepage": "https://clue.engineering/", + "email": "christian@clue.engineering" + }, + { + "name": "Cees-Jan Kiewiet", + "homepage": "https://wyrihaximus.net/", + "email": "reactphp@ceesjankiewiet.nl" + }, + { + "name": "Chris Boden", + "homepage": "https://cboden.dev/", + "email": "cboden@gmail.com" + } + ], + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "autoload-dev": { + "psr-4": { + "React\\Promise\\": [ + "tests/fixtures/", + "tests/" + ] + }, + "files": [ + "tests/Fiber.php" + ] + }, + "keywords": [ + "promise", + "promises" + ] +} diff --git a/vendor/react/promise/src/Deferred.php b/vendor/react/promise/src/Deferred.php new file mode 100644 index 0000000..80b8fcf --- /dev/null +++ b/vendor/react/promise/src/Deferred.php @@ -0,0 +1,52 @@ + + */ + private $promise; + + /** @var callable(T):void */ + private $resolveCallback; + + /** @var callable(\Throwable):void */ + private $rejectCallback; + + /** + * @param (callable(callable(T):void,callable(\Throwable):void):void)|null $canceller + */ + public function __construct(?callable $canceller = null) + { + $this->promise = new Promise(function ($resolve, $reject): void { + $this->resolveCallback = $resolve; + $this->rejectCallback = $reject; + }, $canceller); + } + + /** + * @return PromiseInterface + */ + public function promise(): PromiseInterface + { + return $this->promise; + } + + /** + * @param T $value + */ + public function resolve($value): void + { + ($this->resolveCallback)($value); + } + + public function reject(\Throwable $reason): void + { + ($this->rejectCallback)($reason); + } +} diff --git a/vendor/react/promise/src/Exception/CompositeException.php b/vendor/react/promise/src/Exception/CompositeException.php new file mode 100644 index 0000000..2e672a0 --- /dev/null +++ b/vendor/react/promise/src/Exception/CompositeException.php @@ -0,0 +1,32 @@ +throwables = $throwables; + } + + /** + * @return \Throwable[] + */ + public function getThrowables(): array + { + return $this->throwables; + } +} diff --git a/vendor/react/promise/src/Exception/LengthException.php b/vendor/react/promise/src/Exception/LengthException.php new file mode 100644 index 0000000..775c48d --- /dev/null +++ b/vendor/react/promise/src/Exception/LengthException.php @@ -0,0 +1,7 @@ +started) { + return; + } + + $this->started = true; + $this->drain(); + } + + /** + * @param mixed $cancellable + */ + public function enqueue($cancellable): void + { + if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) { + return; + } + + $length = \array_push($this->queue, $cancellable); + + if ($this->started && 1 === $length) { + $this->drain(); + } + } + + private function drain(): void + { + for ($i = \key($this->queue); isset($this->queue[$i]); $i++) { + $cancellable = $this->queue[$i]; + assert(\method_exists($cancellable, 'cancel')); + + $exception = null; + + try { + $cancellable->cancel(); + } catch (\Throwable $exception) { + } + + unset($this->queue[$i]); + + if ($exception) { + throw $exception; + } + } + + $this->queue = []; + } +} diff --git a/vendor/react/promise/src/Internal/FulfilledPromise.php b/vendor/react/promise/src/Internal/FulfilledPromise.php new file mode 100644 index 0000000..8a66cff --- /dev/null +++ b/vendor/react/promise/src/Internal/FulfilledPromise.php @@ -0,0 +1,90 @@ + + */ +final class FulfilledPromise implements PromiseInterface +{ + /** @var T */ + private $value; + + /** + * @param T $value + * @throws \InvalidArgumentException + */ + public function __construct($value = null) + { + if ($value instanceof PromiseInterface) { + throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.'); + } + + $this->value = $value; + } + + /** + * @template TFulfilled + * @param ?(callable((T is void ? null : T)): (PromiseInterface|TFulfilled)) $onFulfilled + * @return PromiseInterface<($onFulfilled is null ? T : TFulfilled)> + */ + public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface + { + if (null === $onFulfilled) { + return $this; + } + + try { + /** + * @var PromiseInterface|T $result + */ + $result = $onFulfilled($this->value); + return resolve($result); + } catch (\Throwable $exception) { + return new RejectedPromise($exception); + } + } + + public function catch(callable $onRejected): PromiseInterface + { + return $this; + } + + public function finally(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface { + /** @var T $value */ + return resolve($onFulfilledOrRejected())->then(function () use ($value) { + return $value; + }); + }); + } + + public function cancel(): void + { + } + + /** + * @deprecated 3.0.0 Use `catch()` instead + * @see self::catch() + */ + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->catch($onRejected); + } + + /** + * @deprecated 3.0.0 Use `finally()` instead + * @see self::finally() + */ + public function always(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->finally($onFulfilledOrRejected); + } +} diff --git a/vendor/react/promise/src/Internal/RejectedPromise.php b/vendor/react/promise/src/Internal/RejectedPromise.php new file mode 100644 index 0000000..aa1dff3 --- /dev/null +++ b/vendor/react/promise/src/Internal/RejectedPromise.php @@ -0,0 +1,128 @@ + + */ +final class RejectedPromise implements PromiseInterface +{ + /** @var \Throwable */ + private $reason; + + /** @var bool */ + private $handled = false; + + /** + * @param \Throwable $reason + */ + public function __construct(\Throwable $reason) + { + $this->reason = $reason; + } + + /** @throws void */ + public function __destruct() + { + if ($this->handled) { + return; + } + + $handler = set_rejection_handler(null); + if ($handler === null) { + $message = 'Unhandled promise rejection with ' . $this->reason; + + \error_log($message); + return; + } + + try { + $handler($this->reason); + } catch (\Throwable $e) { + \preg_match('/^([^:\s]++)(.*+)$/sm', (string) $e, $match); + \assert(isset($match[1], $match[2])); + $message = 'Fatal error: Uncaught ' . $match[1] . ' from unhandled promise rejection handler' . $match[2]; + + \error_log($message); + exit(255); + } + } + + /** + * @template TRejected + * @param ?callable $onFulfilled + * @param ?(callable(\Throwable): (PromiseInterface|TRejected)) $onRejected + * @return PromiseInterface<($onRejected is null ? never : TRejected)> + */ + public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface + { + if (null === $onRejected) { + return $this; + } + + $this->handled = true; + + try { + return resolve($onRejected($this->reason)); + } catch (\Throwable $exception) { + return new RejectedPromise($exception); + } + } + + /** + * @template TThrowable of \Throwable + * @template TRejected + * @param callable(TThrowable): (PromiseInterface|TRejected) $onRejected + * @return PromiseInterface + */ + public function catch(callable $onRejected): PromiseInterface + { + if (!_checkTypehint($onRejected, $this->reason)) { + return $this; + } + + /** + * @var callable(\Throwable):(PromiseInterface|TRejected) $onRejected + */ + return $this->then(null, $onRejected); + } + + public function finally(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->then(null, function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface { + return resolve($onFulfilledOrRejected())->then(function () use ($reason): PromiseInterface { + return new RejectedPromise($reason); + }); + }); + } + + public function cancel(): void + { + $this->handled = true; + } + + /** + * @deprecated 3.0.0 Use `catch()` instead + * @see self::catch() + */ + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->catch($onRejected); + } + + /** + * @deprecated 3.0.0 Use `always()` instead + * @see self::always() + */ + public function always(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->finally($onFulfilledOrRejected); + } +} diff --git a/vendor/react/promise/src/Promise.php b/vendor/react/promise/src/Promise.php new file mode 100644 index 0000000..0828674 --- /dev/null +++ b/vendor/react/promise/src/Promise.php @@ -0,0 +1,304 @@ + + */ +final class Promise implements PromiseInterface +{ + /** @var (callable(callable(T):void,callable(\Throwable):void):void)|null */ + private $canceller; + + /** @var ?PromiseInterface */ + private $result; + + /** @var list):void> */ + private $handlers = []; + + /** @var int */ + private $requiredCancelRequests = 0; + + /** @var bool */ + private $cancelled = false; + + /** + * @param callable(callable(T):void,callable(\Throwable):void):void $resolver + * @param (callable(callable(T):void,callable(\Throwable):void):void)|null $canceller + */ + public function __construct(callable $resolver, ?callable $canceller = null) + { + $this->canceller = $canceller; + + // Explicitly overwrite arguments with null values before invoking + // resolver function. This ensure that these arguments do not show up + // in the stack trace in PHP 7+ only. + $cb = $resolver; + $resolver = $canceller = null; + $this->call($cb); + } + + public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface + { + if (null !== $this->result) { + return $this->result->then($onFulfilled, $onRejected); + } + + if (null === $this->canceller) { + return new static($this->resolver($onFulfilled, $onRejected)); + } + + // This promise has a canceller, so we create a new child promise which + // has a canceller that invokes the parent canceller if all other + // followers are also cancelled. We keep a reference to this promise + // instance for the static canceller function and clear this to avoid + // keeping a cyclic reference between parent and follower. + $parent = $this; + ++$parent->requiredCancelRequests; + + return new static( + $this->resolver($onFulfilled, $onRejected), + static function () use (&$parent): void { + assert($parent instanceof self); + --$parent->requiredCancelRequests; + + if ($parent->requiredCancelRequests <= 0) { + $parent->cancel(); + } + + $parent = null; + } + ); + } + + /** + * @template TThrowable of \Throwable + * @template TRejected + * @param callable(TThrowable): (PromiseInterface|TRejected) $onRejected + * @return PromiseInterface + */ + public function catch(callable $onRejected): PromiseInterface + { + return $this->then(null, static function (\Throwable $reason) use ($onRejected) { + if (!_checkTypehint($onRejected, $reason)) { + return new RejectedPromise($reason); + } + + /** + * @var callable(\Throwable):(PromiseInterface|TRejected) $onRejected + */ + return $onRejected($reason); + }); + } + + public function finally(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface { + /** @var T $value */ + return resolve($onFulfilledOrRejected())->then(function () use ($value) { + return $value; + }); + }, static function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface { + return resolve($onFulfilledOrRejected())->then(function () use ($reason): RejectedPromise { + return new RejectedPromise($reason); + }); + }); + } + + public function cancel(): void + { + $this->cancelled = true; + $canceller = $this->canceller; + $this->canceller = null; + + $parentCanceller = null; + + if (null !== $this->result) { + // Forward cancellation to rejected promise to avoid reporting unhandled rejection + if ($this->result instanceof RejectedPromise) { + $this->result->cancel(); + } + + // Go up the promise chain and reach the top most promise which is + // itself not following another promise + $root = $this->unwrap($this->result); + + // Return if the root promise is already resolved or a + // FulfilledPromise or RejectedPromise + if (!$root instanceof self || null !== $root->result) { + return; + } + + $root->requiredCancelRequests--; + + if ($root->requiredCancelRequests <= 0) { + $parentCanceller = [$root, 'cancel']; + } + } + + if (null !== $canceller) { + $this->call($canceller); + } + + // For BC, we call the parent canceller after our own canceller + if ($parentCanceller) { + $parentCanceller(); + } + } + + /** + * @deprecated 3.0.0 Use `catch()` instead + * @see self::catch() + */ + public function otherwise(callable $onRejected): PromiseInterface + { + return $this->catch($onRejected); + } + + /** + * @deprecated 3.0.0 Use `finally()` instead + * @see self::finally() + */ + public function always(callable $onFulfilledOrRejected): PromiseInterface + { + return $this->finally($onFulfilledOrRejected); + } + + private function resolver(?callable $onFulfilled = null, ?callable $onRejected = null): callable + { + return function (callable $resolve, callable $reject) use ($onFulfilled, $onRejected): void { + $this->handlers[] = static function (PromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject): void { + $promise = $promise->then($onFulfilled, $onRejected); + + if ($promise instanceof self && $promise->result === null) { + $promise->handlers[] = static function (PromiseInterface $promise) use ($resolve, $reject): void { + $promise->then($resolve, $reject); + }; + } else { + $promise->then($resolve, $reject); + } + }; + }; + } + + private function reject(\Throwable $reason): void + { + if (null !== $this->result) { + return; + } + + $this->settle(reject($reason)); + } + + /** + * @param PromiseInterface $result + */ + private function settle(PromiseInterface $result): void + { + $result = $this->unwrap($result); + + if ($result === $this) { + $result = new RejectedPromise( + new \LogicException('Cannot resolve a promise with itself.') + ); + } + + if ($result instanceof self) { + $result->requiredCancelRequests++; + } else { + // Unset canceller only when not following a pending promise + $this->canceller = null; + } + + $handlers = $this->handlers; + + $this->handlers = []; + $this->result = $result; + + foreach ($handlers as $handler) { + $handler($result); + } + + // Forward cancellation to rejected promise to avoid reporting unhandled rejection + if ($this->cancelled && $result instanceof RejectedPromise) { + $result->cancel(); + } + } + + /** + * @param PromiseInterface $promise + * @return PromiseInterface + */ + private function unwrap(PromiseInterface $promise): PromiseInterface + { + while ($promise instanceof self && null !== $promise->result) { + /** @var PromiseInterface $promise */ + $promise = $promise->result; + } + + return $promise; + } + + /** + * @param callable(callable(mixed):void,callable(\Throwable):void):void $cb + */ + private function call(callable $cb): void + { + // Explicitly overwrite argument with null value. This ensure that this + // argument does not show up in the stack trace in PHP 7+ only. + $callback = $cb; + $cb = null; + + // Use reflection to inspect number of arguments expected by this callback. + // We did some careful benchmarking here: Using reflection to avoid unneeded + // function arguments is actually faster than blindly passing them. + // Also, this helps avoiding unnecessary function arguments in the call stack + // if the callback creates an Exception (creating garbage cycles). + if (\is_array($callback)) { + $ref = new \ReflectionMethod($callback[0], $callback[1]); + } elseif (\is_object($callback) && !$callback instanceof \Closure) { + $ref = new \ReflectionMethod($callback, '__invoke'); + } else { + assert($callback instanceof \Closure || \is_string($callback)); + $ref = new \ReflectionFunction($callback); + } + $args = $ref->getNumberOfParameters(); + + try { + if ($args === 0) { + $callback(); + } else { + // Keep references to this promise instance for the static resolve/reject functions. + // By using static callbacks that are not bound to this instance + // and passing the target promise instance by reference, we can + // still execute its resolving logic and still clear this + // reference when settling the promise. This helps avoiding + // garbage cycles if any callback creates an Exception. + // These assumptions are covered by the test suite, so if you ever feel like + // refactoring this, go ahead, any alternative suggestions are welcome! + $target =& $this; + + $callback( + static function ($value) use (&$target): void { + if ($target !== null) { + $target->settle(resolve($value)); + $target = null; + } + }, + static function (\Throwable $reason) use (&$target): void { + if ($target !== null) { + $target->reject($reason); + $target = null; + } + } + ); + } + } catch (\Throwable $e) { + $target = null; + $this->reject($e); + } + } +} diff --git a/vendor/react/promise/src/PromiseInterface.php b/vendor/react/promise/src/PromiseInterface.php new file mode 100644 index 0000000..5869f76 --- /dev/null +++ b/vendor/react/promise/src/PromiseInterface.php @@ -0,0 +1,152 @@ +|TFulfilled)) $onFulfilled + * @param ?(callable(\Throwable): (PromiseInterface|TRejected)) $onRejected + * @return PromiseInterface<($onRejected is null ? ($onFulfilled is null ? T : TFulfilled) : ($onFulfilled is null ? T|TRejected : TFulfilled|TRejected))> + */ + public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface; + + /** + * Registers a rejection handler for promise. It is a shortcut for: + * + * ```php + * $promise->then(null, $onRejected); + * ``` + * + * Additionally, you can type hint the `$reason` argument of `$onRejected` to catch + * only specific errors. + * + * @template TThrowable of \Throwable + * @template TRejected + * @param callable(TThrowable): (PromiseInterface|TRejected) $onRejected + * @return PromiseInterface + */ + public function catch(callable $onRejected): PromiseInterface; + + /** + * Allows you to execute "cleanup" type tasks in a promise chain. + * + * It arranges for `$onFulfilledOrRejected` to be called, with no arguments, + * when the promise is either fulfilled or rejected. + * + * * If `$promise` fulfills, and `$onFulfilledOrRejected` returns successfully, + * `$newPromise` will fulfill with the same value as `$promise`. + * * If `$promise` fulfills, and `$onFulfilledOrRejected` throws or returns a + * rejected promise, `$newPromise` will reject with the thrown exception or + * rejected promise's reason. + * * If `$promise` rejects, and `$onFulfilledOrRejected` returns successfully, + * `$newPromise` will reject with the same reason as `$promise`. + * * If `$promise` rejects, and `$onFulfilledOrRejected` throws or returns a + * rejected promise, `$newPromise` will reject with the thrown exception or + * rejected promise's reason. + * + * `finally()` behaves similarly to the synchronous finally statement. When combined + * with `catch()`, `finally()` allows you to write code that is similar to the familiar + * synchronous catch/finally pair. + * + * Consider the following synchronous code: + * + * ```php + * try { + * return doSomething(); + * } catch(\Exception $e) { + * return handleError($e); + * } finally { + * cleanup(); + * } + * ``` + * + * Similar asynchronous code (with `doSomething()` that returns a promise) can be + * written: + * + * ```php + * return doSomething() + * ->catch('handleError') + * ->finally('cleanup'); + * ``` + * + * @param callable(): (void|PromiseInterface) $onFulfilledOrRejected + * @return PromiseInterface + */ + public function finally(callable $onFulfilledOrRejected): PromiseInterface; + + /** + * The `cancel()` method notifies the creator of the promise that there is no + * further interest in the results of the operation. + * + * Once a promise is settled (either fulfilled or rejected), calling `cancel()` on + * a promise has no effect. + * + * @return void + */ + public function cancel(): void; + + /** + * [Deprecated] Registers a rejection handler for a promise. + * + * This method continues to exist only for BC reasons and to ease upgrading + * between versions. It is an alias for: + * + * ```php + * $promise->catch($onRejected); + * ``` + * + * @template TThrowable of \Throwable + * @template TRejected + * @param callable(TThrowable): (PromiseInterface|TRejected) $onRejected + * @return PromiseInterface + * @deprecated 3.0.0 Use catch() instead + * @see self::catch() + */ + public function otherwise(callable $onRejected): PromiseInterface; + + /** + * [Deprecated] Allows you to execute "cleanup" type tasks in a promise chain. + * + * This method continues to exist only for BC reasons and to ease upgrading + * between versions. It is an alias for: + * + * ```php + * $promise->finally($onFulfilledOrRejected); + * ``` + * + * @param callable(): (void|PromiseInterface) $onFulfilledOrRejected + * @return PromiseInterface + * @deprecated 3.0.0 Use finally() instead + * @see self::finally() + */ + public function always(callable $onFulfilledOrRejected): PromiseInterface; +} diff --git a/vendor/react/promise/src/functions.php b/vendor/react/promise/src/functions.php new file mode 100644 index 0000000..214aad6 --- /dev/null +++ b/vendor/react/promise/src/functions.php @@ -0,0 +1,345 @@ +|T $promiseOrValue + * @return PromiseInterface + */ +function resolve($promiseOrValue): PromiseInterface +{ + if ($promiseOrValue instanceof PromiseInterface) { + return $promiseOrValue; + } + + if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) { + $canceller = null; + + if (\method_exists($promiseOrValue, 'cancel')) { + $canceller = [$promiseOrValue, 'cancel']; + assert(\is_callable($canceller)); + } + + /** @var Promise */ + return new Promise(function (callable $resolve, callable $reject) use ($promiseOrValue): void { + $promiseOrValue->then($resolve, $reject); + }, $canceller); + } + + return new FulfilledPromise($promiseOrValue); +} + +/** + * Creates a rejected promise for the supplied `$reason`. + * + * If `$reason` is a value, it will be the rejection value of the + * returned promise. + * + * If `$reason` is a promise, its completion value will be the rejected + * value of the returned promise. + * + * This can be useful in situations where you need to reject a promise without + * throwing an exception. For example, it allows you to propagate a rejection with + * the value of another promise. + * + * @return PromiseInterface + */ +function reject(\Throwable $reason): PromiseInterface +{ + return new RejectedPromise($reason); +} + +/** + * Returns a promise that will resolve only once all the items in + * `$promisesOrValues` have resolved. The resolution value of the returned promise + * will be an array containing the resolution values of each of the items in + * `$promisesOrValues`. + * + * @template T + * @param iterable|T> $promisesOrValues + * @return PromiseInterface> + */ +function all(iterable $promisesOrValues): PromiseInterface +{ + $cancellationQueue = new Internal\CancellationQueue(); + + /** @var Promise> */ + return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void { + $toResolve = 0; + /** @var bool */ + $continue = true; + $values = []; + + foreach ($promisesOrValues as $i => $promiseOrValue) { + $cancellationQueue->enqueue($promiseOrValue); + $values[$i] = null; + ++$toResolve; + + resolve($promiseOrValue)->then( + function ($value) use ($i, &$values, &$toResolve, &$continue, $resolve): void { + $values[$i] = $value; + + if (0 === --$toResolve && !$continue) { + $resolve($values); + } + }, + function (\Throwable $reason) use (&$continue, $reject): void { + $continue = false; + $reject($reason); + } + ); + + if (!$continue && !\is_array($promisesOrValues)) { + break; + } + } + + $continue = false; + if ($toResolve === 0) { + $resolve($values); + } + }, $cancellationQueue); +} + +/** + * Initiates a competitive race that allows one winner. Returns a promise which is + * resolved in the same way the first settled promise resolves. + * + * The returned promise will become **infinitely pending** if `$promisesOrValues` + * contains 0 items. + * + * @template T + * @param iterable|T> $promisesOrValues + * @return PromiseInterface + */ +function race(iterable $promisesOrValues): PromiseInterface +{ + $cancellationQueue = new Internal\CancellationQueue(); + + /** @var Promise */ + return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void { + $continue = true; + + foreach ($promisesOrValues as $promiseOrValue) { + $cancellationQueue->enqueue($promiseOrValue); + + resolve($promiseOrValue)->then($resolve, $reject)->finally(function () use (&$continue): void { + $continue = false; + }); + + if (!$continue && !\is_array($promisesOrValues)) { + break; + } + } + }, $cancellationQueue); +} + +/** + * Returns a promise that will resolve when any one of the items in + * `$promisesOrValues` resolves. The resolution value of the returned promise + * will be the resolution value of the triggering item. + * + * The returned promise will only reject if *all* items in `$promisesOrValues` are + * rejected. The rejection value will be an array of all rejection reasons. + * + * The returned promise will also reject with a `React\Promise\Exception\LengthException` + * if `$promisesOrValues` contains 0 items. + * + * @template T + * @param iterable|T> $promisesOrValues + * @return PromiseInterface + */ +function any(iterable $promisesOrValues): PromiseInterface +{ + $cancellationQueue = new Internal\CancellationQueue(); + + /** @var Promise */ + return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void { + $toReject = 0; + $continue = true; + $reasons = []; + + foreach ($promisesOrValues as $i => $promiseOrValue) { + $cancellationQueue->enqueue($promiseOrValue); + ++$toReject; + + resolve($promiseOrValue)->then( + function ($value) use ($resolve, &$continue): void { + $continue = false; + $resolve($value); + }, + function (\Throwable $reason) use ($i, &$reasons, &$toReject, $reject, &$continue): void { + $reasons[$i] = $reason; + + if (0 === --$toReject && !$continue) { + $reject(new CompositeException( + $reasons, + 'All promises rejected.' + )); + } + } + ); + + if (!$continue && !\is_array($promisesOrValues)) { + break; + } + } + + $continue = false; + if ($toReject === 0 && !$reasons) { + $reject(new Exception\LengthException( + 'Must contain at least 1 item but contains only 0 items.' + )); + } elseif ($toReject === 0) { + $reject(new CompositeException( + $reasons, + 'All promises rejected.' + )); + } + }, $cancellationQueue); +} + +/** + * Sets the global rejection handler for unhandled promise rejections. + * + * Note that rejected promises should always be handled similar to how any + * exceptions should always be caught in a `try` + `catch` block. If you remove + * the last reference to a rejected promise that has not been handled, it will + * report an unhandled promise rejection. See also the [`reject()` function](#reject) + * for more details. + * + * The `?callable $callback` argument MUST be a valid callback function that + * accepts a single `Throwable` argument or a `null` value to restore the + * default promise rejection handler. The return value of the callback function + * will be ignored and has no effect, so you SHOULD return a `void` value. The + * callback function MUST NOT throw or the program will be terminated with a + * fatal error. + * + * The function returns the previous rejection handler or `null` if using the + * default promise rejection handler. + * + * The default promise rejection handler will log an error message plus its + * stack trace: + * + * ```php + * // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 + * React\Promise\reject(new RuntimeException('Unhandled')); + * ``` + * + * The promise rejection handler may be used to use customize the log message or + * write to custom log targets. As a rule of thumb, this function should only be + * used as a last resort and promise rejections are best handled with either the + * [`then()` method](#promiseinterfacethen), the + * [`catch()` method](#promiseinterfacecatch), or the + * [`finally()` method](#promiseinterfacefinally). + * See also the [`reject()` function](#reject) for more details. + * + * @param callable(\Throwable):void|null $callback + * @return callable(\Throwable):void|null + */ +function set_rejection_handler(?callable $callback): ?callable +{ + static $current = null; + $previous = $current; + $current = $callback; + + return $previous; +} + +/** + * @internal + */ +function _checkTypehint(callable $callback, \Throwable $reason): bool +{ + if (\is_array($callback)) { + $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]); + } elseif (\is_object($callback) && !$callback instanceof \Closure) { + $callbackReflection = new \ReflectionMethod($callback, '__invoke'); + } else { + assert($callback instanceof \Closure || \is_string($callback)); + $callbackReflection = new \ReflectionFunction($callback); + } + + $parameters = $callbackReflection->getParameters(); + + if (!isset($parameters[0])) { + return true; + } + + $expectedException = $parameters[0]; + + // Extract the type of the argument and handle different possibilities + $type = $expectedException->getType(); + + $isTypeUnion = true; + $types = []; + + switch (true) { + case $type === null: + break; + case $type instanceof \ReflectionNamedType: + $types = [$type]; + break; + case $type instanceof \ReflectionIntersectionType: + $isTypeUnion = false; + case $type instanceof \ReflectionUnionType: + $types = $type->getTypes(); + break; + default: + throw new \LogicException('Unexpected return value of ReflectionParameter::getType'); + } + + // If there is no type restriction, it matches + if (empty($types)) { + return true; + } + + foreach ($types as $type) { + + if ($type instanceof \ReflectionIntersectionType) { + foreach ($type->getTypes() as $typeToMatch) { + assert($typeToMatch instanceof \ReflectionNamedType); + $name = $typeToMatch->getName(); + if (!($matches = (!$typeToMatch->isBuiltin() && $reason instanceof $name))) { + break; + } + } + assert(isset($matches)); + } else { + assert($type instanceof \ReflectionNamedType); + $name = $type->getName(); + $matches = !$type->isBuiltin() && $reason instanceof $name; + } + + // If we look for a single match (union), we can return early on match + // If we look for a full match (intersection), we can return early on mismatch + if ($matches) { + if ($isTypeUnion) { + return true; + } + } else { + if (!$isTypeUnion) { + return false; + } + } + } + + // If we look for a single match (union) and did not return early, we matched no type and are false + // If we look for a full match (intersection) and did not return early, we matched all types and are true + return $isTypeUnion ? false : true; +} diff --git a/vendor/react/promise/src/functions_include.php b/vendor/react/promise/src/functions_include.php new file mode 100644 index 0000000..bd0c54f --- /dev/null +++ b/vendor/react/promise/src/functions_include.php @@ -0,0 +1,5 @@ +value` + * Deprecate the `!php/const:` tag in key which will be replaced by the `!php/const` tag (without the colon) since 3.4 + +6.1 +--- + + * In cases where it will likely improve readability, strings containing single quotes will be double-quoted + +5.4 +--- + + * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml` + option to exclude one or more specific files from multiple file list + * Allow negatable for the parse tags option with `--no-parse-tags` + +5.3 +--- + + * Added `github` format support & autodetection to render errors as annotations + when running the YAML linter command in a Github Action environment. + +5.1.0 +----- + + * Added support for parsing numbers prefixed with `0o` as octal numbers. + * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o` + so that they are parsed as octal numbers. + + Before: + + ```yaml + Yaml::parse('072'); + ``` + + After: + + ```yaml + Yaml::parse('0o72'); + ``` + + * Added `yaml-lint` binary. + * Deprecated using the `!php/object` and `!php/const` tags without a value. + +5.0.0 +----- + + * Removed support for mappings inside multi-line strings. + * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. + +4.4.0 +----- + + * Added support for parsing the inline notation spanning multiple lines. + * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag. + * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. + +4.3.0 +----- + + * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0. + +4.2.0 +----- + + * added support for multiple files or directories in `LintCommand` + +4.0.0 +----- + + * The behavior of the non-specific tag `!` is changed and now forces + non-evaluating your values. + * complex mappings will throw a `ParseException` + * support for the comma as a group separator for floats has been dropped, use + the underscore instead + * support for the `!!php/object` tag has been dropped, use the `!php/object` + tag instead + * duplicate mapping keys throw a `ParseException` + * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` + flag to cast them to strings + * `%` at the beginning of an unquoted string throw a `ParseException` + * mappings with a colon (`:`) that is not followed by a whitespace throw a + `ParseException` + * the `Dumper::setIndentation()` method has been removed + * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, + `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of + the parser and dumper is no longer supported, pass bitmask flags instead + * the constructor arguments of the `Parser` class have been removed + * the `Inline` class is internal and no longer part of the BC promise + * removed support for the `!str` tag, use the `!!str` tag instead + * added support for tagged scalars. + + ```yml + Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); + // returns TaggedValue('foo', 'bar'); + ``` + +3.4.0 +----- + + * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method + + * the `Dumper`, `Parser`, and `Yaml` classes are marked as final + + * Deprecated the `!php/object:` tag which will be replaced by the + `!php/object` tag (without the colon) in 4.0. + + * Deprecated the `!php/const:` tag which will be replaced by the + `!php/const` tag (without the colon) in 4.0. + + * Support for the `!str` tag is deprecated, use the `!!str` tag instead. + + * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. + It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. + +3.3.0 +----- + + * Starting an unquoted string with a question mark followed by a space is + deprecated and will throw a `ParseException` in Symfony 4.0. + + * Deprecated support for implicitly parsing non-string mapping keys as strings. + Mapping keys that are no strings will lead to a `ParseException` in Symfony + 4.0. Use quotes to opt-in for keys to be parsed as strings. + + Before: + + ```php + $yaml = << new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); + ``` + +3.0.0 +----- + + * Yaml::parse() now throws an exception when a blackslash is not escaped + in double-quoted strings + +2.8.0 +----- + + * Deprecated usage of a colon in an unquoted mapping value + * Deprecated usage of @, \`, | and > at the beginning of an unquoted string + * When surrounding strings with double-quotes, you must now escape `\` characters. Not + escaping those characters (when surrounded by double-quotes) is deprecated. + + Before: + + ```yml + class: "Foo\Var" + ``` + + After: + + ```yml + class: "Foo\\Var" + ``` + +2.1.0 +----- + + * Yaml::parse() does not evaluate loaded files as PHP files by default + anymore (call Yaml::enablePhpParsing() to get back the old behavior) diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php new file mode 100644 index 0000000..2088d2f --- /dev/null +++ b/vendor/symfony/yaml/Command/LintCommand.php @@ -0,0 +1,277 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Command; + +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\CI\GithubActionReporter; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Yaml; + +/** + * Validates YAML files syntax and outputs encountered errors. + * + * @author Grégoire Pineau + * @author Robin Chalas + */ +#[AsCommand(name: 'lint:yaml', description: 'Lint a YAML file and outputs encountered errors')] +class LintCommand extends Command +{ + private Parser $parser; + private ?string $format = null; + private bool $displayCorrectFiles; + private ?\Closure $directoryIteratorProvider; + private ?\Closure $isReadableProvider; + + public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null) + { + parent::__construct($name); + + $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); + $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); + } + + protected function configure(): void + { + $this + ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') + ->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions()))) + ->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude') + ->addOption('parse-tags', null, InputOption::VALUE_NEGATABLE, 'Parse custom tags', null) + ->setHelp(<<%command.name% command lints a YAML file and outputs to STDOUT + the first encountered syntax error. + + You can validates YAML contents passed from STDIN: + + cat filename | php %command.full_name% - + + You can also validate the syntax of a file: + + php %command.full_name% filename + + Or of a whole directory: + + php %command.full_name% dirname + + The --format option specifies the format of the command output: + + php %command.full_name% dirname --format=json + + You can also exclude one or more specific files: + + php %command.full_name% dirname --exclude="dirname/foo.yaml" --exclude="dirname/bar.yaml" + + EOF + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $filenames = (array) $input->getArgument('filename'); + $excludes = $input->getOption('exclude'); + $this->format = $input->getOption('format'); + $flags = $input->getOption('parse-tags'); + + if (null === $this->format) { + // Autodetect format according to CI environment + $this->format = class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; + } + + $flags = $flags ? Yaml::PARSE_CUSTOM_TAGS : 0; + + $this->displayCorrectFiles = $output->isVerbose(); + + if (['-'] === $filenames) { + return $this->display($io, [$this->validate(file_get_contents('php://stdin'), $flags)]); + } + + if (!$filenames) { + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); + } + + $filesInfo = []; + foreach ($filenames as $filename) { + if (!$this->isReadable($filename)) { + throw new RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename)); + } + + foreach ($this->getFiles($filename) as $file) { + if (!\in_array($file->getPathname(), $excludes, true)) { + $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); + } + } + } + + return $this->display($io, $filesInfo); + } + + private function validate(string $content, int $flags, ?string $file = null): array + { + $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { + if (\E_USER_DEPRECATED === $level) { + throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); + } + + return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; + }); + + try { + $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); + } catch (ParseException $e) { + return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()]; + } finally { + restore_error_handler(); + } + + return ['file' => $file, 'valid' => true]; + } + + private function display(SymfonyStyle $io, array $files): int + { + return match ($this->format) { + 'txt' => $this->displayTxt($io, $files), + 'json' => $this->displayJson($io, $files), + 'github' => $this->displayTxt($io, $files, true), + default => throw new InvalidArgumentException(\sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), + }; + } + + private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int + { + $countFiles = \count($filesInfo); + $erroredFiles = 0; + $suggestTagOption = false; + + if ($errorAsGithubAnnotations) { + $githubReporter = new GithubActionReporter($io); + } + + foreach ($filesInfo as $info) { + if ($info['valid'] && $this->displayCorrectFiles) { + $io->comment('OK'.($info['file'] ? \sprintf(' in %s', $info['file']) : '')); + } elseif (!$info['valid']) { + ++$erroredFiles; + $io->text(' ERROR '.($info['file'] ? \sprintf(' in %s', $info['file']) : '')); + $io->text(\sprintf(' >> %s', $info['message'])); + + if (str_contains($info['message'], 'PARSE_CUSTOM_TAGS')) { + $suggestTagOption = true; + } + + if ($errorAsGithubAnnotations) { + $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']); + } + } + } + + if (0 === $erroredFiles) { + $io->success(\sprintf('All %d YAML files contain valid syntax.', $countFiles)); + } else { + $io->warning(\sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : '')); + } + + return min($erroredFiles, 1); + } + + private function displayJson(SymfonyStyle $io, array $filesInfo): int + { + $errors = 0; + + array_walk($filesInfo, function (&$v) use (&$errors) { + $v['file'] = (string) $v['file']; + if (!$v['valid']) { + ++$errors; + } + + if (isset($v['message']) && str_contains($v['message'], 'PARSE_CUSTOM_TAGS')) { + $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.'; + } + }); + + $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); + + return min($errors, 1); + } + + private function getFiles(string $fileOrDirectory): iterable + { + if (is_file($fileOrDirectory)) { + yield new \SplFileInfo($fileOrDirectory); + + return; + } + + foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { + if (!\in_array($file->getExtension(), ['yml', 'yaml'], true)) { + continue; + } + + yield $file; + } + } + + private function getParser(): Parser + { + return $this->parser ??= new Parser(); + } + + private function getDirectoryIterator(string $directory): iterable + { + $default = fn ($directory) => new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), + \RecursiveIteratorIterator::LEAVES_ONLY + ); + + if (null !== $this->directoryIteratorProvider) { + return ($this->directoryIteratorProvider)($directory, $default); + } + + return $default($directory); + } + + private function isReadable(string $fileOrDirectory): bool + { + $default = is_readable(...); + + if (null !== $this->isReadableProvider) { + return ($this->isReadableProvider)($fileOrDirectory, $default); + } + + return $default($fileOrDirectory); + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues($this->getAvailableFormatOptions()); + } + } + + /** @return string[] */ + private function getAvailableFormatOptions(): array + { + return ['txt', 'json', 'github']; + } +} diff --git a/vendor/symfony/yaml/Dumper.php b/vendor/symfony/yaml/Dumper.php new file mode 100644 index 0000000..cd5a1f6 --- /dev/null +++ b/vendor/symfony/yaml/Dumper.php @@ -0,0 +1,184 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +use Symfony\Component\Yaml\Tag\TaggedValue; + +/** + * Dumper dumps PHP variables to YAML strings. + * + * @author Fabien Potencier + * + * @final + */ +class Dumper +{ + /** + * @param int $indentation The amount of spaces to use for indentation of nested nodes + */ + public function __construct(private int $indentation = 4) + { + if ($indentation < 1) { + throw new \InvalidArgumentException('The indentation must be greater than zero.'); + } + } + + /** + * Dumps a PHP value to YAML. + * + * @param mixed $input The PHP value + * @param int $inline The level where you switch to inline YAML + * @param int $indent The level of indentation (used internally) + * @param int-mask-of $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags = 0): string + { + if ($flags & Yaml::DUMP_NULL_AS_EMPTY && $flags & Yaml::DUMP_NULL_AS_TILDE) { + throw new \InvalidArgumentException('The Yaml::DUMP_NULL_AS_EMPTY and Yaml::DUMP_NULL_AS_TILDE flags cannot be used together.'); + } + + return $this->doDump($input, $inline, $indent, $flags); + } + + private function doDump(mixed $input, int $inline = 0, int $indent = 0, int $flags = 0, int $nestingLevel = 0): string + { + $output = ''; + $prefix = $indent ? str_repeat(' ', $indent) : ''; + $dumpObjectAsInlineMap = true; + + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) { + $dumpObjectAsInlineMap = !(array) $input; + } + + if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || !$input) { + $output .= $prefix.Inline::dump($input, $flags, 0 === $nestingLevel); + } elseif ($input instanceof TaggedValue) { + $output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix, $nestingLevel); + } else { + $dumpAsMap = Inline::isHash($input); + $compactNestedMapping = Yaml::DUMP_COMPACT_NESTED_MAPPING & $flags && !$dumpAsMap; + + foreach ($input as $key => $value) { + if ('' !== $output && "\n" !== $output[-1]) { + $output .= "\n"; + } + + if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { + $key = (string) $key; + } + + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && str_contains($value, "\n") && !str_contains($value, "\r")) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value); + + if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) { + $blockChompingIndicator = '+'; + } elseif ("\n" === $value[-1]) { + $blockChompingIndicator = ''; + } else { + $blockChompingIndicator = '-'; + } + + $output .= \sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); + + foreach (explode("\n", $value) as $row) { + if ('' === $row) { + $output .= "\n"; + } else { + $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); + } + } + + continue; + } + + if ($value instanceof TaggedValue) { + $output .= \sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); + + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); + $output .= \sprintf(' |%s', $blockIndentationIndicator); + + foreach (explode("\n", $value->getValue()) as $row) { + $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); + } + + continue; + } + + if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { + $output .= ' '.$this->doDump($value->getValue(), $inline - 1, 0, $flags, $nestingLevel + 1)."\n"; + } else { + $output .= "\n"; + $output .= $this->doDump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags, $nestingLevel + 1); + } + + continue; + } + + $dumpObjectAsInlineMap = true; + + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { + $dumpObjectAsInlineMap = !(array) $value; + } + + $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || !$value; + + $output .= \sprintf('%s%s%s%s', + $prefix, + $dumpAsMap ? Inline::dump($key, $flags).':' : '-', + $willBeInlined || ($compactNestedMapping && \is_array($value) && Inline::isHash($value)) ? ' ' : "\n", + $compactNestedMapping && \is_array($value) && Inline::isHash($value) ? substr($this->doDump($value, $inline - 1, $indent + 2, $flags, $nestingLevel + 1), $indent + 2) : $this->doDump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags, $nestingLevel + 1) + ).($willBeInlined ? "\n" : ''); + } + } + + return $output; + } + + private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, int $flags, string $prefix, int $nestingLevel): string + { + $output = \sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag()); + + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); + $output .= \sprintf(' |%s', $blockIndentationIndicator); + + foreach (explode("\n", $value->getValue()) as $row) { + $output .= \sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); + } + + return $output; + } + + if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { + return $output.' '.$this->doDump($value->getValue(), $inline - 1, 0, $flags, $nestingLevel + 1)."\n"; + } + + return $output."\n".$this->doDump($value->getValue(), $inline - 1, $indent, $flags, $nestingLevel + 1); + } + + private function getBlockIndentationIndicator(string $value): string + { + $lines = explode("\n", $value); + + // If the first line (that is neither empty nor contains only spaces) + // starts with a space character, the spec requires a block indentation indicator + // http://www.yaml.org/spec/1.2/spec.html#id2793979 + foreach ($lines as $line) { + if ('' !== trim($line, ' ')) { + return str_starts_with($line, ' ') ? (string) $this->indentation : ''; + } + } + + return ''; + } +} diff --git a/vendor/symfony/yaml/Escaper.php b/vendor/symfony/yaml/Escaper.php new file mode 100644 index 0000000..921d62f --- /dev/null +++ b/vendor/symfony/yaml/Escaper.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +/** + * Escaper encapsulates escaping rules for single and double-quoted + * YAML strings. + * + * @author Matthew Lewinski + * + * @internal + */ +class Escaper +{ + // Characters that would cause a dumped string to require double quoting. + public const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9"; + + // Mapping arrays for escaping a double quoted string. The backslash is + // first to ensure proper escaping because str_replace operates iteratively + // on the input arrays. This ordering of the characters avoids the use of strtr, + // which performs more slowly. + private const ESCAPEES = [ + '\\', '\\\\', '\\"', '"', + "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", + "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", + "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", + "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", + "\x7f", + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", + ]; + private const ESCAPED = [ + '\\\\', '\\"', '\\\\', '\\"', + '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', + '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', + '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', + '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', + '\\x7f', + '\\N', '\\_', '\\L', '\\P', + ]; + + /** + * Determines if a PHP value would require double quoting in YAML. + * + * @param string $value A PHP value + */ + public static function requiresDoubleQuoting(string $value): bool + { + return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); + } + + /** + * Escapes and surrounds a PHP value with double quotes. + * + * @param string $value A PHP value + */ + public static function escapeWithDoubleQuotes(string $value): string + { + return \sprintf('"%s"', str_replace(self::ESCAPEES, self::ESCAPED, $value)); + } + + /** + * Determines if a PHP value would require single quoting in YAML. + * + * @param string $value A PHP value + */ + public static function requiresSingleQuoting(string $value): bool + { + // Determines if a PHP value is entirely composed of a value that would + // require single quoting in YAML. + if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'], true)) { + return true; + } + + // Determines if the PHP value contains any single characters that would + // cause it to require single quoting in YAML. + return 0 < preg_match('/[\s\'"\:\{\}\[\],&\*\#\?] | \A[\-?|<>=!%@`\p{Zs}]/xu', $value); + } + + /** + * Escapes and surrounds a PHP value with single quotes. + * + * @param string $value A PHP value + */ + public static function escapeWithSingleQuotes(string $value): string + { + return \sprintf("'%s'", str_replace('\'', '\'\'', $value)); + } +} diff --git a/vendor/symfony/yaml/Exception/DumpException.php b/vendor/symfony/yaml/Exception/DumpException.php new file mode 100644 index 0000000..cce972f --- /dev/null +++ b/vendor/symfony/yaml/Exception/DumpException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during dumping. + * + * @author Fabien Potencier + */ +class DumpException extends RuntimeException +{ +} diff --git a/vendor/symfony/yaml/Exception/ExceptionInterface.php b/vendor/symfony/yaml/Exception/ExceptionInterface.php new file mode 100644 index 0000000..9091316 --- /dev/null +++ b/vendor/symfony/yaml/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Exception; + +/** + * Exception interface for all exceptions thrown by the component. + * + * @author Fabien Potencier + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/yaml/Exception/ParseException.php b/vendor/symfony/yaml/Exception/ParseException.php new file mode 100644 index 0000000..3b96169 --- /dev/null +++ b/vendor/symfony/yaml/Exception/ParseException.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during parsing. + * + * @author Fabien Potencier + */ +class ParseException extends RuntimeException +{ + /** + * @param string $rawMessage The error message + * @param int $parsedLine The line where the error occurred + * @param string|null $snippet The snippet of code near the problem + * @param string|null $parsedFile The file name where the error occurred + */ + public function __construct( + private string $rawMessage, + private int $parsedLine = -1, + private ?string $snippet = null, + private ?string $parsedFile = null, + ?\Throwable $previous = null, + ) { + $this->updateRepr(); + + parent::__construct($this->message, 0, $previous); + } + + /** + * Gets the snippet of code near the error. + */ + public function getSnippet(): string + { + return $this->snippet; + } + + /** + * Sets the snippet of code near the error. + */ + public function setSnippet(string $snippet): void + { + $this->snippet = $snippet; + + $this->updateRepr(); + } + + /** + * Gets the filename where the error occurred. + * + * This method returns null if a string is parsed. + */ + public function getParsedFile(): string + { + return $this->parsedFile; + } + + /** + * Sets the filename where the error occurred. + */ + public function setParsedFile(string $parsedFile): void + { + $this->parsedFile = $parsedFile; + + $this->updateRepr(); + } + + /** + * Gets the line where the error occurred. + */ + public function getParsedLine(): int + { + return $this->parsedLine; + } + + /** + * Sets the line where the error occurred. + */ + public function setParsedLine(int $parsedLine): void + { + $this->parsedLine = $parsedLine; + + $this->updateRepr(); + } + + private function updateRepr(): void + { + $this->message = $this->rawMessage; + + $dot = false; + if (str_ends_with($this->message, '.')) { + $this->message = substr($this->message, 0, -1); + $dot = true; + } + + if (null !== $this->parsedFile) { + $this->message .= \sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); + } + + if ($this->parsedLine >= 0) { + $this->message .= \sprintf(' at line %d', $this->parsedLine); + } + + if ($this->snippet) { + $this->message .= \sprintf(' (near "%s")', $this->snippet); + } + + if ($dot) { + $this->message .= '.'; + } + } +} diff --git a/vendor/symfony/yaml/Exception/RuntimeException.php b/vendor/symfony/yaml/Exception/RuntimeException.php new file mode 100644 index 0000000..3f36b73 --- /dev/null +++ b/vendor/symfony/yaml/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during parsing. + * + * @author Romain Neutron + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php new file mode 100644 index 0000000..36b2f13 --- /dev/null +++ b/vendor/symfony/yaml/Inline.php @@ -0,0 +1,880 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +use Symfony\Component\Yaml\Exception\DumpException; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Tag\TaggedValue; + +/** + * Inline implements a YAML parser/dumper for the YAML inline syntax. + * + * @author Fabien Potencier + * + * @internal + */ +class Inline +{ + public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; + + public static int $parsedLineNumber = -1; + public static ?string $parsedFilename = null; + + private static bool $exceptionOnInvalidType = false; + private static bool $objectSupport = false; + private static bool $objectForMap = false; + private static bool $constantSupport = false; + + public static function initialize(int $flags, ?int $parsedLineNumber = null, ?string $parsedFilename = null): void + { + self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); + self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags); + self::$objectForMap = (bool) (Yaml::PARSE_OBJECT_FOR_MAP & $flags); + self::$constantSupport = (bool) (Yaml::PARSE_CONSTANT & $flags); + self::$parsedFilename = $parsedFilename; + + if (null !== $parsedLineNumber) { + self::$parsedLineNumber = $parsedLineNumber; + } + } + + /** + * Converts a YAML string to a PHP value. + * + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * @param array $references Mapping of variable names to values + * + * @throws ParseException + */ + public static function parse(string $value, int $flags = 0, array &$references = []): mixed + { + self::initialize($flags); + + $value = trim($value); + + if ('' === $value) { + return ''; + } + + $i = 0; + $tag = self::parseTag($value, $i, $flags); + switch ($value[$i]) { + case '[': + $result = self::parseSequence($value, $flags, $i, $references); + ++$i; + break; + case '{': + $result = self::parseMapping($value, $flags, $i, $references); + ++$i; + break; + default: + $result = self::parseScalar($value, $flags, null, $i, true, $references); + } + + // some comments are allowed at the end + if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) { + throw new ParseException(\sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + + if (null !== $tag && '' !== $tag) { + return new TaggedValue($tag, $result); + } + + return $result; + } + + /** + * Dumps a given PHP variable to a YAML string. + * + * @param mixed $value The PHP variable to convert + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + * + * @throws DumpException When trying to dump PHP resource + */ + public static function dump(mixed $value, int $flags = 0, bool $rootLevel = false): string + { + switch (true) { + case \is_resource($value): + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException(\sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value))); + } + + return self::dumpNull($flags); + case $value instanceof \DateTimeInterface: + return $value->format(match (true) { + !$length = \strlen(rtrim($value->format('u'), '0')) => 'c', + $length < 4 => 'Y-m-d\TH:i:s.vP', + default => 'Y-m-d\TH:i:s.uP', + }); + case $value instanceof \UnitEnum: + return \sprintf('!php/enum %s::%s', $value::class, $value->name); + case \is_object($value): + if ($value instanceof TaggedValue) { + return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags); + } + + if (Yaml::DUMP_OBJECT & $flags) { + return '!php/object '.self::dump(serialize($value)); + } + + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { + return self::dumpHashArray($value, $flags); + } + + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException('Object support when dumping a YAML file has been disabled.'); + } + + return self::dumpNull($flags); + case \is_array($value): + return self::dumpArray($value, $flags); + case null === $value: + return self::dumpNull($flags, $rootLevel); + case true === $value: + return 'true'; + case false === $value: + return 'false'; + case \is_int($value): + return $value; + case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"): + $locale = setlocale(\LC_NUMERIC, 0); + if (false !== $locale) { + setlocale(\LC_NUMERIC, 'C'); + } + if (\is_float($value)) { + $repr = (string) $value; + if (is_infinite($value)) { + $repr = str_ireplace('INF', '.Inf', $repr); + } elseif (floor($value) == $value && $repr == $value) { + // Preserve float data type since storing a whole number will result in integer value. + if (!str_contains($repr, 'E')) { + $repr .= '.0'; + } + } + } else { + $repr = \is_string($value) ? "'$value'" : (string) $value; + } + if (false !== $locale) { + setlocale(\LC_NUMERIC, $locale); + } + + return $repr; + case '' == $value: + return "''"; + case self::isBinaryString($value): + return '!!binary '.base64_encode($value); + case Escaper::requiresDoubleQuoting($value): + case Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES & $flags: + return Escaper::escapeWithDoubleQuotes($value); + case Escaper::requiresSingleQuoting($value): + $singleQuoted = Escaper::escapeWithSingleQuotes($value); + if (!str_contains($value, "'")) { + return $singleQuoted; + } + // Attempt double-quoting the string instead to see if it's more efficient. + $doubleQuoted = Escaper::escapeWithDoubleQuotes($value); + + return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted; + case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): + case Parser::preg_match(self::getHexRegex(), $value): + case Parser::preg_match(self::getTimestampRegex(), $value): + return Escaper::escapeWithSingleQuotes($value); + default: + return $value; + } + } + + /** + * Check if given array is hash or just normal indexed array. + */ + public static function isHash(array|\ArrayObject|\stdClass $value): bool + { + if ($value instanceof \stdClass || $value instanceof \ArrayObject) { + return true; + } + + $expectedKey = 0; + + foreach ($value as $key => $val) { + if ($key !== $expectedKey++) { + return true; + } + } + + return false; + } + + /** + * Dumps a PHP array to a YAML string. + * + * @param array $value The PHP array to dump + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + private static function dumpArray(array $value, int $flags): string + { + // array + if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { + $output = []; + foreach ($value as $val) { + $output[] = self::dump($val, $flags); + } + + return \sprintf('[%s]', implode(', ', $output)); + } + + return self::dumpHashArray($value, $flags); + } + + /** + * Dumps hash array to a YAML string. + * + * @param array|\ArrayObject|\stdClass $value The hash array to dump + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $flags): string + { + $output = []; + $keyFlags = $flags & ~Yaml::DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES; + foreach ($value as $key => $val) { + if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { + $key = (string) $key; + } + + $output[] = \sprintf('%s: %s', self::dump($key, $keyFlags), self::dump($val, $flags)); + } + + return \sprintf('{ %s }', implode(', ', $output)); + } + + private static function dumpNull(int $flags, bool $rootLevel = false): string + { + if (Yaml::DUMP_NULL_AS_TILDE & $flags) { + return '~'; + } + + if (Yaml::DUMP_NULL_AS_EMPTY & $flags && !$rootLevel) { + return ''; + } + + return 'null'; + } + + /** + * Parses a YAML scalar. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + public static function parseScalar(string $scalar, int $flags = 0, ?array $delimiters = null, int &$i = 0, bool $evaluate = true, array &$references = [], ?bool &$isQuoted = null): mixed + { + if (\in_array($scalar[$i], ['"', "'"], true)) { + // quoted scalar + $isQuoted = true; + $output = self::parseQuotedScalar($scalar, $i); + + if (null !== $delimiters) { + $tmp = ltrim(substr($scalar, $i), " \n"); + if ('' === $tmp) { + throw new ParseException(\sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + if (!\in_array($tmp[0], $delimiters)) { + throw new ParseException(\sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + } + } else { + // "normal" string + $isQuoted = false; + + if (!$delimiters) { + $output = substr($scalar, $i); + $i += \strlen($output); + + // remove comments + if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { + $output = substr($output, 0, $match[0][1]); + } + } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { + $output = $match[1]; + $i += \strlen($output); + $output = trim($output); + } else { + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); + } + + // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) + if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0] || '%' === $output[0])) { + throw new ParseException(\sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); + } + + if ($evaluate) { + $output = self::evaluateScalar($output, $flags, $references, $isQuoted); + } + } + + return $output; + } + + /** + * Parses a YAML quoted scalar. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + private static function parseQuotedScalar(string $scalar, int &$i = 0): string + { + if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + $output = substr($match[0], 1, -1); + + $unescaper = new Unescaper(); + if ('"' == $scalar[$i]) { + $output = $unescaper->unescapeDoubleQuotedString($output); + } else { + $output = $unescaper->unescapeSingleQuotedString($output); + } + + $i += \strlen($match[0]); + + return $output; + } + + /** + * Parses a YAML sequence. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + private static function parseSequence(string $sequence, int $flags, int &$i = 0, array &$references = []): array + { + $output = []; + $len = \strlen($sequence); + ++$i; + + // [foo, bar, ...] + $lastToken = null; + while ($i < $len) { + if (']' === $sequence[$i]) { + return $output; + } + if (',' === $sequence[$i] || ' ' === $sequence[$i]) { + if (',' === $sequence[$i] && (null === $lastToken || 'separator' === $lastToken)) { + $output[] = null; + } elseif (',' === $sequence[$i]) { + $lastToken = 'separator'; + } + + ++$i; + + continue; + } + + $tag = self::parseTag($sequence, $i, $flags); + switch ($sequence[$i]) { + case '[': + // nested sequence + $value = self::parseSequence($sequence, $flags, $i, $references); + break; + case '{': + // nested mapping + $value = self::parseMapping($sequence, $flags, $i, $references); + break; + default: + $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references, $isQuoted); + + // the value can be an array if a reference has been resolved to an array var + if (\is_string($value) && !$isQuoted && str_contains($value, ': ')) { + // embedded mapping? + $j = $i; + $mappingValue = $value; + $mappingException = null; + do { + try { + $pos = 0; + $value = self::parseMapping('{'.$mappingValue.'}', $flags, $pos, $references); + $i = $j; + $mappingException = null; + break; + } catch (ParseException $exception) { + $mappingException = $exception; + if ($j >= $len) { + break; + } + + $mappingValue .= $sequence[$j++]; + if ($j >= $len) { + break; + } + + $mappingValue .= self::parseScalar($sequence, $flags, [',', ']'], $j, null === $tag, $references); + } + } while ($j < $len); + + if ($mappingException) { + throw $mappingException; + } + } + + if (!$isQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { + $references[$matches['ref']] = $matches['value']; + $value = $matches['value']; + } + + --$i; + } + + if (null !== $tag && '' !== $tag) { + $value = new TaggedValue($tag, $value); + } + + $output[] = $value; + + $lastToken = 'value'; + ++$i; + } + + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); + } + + /** + * Parses a YAML mapping. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []): array|\stdClass + { + $output = []; + $len = \strlen($mapping); + ++$i; + $allowOverwrite = false; + + // {foo: bar, bar:foo, ...} + while ($i < $len) { + switch ($mapping[$i]) { + case ' ': + case ',': + case "\n": + ++$i; + continue 2; + case '}': + if (self::$objectForMap) { + return (object) $output; + } + + return $output; + } + + // key + $offsetBeforeKeyParsing = $i; + $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], true); + $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false); + + if ($offsetBeforeKeyParsing === $i) { + throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping); + } + + if ('!php/const' === $key || '!php/enum' === $key) { + $key .= ' '.self::parseScalar($mapping, $flags, ['(?value')) { + $enumName = substr($enumName, 0, -7); + } + + if (!\defined($enumName)) { + throw new ParseException(\sprintf('The string "%s" is not the name of a valid enum.', $enumName), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + $value = \constant($enumName); + + if (!$useValue) { + return $value; + } + if (!$value instanceof \BackedEnum) { + throw new ParseException(\sprintf('The enum "%s" defines no value next to its name.', $enumName), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + return $value->value; + } + if (self::$exceptionOnInvalidType) { + throw new ParseException(\sprintf('The string "%s" could not be parsed as an enum. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + return null; + case str_starts_with($scalar, '!!float '): + return (float) substr($scalar, 8); + case str_starts_with($scalar, '!!binary '): + return self::evaluateBinaryScalar(substr($scalar, 9)); + } + + throw new ParseException(\sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename); + case preg_match('/^(?:\+|-)?0o(?P[0-7_]++)$/', $scalar, $matches): + $value = str_replace('_', '', $matches['value']); + + if ('-' === $scalar[0]) { + return -octdec($value); + } + + return octdec($value); + case \in_array($scalar[0], ['+', '-', '.'], true) || is_numeric($scalar[0]): + if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { + $scalar = str_replace('_', '', $scalar); + } + + switch (true) { + case ctype_digit($scalar): + case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): + if ($scalar < \PHP_INT_MIN || \PHP_INT_MAX < $scalar) { + return $scalar; + } + + $cast = (int) $scalar; + + return ($scalar === (string) $cast) ? $cast : $scalar; + case is_numeric($scalar): + case Parser::preg_match(self::getHexRegex(), $scalar): + $scalar = str_replace('_', '', $scalar); + + return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; + case '.inf' === $scalarLower: + case '.nan' === $scalarLower: + return -log(0); + case '-.inf' === $scalarLower: + return log(0); + case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar): + return (float) str_replace('_', '', $scalar); + case Parser::preg_match(self::getTimestampRegex(), $scalar): + try { + // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. + $time = new \DateTimeImmutable($scalar, new \DateTimeZone('UTC')); + } catch (\Exception $e) { + // Some dates accepted by the regex are not valid dates. + throw new ParseException(\sprintf('The date "%s" could not be parsed as it is an invalid date.', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename, $e); + } + + if (Yaml::PARSE_DATETIME & $flags) { + return $time; + } + + if ('' !== rtrim($time->format('u'), '0')) { + return (float) $time->format('U.u'); + } + + try { + if (false !== $scalar = $time->getTimestamp()) { + return $scalar; + } + } catch (\DateRangeError|\ValueError) { + // no-op + } + + return $time->format('U'); + } + } + + return (string) $scalar; + } + + private static function parseTag(string $value, int &$i, int $flags): ?string + { + if ('!' !== $value[$i]) { + return null; + } + + $tagLength = strcspn($value, " \t\n[]{},", $i + 1); + $tag = substr($value, $i + 1, $tagLength); + + $nextOffset = $i + $tagLength + 1; + $nextOffset += strspn($value, ' ', $nextOffset); + + if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], true))) { + throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + + // Is followed by a scalar and is a built-in tag + if ('' !== $tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && ('!' === $tag[0] || \in_array($tag, ['str', 'php/const', 'php/enum', 'php/object'], true))) { + // Manage in {@link self::evaluateScalar()} + return null; + } + + $i = $nextOffset; + + // Built-in tags + if ('' !== $tag && '!' === $tag[0]) { + throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + + if ('' !== $tag && !isset($value[$i])) { + throw new ParseException(\sprintf('Missing value for tag "%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + + if ('' === $tag || Yaml::PARSE_CUSTOM_TAGS & $flags) { + return $tag; + } + + throw new ParseException(\sprintf('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + + public static function evaluateBinaryScalar(string $scalar): string + { + $parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar)); + + if (0 !== (\strlen($parsedBinaryData) % 4)) { + throw new ParseException(\sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { + throw new ParseException(\sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + + return base64_decode($parsedBinaryData, true); + } + + private static function isBinaryString(string $value): bool + { + return !preg_match('//u', $value) || preg_match('/[^\x00\x07-\x0d\x1B\x20-\xff]/', $value); + } + + /** + * Gets a regex that matches a YAML date. + * + * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 + */ + private static function getTimestampRegex(): string + { + return <<[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:(?:[Tt]|[ \t]+) + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\.(?P[0-9]*))? + (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)? + $~x + EOF; + } + + /** + * Gets a regex that matches a YAML number in hexadecimal notation. + */ + private static function getHexRegex(): string + { + return '~^0x[0-9a-f_]++$~i'; + } +} diff --git a/vendor/symfony/yaml/LICENSE b/vendor/symfony/yaml/LICENSE new file mode 100644 index 0000000..0138f8f --- /dev/null +++ b/vendor/symfony/yaml/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php new file mode 100644 index 0000000..b7af7c9 --- /dev/null +++ b/vendor/symfony/yaml/Parser.php @@ -0,0 +1,1279 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Tag\TaggedValue; + +/** + * Parser parses YAML strings to convert them to PHP arrays. + * + * @author Fabien Potencier + * + * @final + */ +class Parser +{ + public const TAG_PATTERN = '(?P![\w!.\/:-]+)'; + public const BLOCK_SCALAR_HEADER_PATTERN = '(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?'; + public const REFERENCE_PATTERN = '#^&(?P[^ ]++) *+(?P.*)#u'; + + private ?string $filename = null; + private int $offset = 0; + private int $numberOfParsedLines = 0; + private ?int $totalNumberOfLines = null; + private array $lines = []; + private int $currentLineNb = -1; + private string $currentLine = ''; + private array $refs = []; + private array $skippedLineNumbers = []; + private array $locallySkippedLineNumbers = []; + private array $refsBeingParsed = []; + + /** + * Parses a YAML file into a PHP value. + * + * @param string $filename The path to the YAML file to be parsed + * @param int-mask-of $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the file could not be read or the YAML is not valid + */ + public function parseFile(string $filename, int $flags = 0): mixed + { + if (!is_file($filename)) { + throw new ParseException(\sprintf('File "%s" does not exist.', $filename)); + } + + if (!is_readable($filename)) { + throw new ParseException(\sprintf('File "%s" cannot be read.', $filename)); + } + + $this->filename = $filename; + + try { + return $this->parse(file_get_contents($filename), $flags); + } finally { + $this->filename = null; + } + } + + /** + * Parses a YAML string to a PHP value. + * + * @param string $value A YAML string + * @param int-mask-of $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the YAML is not valid + */ + public function parse(string $value, int $flags = 0): mixed + { + if (false === preg_match('//u', $value)) { + throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); + } + + $this->refs = []; + + try { + $data = $this->doParse($value, $flags); + } finally { + $this->refsBeingParsed = []; + $this->offset = 0; + $this->lines = []; + $this->currentLine = ''; + $this->numberOfParsedLines = 0; + $this->refs = []; + $this->skippedLineNumbers = []; + $this->locallySkippedLineNumbers = []; + $this->totalNumberOfLines = null; + } + + return $data; + } + + private function doParse(string $value, int $flags): mixed + { + $this->currentLineNb = -1; + $this->currentLine = ''; + $value = $this->cleanup($value); + $this->lines = explode("\n", $value); + $this->numberOfParsedLines = \count($this->lines); + $this->locallySkippedLineNumbers = []; + $this->totalNumberOfLines ??= $this->numberOfParsedLines; + + if (!$this->moveToNextLine()) { + return null; + } + + $data = []; + $context = null; + $allowOverwrite = false; + + while ($this->isCurrentLineEmpty()) { + if (!$this->moveToNextLine()) { + return null; + } + } + + // Resolves the tag and returns if end of the document + if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, false)) && !$this->moveToNextLine()) { + return new TaggedValue($tag, ''); + } + + do { + if ($this->isCurrentLineEmpty()) { + continue; + } + + // tab? + if ("\t" === $this->currentLine[0]) { + throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); + + $isRef = $mergeNode = false; + if ('-' === $this->currentLine[0] && self::preg_match('#^\-((?P\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) { + if ($context && 'mapping' == $context) { + throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + $context = 'sequence'; + + if (isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { + $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; + $values['value'] = $matches['value']; + } + + if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) { + throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + // array + if (isset($values['value']) && str_starts_with(ltrim($values['value'], ' '), '-')) { + // Inline first child + $currentLineNumber = $this->getRealCurrentLineNb(); + + $sequenceIndentation = \strlen($values['leadspaces']) + 1; + $sequenceYaml = substr($this->currentLine, $sequenceIndentation); + $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); + + $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); + } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || str_starts_with(ltrim($values['value'], ' '), '#')) { + $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true) ?? '', $flags); + } elseif (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags)) { + $data[] = new TaggedValue( + $subTag, + $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags) + ); + } else { + if ( + isset($values['leadspaces']) + && ( + '!' === $values['value'][0] + || self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $this->trimTag($values['value']), $matches) + ) + ) { + $block = $values['value']; + if ($this->isNextLineIndented() || isset($matches['value']) && '>-' === $matches['value']) { + $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); + } + + $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); + } else { + $data[] = $this->parseValue($values['value'], $flags, $context); + } + } + if ($isRef) { + $this->refs[$isRef] = end($data); + array_pop($this->refsBeingParsed); + } + } elseif ( + self::preg_match('#^(?P(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{!].*?)) *\:(( |\t)++(?P.+))?$#u', rtrim($this->currentLine), $values) + && (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"], true)) + ) { + if ($context && 'sequence' == $context) { + throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + $context = 'mapping'; + + try { + $key = Inline::parseScalar($values['key']); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + + if (!\is_string($key) && !\is_int($key)) { + throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string').' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + // Convert float keys to strings, to avoid being converted to integers by PHP + if (\is_float($key)) { + $key = (string) $key; + } + + if ('<<' === $key && (!isset($values['value']) || '&' !== $values['value'][0] || !self::preg_match('#^&(?P[^ ]+)#u', $values['value'], $refMatches))) { + $mergeNode = true; + $allowOverwrite = true; + if (isset($values['value'][0]) && '*' === $values['value'][0]) { + $refName = substr(rtrim($values['value']), 1); + if (!\array_key_exists($refName, $this->refs)) { + if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) { + throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$refName])), $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + + throw new ParseException(\sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + $refValue = $this->refs[$refName]; + + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) { + $refValue = (array) $refValue; + } + + if (!\is_array($refValue)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + $data += $refValue; // array union + } else { + if (isset($values['value']) && '' !== $values['value']) { + $value = $values['value']; + } else { + $value = $this->getNextEmbedBlock(); + } + $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags); + + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof \stdClass) { + $parsed = (array) $parsed; + } + + if (!\is_array($parsed)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + if (isset($parsed[0])) { + // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes + // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier + // in the sequence override keys specified in later mapping nodes. + foreach ($parsed as $parsedItem) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof \stdClass) { + $parsedItem = (array) $parsedItem; + } + + if (!\is_array($parsedItem)) { + throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); + } + + $data += $parsedItem; // array union + } + } else { + // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the + // current mapping, unless the key already exists in it. + $data += $parsed; // array union + } + } + } elseif ('<<' !== $key && isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { + $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; + $values['value'] = $matches['value']; + } + + $subTag = null; + if ($mergeNode) { + // Merge keys + } elseif (!isset($values['value']) || '' === $values['value'] || str_starts_with($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { + // hash + // if next line is less indented or equal, then it means that the current value is null + if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + if (!$allowOverwrite && \array_key_exists($key, $data)) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + if (null !== $subTag) { + $data[$key] = new TaggedValue($subTag, ''); + } else { + $data[$key] = null; + } + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + } else { + // remember the parsed line number here in case we need it to provide some contexts in error messages below + $realCurrentLineNbKey = $this->getRealCurrentLineNb(); + $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); + if ('<<' === $key) { + $this->refs[$refMatches['ref']] = $value; + + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) { + $value = (array) $value; + } + + $data += $value; + } elseif ($allowOverwrite || !isset($data[$key])) { + if (!$allowOverwrite && \array_key_exists($key, $data)) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if (null !== $subTag) { + $data[$key] = new TaggedValue($subTag, $value); + } else { + $data[$key] = $value; + } + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine); + } + } + } else { + $value = $this->parseValue(rtrim($values['value']), $flags, $context); + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + if (!$allowOverwrite && \array_key_exists($key, $data)) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + $data[$key] = $value; + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + } + if ($isRef) { + $this->refs[$isRef] = $data[$key]; + array_pop($this->refsBeingParsed); + } + } elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + try { + return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + } elseif ('{' === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + try { + $parsedMapping = Inline::parse($this->lexInlineMapping(), $flags, $this->refs); + + while ($this->moveToNextLine()) { + if (!$this->isCurrentLineEmpty()) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + + return $parsedMapping; + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + } elseif ('[' === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + try { + $parsedSequence = Inline::parse($this->lexInlineSequence(), $flags, $this->refs); + + while ($this->moveToNextLine()) { + if (!$this->isCurrentLineEmpty()) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + + return $parsedSequence; + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + } else { + // multiple documents are not supported + if ('---' === $this->currentLine) { + throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + + if (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) { + throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + // 1-liner optionally followed by newline(s) + if (\is_string($value) && $this->lines[0] === trim($value)) { + try { + $value = Inline::parse($this->lines[0], $flags, $this->refs); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + + return $value; + } + + // try to parse the value as a multi-line string as a last resort + if (0 === $this->currentLineNb) { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = false; + $value = ''; + + foreach ($this->lines as $line) { + $trimmedLine = trim($line); + if ('#' === ($trimmedLine[0] ?? '')) { + continue; + } + // If the indentation is not consistent at offset 0, it is to be considered as a ParseError + if (0 === $this->offset && isset($line[0]) && ' ' === $line[0]) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + if (str_contains($line, ': ')) { + throw new ParseException('Mapping values are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + if ('' === $trimmedLine) { + $value .= "\n"; + } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { + $value .= ' '; + } + + if ('' !== $trimmedLine && str_ends_with($line, '\\')) { + $value .= ltrim(substr($line, 0, -1)); + } elseif ('' !== $trimmedLine) { + $value .= $trimmedLine; + } + + if ('' === $trimmedLine) { + $previousLineWasNewline = true; + $previousLineWasTerminatedWithBackslash = false; + } elseif (str_ends_with($line, '\\')) { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = true; + } else { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = false; + } + } + + try { + return Inline::parse(trim($value)); + } catch (ParseException) { + // fall-through to the ParseException thrown below + } + } + + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } while ($this->moveToNextLine()); + + if (null !== $tag) { + $data = new TaggedValue($tag, $data); + } + + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && 'mapping' === $context && !\is_object($data)) { + $object = new \stdClass(); + + foreach ($data as $key => $value) { + $object->$key = $value; + } + + $data = $object; + } + + return $data ?: null; + } + + private function parseBlock(int $offset, string $yaml, int $flags): mixed + { + $skippedLineNumbers = $this->skippedLineNumbers; + + foreach ($this->locallySkippedLineNumbers as $lineNumber) { + if ($lineNumber < $offset) { + continue; + } + + $skippedLineNumbers[] = $lineNumber; + } + + $parser = new self(); + $parser->offset = $offset; + $parser->totalNumberOfLines = $this->totalNumberOfLines; + $parser->skippedLineNumbers = $skippedLineNumbers; + $parser->refs = &$this->refs; + $parser->refsBeingParsed = $this->refsBeingParsed; + + return $parser->doParse($yaml, $flags); + } + + /** + * Returns the current line number (takes the offset into account). + * + * @internal + */ + public function getRealCurrentLineNb(): int + { + $realCurrentLineNumber = $this->currentLineNb + $this->offset; + + foreach ($this->skippedLineNumbers as $skippedLineNumber) { + if ($skippedLineNumber > $realCurrentLineNumber) { + break; + } + + ++$realCurrentLineNumber; + } + + return $realCurrentLineNumber; + } + + private function getCurrentLineIndentation(): int + { + if (' ' !== ($this->currentLine[0] ?? '')) { + return 0; + } + + return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' ')); + } + + /** + * Returns the next embed block of YAML. + * + * @param int|null $indentation The indent level at which the block is to be read, or null for default + * @param bool $inSequence True if the enclosing data structure is a sequence + * + * @throws ParseException When indentation problem are detected + */ + private function getNextEmbedBlock(?int $indentation = null, bool $inSequence = false): string + { + $oldLineIndentation = $this->getCurrentLineIndentation(); + + if (!$this->moveToNextLine()) { + return ''; + } + + if (null === $indentation) { + $newIndent = null; + $movements = 0; + + do { + $EOF = false; + + // empty and comment-like lines do not influence the indentation depth + if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { + $EOF = !$this->moveToNextLine(); + + if (!$EOF) { + ++$movements; + } + } else { + $newIndent = $this->getCurrentLineIndentation(); + } + } while (!$EOF && null === $newIndent); + + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + + $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); + + if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } else { + $newIndent = $indentation; + } + + $data = []; + + if ($this->getCurrentLineIndentation() >= $newIndent) { + $data[] = substr($this->currentLine, $newIndent ?? 0); + } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { + $data[] = $this->currentLine; + } else { + $this->moveToPreviousLine(); + + return ''; + } + + if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) { + // the previous line contained a dash but no item content, this line is a sequence item with the same indentation + // and therefore no nested list or mapping + $this->moveToPreviousLine(); + + return ''; + } + + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); + $isItComment = $this->isCurrentLineComment(); + + while ($this->moveToNextLine()) { + if ($isItComment && !$isItUnindentedCollection) { + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); + $isItComment = $this->isCurrentLineComment(); + } + + $indent = $this->getCurrentLineIndentation(); + + if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { + $this->moveToPreviousLine(); + break; + } + + if ($this->isCurrentLineBlank()) { + $data[] = substr($this->currentLine, $newIndent ?? 0); + continue; + } + + if ($indent >= $newIndent) { + $data[] = substr($this->currentLine, $newIndent ?? 0); + } elseif ($this->isCurrentLineComment()) { + $data[] = $this->currentLine; + } elseif (0 == $indent) { + $this->moveToPreviousLine(); + + break; + } else { + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + + return implode("\n", $data); + } + + private function hasMoreLines(): bool + { + return (\count($this->lines) - 1) > $this->currentLineNb; + } + + /** + * Moves the parser to the next line. + */ + private function moveToNextLine(): bool + { + if ($this->currentLineNb >= $this->numberOfParsedLines - 1) { + return false; + } + + $this->currentLine = $this->lines[++$this->currentLineNb]; + + return true; + } + + /** + * Moves the parser to the previous line. + */ + private function moveToPreviousLine(): bool + { + if ($this->currentLineNb < 1) { + return false; + } + + $this->currentLine = $this->lines[--$this->currentLineNb]; + + return true; + } + + /** + * Parses a YAML value. + * + * @param string $value A YAML value + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * @param string $context The parser context (either sequence or mapping) + * + * @throws ParseException When reference does not exist + */ + private function parseValue(string $value, int $flags, string $context): mixed + { + if (str_starts_with($value, '*')) { + if (false !== $pos = strpos($value, '#')) { + $value = substr($value, 1, $pos - 2); + } else { + $value = substr($value, 1); + } + + if (!\array_key_exists($value, $this->refs)) { + if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) { + throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$value])), $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + + throw new ParseException(\sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + + return $this->refs[$value]; + } + + if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { + $modifiers = $matches['modifiers'] ?? ''; + + $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers)); + + if ('' !== $matches['tag'] && '!' !== $matches['tag']) { + if ('!!binary' === $matches['tag']) { + return Inline::evaluateBinaryScalar($data); + } + + return new TaggedValue(substr($matches['tag'], 1), $data); + } + + return $data; + } + + try { + if ('' !== $value && '{' === $value[0]) { + $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); + + return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs); + } elseif ('' !== $value && '[' === $value[0]) { + $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); + + return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs); + } + + switch ($value[0] ?? '') { + case '"': + case "'": + $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); + $parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs); + + if (isset($this->currentLine[$cursor]) && preg_replace('/\s*(#.*)?$/A', '', substr($this->currentLine, $cursor))) { + throw new ParseException(\sprintf('Unexpected characters near "%s".', substr($this->currentLine, $cursor))); + } + + return $parsedValue; + default: + $lines = []; + + while ($this->moveToNextLine()) { + // unquoted strings end before the first unindented line + if (0 === $this->getCurrentLineIndentation()) { + $this->moveToPreviousLine(); + + break; + } + + if ($this->isCurrentLineComment()) { + break; + } + + if ('mapping' === $context && str_contains($this->currentLine, ': ') && !$this->isCurrentLineComment()) { + throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + + $lines[] = trim($this->currentLine); + } + + for ($i = 0, $linesCount = \count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) { + if ('' === $lines[$i]) { + $value .= "\n"; + $previousLineBlank = true; + } elseif ($previousLineBlank) { + $value .= $lines[$i]; + $previousLineBlank = false; + } else { + $value .= ' '.$lines[$i]; + $previousLineBlank = false; + } + } + + Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); + + $parsedValue = Inline::parse($value, $flags, $this->refs); + + if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && str_contains($parsedValue, ': ')) { + throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + + return $parsedValue; + } + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + + throw $e; + } + } + + /** + * Parses a block scalar. + * + * @param string $style The style indicator that was used to begin this block scalar (| or >) + * @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -) + * @param int $indentation The indentation indicator that was used to begin this block scalar + */ + private function parseBlockScalar(string $style, string $chomping = '', int $indentation = 0): string + { + $notEOF = $this->moveToNextLine(); + if (!$notEOF) { + return ''; + } + + $isCurrentLineBlank = $this->isCurrentLineBlank(); + $blockLines = []; + + // leading blank lines are consumed before determining indentation + while ($notEOF && $isCurrentLineBlank) { + // newline only if not EOF + if ($notEOF = $this->moveToNextLine()) { + $blockLines[] = ''; + $isCurrentLineBlank = $this->isCurrentLineBlank(); + } + } + + // determine indentation if not specified + if (0 === $indentation) { + $currentLineLength = \strlen($this->currentLine); + + for ($i = 0; $i < $currentLineLength && ' ' === $this->currentLine[$i]; ++$i) { + ++$indentation; + } + } + + if ($indentation > 0) { + $pattern = \sprintf('/^ {%d}(.*)$/', $indentation); + + while ( + $notEOF && ( + $isCurrentLineBlank + || self::preg_match($pattern, $this->currentLine, $matches) + ) + ) { + if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { + $blockLines[] = substr($this->currentLine, $indentation); + } elseif ($isCurrentLineBlank) { + $blockLines[] = ''; + } else { + $blockLines[] = $matches[1]; + } + + // newline only if not EOF + if ($notEOF = $this->moveToNextLine()) { + $isCurrentLineBlank = $this->isCurrentLineBlank(); + } + } + } elseif ($notEOF) { + $blockLines[] = ''; + } + + if ($notEOF) { + $blockLines[] = ''; + $this->moveToPreviousLine(); + } elseif (!$this->isCurrentLineLastLineInDocument()) { + $blockLines[] = ''; + } + + // folded style + if ('>' === $style) { + $text = ''; + $previousLineIndented = false; + $previousLineBlank = false; + + for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) { + if ('' === $blockLines[$i]) { + $text .= "\n"; + $previousLineIndented = false; + $previousLineBlank = true; + } elseif (' ' === $blockLines[$i][0]) { + $text .= "\n".$blockLines[$i]; + $previousLineIndented = true; + $previousLineBlank = false; + } elseif ($previousLineIndented) { + $text .= "\n".$blockLines[$i]; + $previousLineIndented = false; + $previousLineBlank = false; + } elseif ($previousLineBlank || 0 === $i) { + $text .= $blockLines[$i]; + $previousLineIndented = false; + $previousLineBlank = false; + } else { + $text .= ' '.$blockLines[$i]; + $previousLineIndented = false; + $previousLineBlank = false; + } + } + } else { + $text = implode("\n", $blockLines); + } + + // deal with trailing newlines + if ('' === $chomping) { + $text = preg_replace('/\n+$/', "\n", $text); + } elseif ('-' === $chomping) { + $text = preg_replace('/\n+$/', '', $text); + } + + return $text; + } + + /** + * Returns true if the next line is indented. + */ + private function isNextLineIndented(): bool + { + $currentIndentation = $this->getCurrentLineIndentation(); + $movements = 0; + + do { + $EOF = !$this->moveToNextLine(); + + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); + + if ($EOF) { + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + + return false; + } + + $ret = $this->getCurrentLineIndentation() > $currentIndentation; + + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + + return $ret; + } + + private function isCurrentLineEmpty(): bool + { + return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); + } + + private function isCurrentLineBlank(): bool + { + return '' === $this->currentLine || '' === trim($this->currentLine, ' '); + } + + private function isCurrentLineComment(): bool + { + // checking explicitly the first char of the trim is faster than loops or strpos + $ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine; + + return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0]; + } + + private function isCurrentLineLastLineInDocument(): bool + { + return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); + } + + private function cleanup(string $value): string + { + $value = str_replace(["\r\n", "\r"], "\n", $value); + + // strip YAML header + $count = 0; + $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count); + $this->offset += $count; + + // remove leading comments + $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); + if (1 === $count) { + // items have been removed, update the offset + $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); + $value = $trimmedValue; + } + + // remove start of the document marker (---) + $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); + if (1 === $count) { + // items have been removed, update the offset + $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); + $value = $trimmedValue; + + // remove end of the document marker (...) + $value = preg_replace('#\.\.\.\s*$#', '', $value); + } + + return $value; + } + + private function isNextLineUnIndentedCollection(): bool + { + $currentIndentation = $this->getCurrentLineIndentation(); + $movements = 0; + + do { + $EOF = !$this->moveToNextLine(); + + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); + + if ($EOF) { + return false; + } + + $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); + + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + + return $ret; + } + + private function isStringUnIndentedCollectionItem(): bool + { + return '-' === rtrim($this->currentLine) || str_starts_with($this->currentLine, '- '); + } + + /** + * A local wrapper for "preg_match" which will throw a ParseException if there + * is an internal error in the PCRE engine. + * + * This avoids us needing to check for "false" every time PCRE is used + * in the YAML engine + * + * @throws ParseException on a PCRE internal error + * + * @internal + */ + public static function preg_match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int + { + if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) { + throw new ParseException(preg_last_error_msg()); + } + + return $ret; + } + + /** + * Trim the tag on top of the value. + * + * Prevent values such as "!foo {quz: bar}" to be considered as + * a mapping block. + */ + private function trimTag(string $value): string + { + if ('!' === $value[0]) { + return ltrim(substr($value, 1, strcspn($value, " \r\n", 1)), ' '); + } + + return $value; + } + + private function getLineTag(string $value, int $flags, bool $nextLineCheck = true): ?string + { + if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) { + return null; + } + + if ($nextLineCheck && !$this->isNextLineIndented()) { + return null; + } + + $tag = substr($matches['tag'], 1); + + // Built-in tags + if ($tag && '!' === $tag[0]) { + throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + + if (Yaml::PARSE_CUSTOM_TAGS & $flags) { + return $tag; + } + + throw new ParseException(\sprintf('Tags support is not enabled. You must use the flag "Yaml::PARSE_CUSTOM_TAGS" to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + + private function lexInlineQuotedString(int &$cursor = 0): string + { + $quotation = $this->currentLine[$cursor]; + $value = $quotation; + ++$cursor; + + $previousLineWasNewline = true; + $previousLineWasTerminatedWithBackslash = false; + $lineNumber = 0; + + do { + if (++$lineNumber > 1) { + $cursor += strspn($this->currentLine, ' ', $cursor); + } + + if ($this->isCurrentLineBlank()) { + $value .= "\n"; + } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { + $value .= ' '; + } + + for (; \strlen($this->currentLine) > $cursor; ++$cursor) { + switch ($this->currentLine[$cursor]) { + case '\\': + if ("'" === $quotation) { + $value .= '\\'; + } elseif (isset($this->currentLine[++$cursor])) { + $value .= '\\'.$this->currentLine[$cursor]; + } + + break; + case $quotation: + ++$cursor; + + if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor]) { + $value .= "''"; + break; + } + + return $value.$quotation; + default: + $value .= $this->currentLine[$cursor]; + } + } + + if ($this->isCurrentLineBlank()) { + $previousLineWasNewline = true; + $previousLineWasTerminatedWithBackslash = false; + } elseif ('\\' === $this->currentLine[-1]) { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = true; + } else { + $previousLineWasNewline = false; + $previousLineWasTerminatedWithBackslash = false; + } + + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + + throw new ParseException('Malformed inline YAML string.'); + } + + private function lexUnquotedString(int &$cursor): string + { + $offset = $cursor; + + while ($cursor < \strlen($this->currentLine)) { + if (\in_array($this->currentLine[$cursor], ['[', ']', '{', '}', ',', ':'], true)) { + break; + } + + if (\in_array($this->currentLine[$cursor], [' ', "\t"], true) && '#' === ($this->currentLine[$cursor + 1] ?? '')) { + break; + } + + ++$cursor; + } + + if ($cursor === $offset) { + throw new ParseException('Malformed unquoted YAML string.'); + } + + return substr($this->currentLine, $offset, $cursor - $offset); + } + + private function lexInlineMapping(int &$cursor = 0, bool $consumeUntilEol = true): string + { + return $this->lexInlineStructure($cursor, '}', $consumeUntilEol); + } + + private function lexInlineSequence(int &$cursor = 0, bool $consumeUntilEol = true): string + { + return $this->lexInlineStructure($cursor, ']', $consumeUntilEol); + } + + private function lexInlineStructure(int &$cursor, string $closingTag, bool $consumeUntilEol = true): string + { + $value = $this->currentLine[$cursor]; + ++$cursor; + + do { + $this->consumeWhitespaces($cursor); + + while (isset($this->currentLine[$cursor])) { + switch ($this->currentLine[$cursor]) { + case '"': + case "'": + $value .= $this->lexInlineQuotedString($cursor); + break; + case ':': + case ',': + $value .= $this->currentLine[$cursor]; + ++$cursor; + break; + case '{': + $value .= $this->lexInlineMapping($cursor, false); + break; + case '[': + $value .= $this->lexInlineSequence($cursor, false); + break; + case $closingTag: + $value .= $this->currentLine[$cursor]; + ++$cursor; + + if ($consumeUntilEol && isset($this->currentLine[$cursor]) && ($whitespaces = strspn($this->currentLine, ' ', $cursor) + $cursor) < \strlen($this->currentLine) && '#' !== $this->currentLine[$whitespaces]) { + throw new ParseException(\sprintf('Unexpected token "%s".', trim(substr($this->currentLine, $cursor)))); + } + + return $value; + case '#': + break 2; + default: + $value .= $this->lexUnquotedString($cursor); + } + + if ($this->consumeWhitespaces($cursor)) { + $value .= ' '; + } + } + + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + + throw new ParseException('Malformed inline YAML string.'); + } + + private function consumeWhitespaces(int &$cursor): bool + { + $whitespacesConsumed = 0; + + do { + $whitespaceOnlyTokenLength = strspn($this->currentLine, " \t", $cursor); + $whitespacesConsumed += $whitespaceOnlyTokenLength; + $cursor += $whitespaceOnlyTokenLength; + + if (isset($this->currentLine[$cursor])) { + return 0 < $whitespacesConsumed; + } + + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + + return 0 < $whitespacesConsumed; + } +} diff --git a/vendor/symfony/yaml/README.md b/vendor/symfony/yaml/README.md new file mode 100644 index 0000000..ac25024 --- /dev/null +++ b/vendor/symfony/yaml/README.md @@ -0,0 +1,13 @@ +Yaml Component +============== + +The Yaml component loads and dumps YAML files. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/yaml.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/yaml/Resources/bin/yaml-lint b/vendor/symfony/yaml/Resources/bin/yaml-lint new file mode 100755 index 0000000..19bf58e --- /dev/null +++ b/vendor/symfony/yaml/Resources/bin/yaml-lint @@ -0,0 +1,49 @@ +#!/usr/bin/env php + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if ('cli' !== \PHP_SAPI) { + throw new Exception('This script must be run from the command line.'); +} + +/** + * Runs the Yaml lint command. + * + * @author Jan Schädlich + */ + +use Symfony\Component\Console\Application; +use Symfony\Component\Yaml\Command\LintCommand; + +function includeIfExists(string $file): bool +{ + return file_exists($file) && include $file; +} + +if ( + !includeIfExists(__DIR__ . '/../../../../autoload.php') && + !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && + !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') +) { + fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); + exit(1); +} + +if (!class_exists(Application::class)) { + fwrite(STDERR, 'You need the "symfony/console" component in order to run the Yaml linter.'.PHP_EOL); + exit(1); +} + +(new Application())->addCommand($command = new LintCommand()) + ->getApplication() + ->setDefaultCommand($command->getName(), true) + ->run() +; diff --git a/vendor/symfony/yaml/Tag/TaggedValue.php b/vendor/symfony/yaml/Tag/TaggedValue.php new file mode 100644 index 0000000..9d29193 --- /dev/null +++ b/vendor/symfony/yaml/Tag/TaggedValue.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Tag; + +/** + * @author Nicolas Grekas + * @author Guilhem N. + */ +final class TaggedValue +{ + public function __construct( + private string $tag, + private mixed $value, + ) { + } + + public function getTag(): string + { + return $this->tag; + } + + public function getValue(): mixed + { + return $this->value; + } +} diff --git a/vendor/symfony/yaml/Unescaper.php b/vendor/symfony/yaml/Unescaper.php new file mode 100644 index 0000000..1df0cf2 --- /dev/null +++ b/vendor/symfony/yaml/Unescaper.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +use Symfony\Component\Yaml\Exception\ParseException; + +/** + * Unescaper encapsulates unescaping rules for single and double-quoted + * YAML strings. + * + * @author Matthew Lewinski + * + * @internal + */ +class Unescaper +{ + /** + * Regex fragment that matches an escaped character in a double quoted string. + */ + public const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)'; + + /** + * Unescapes a single quoted string. + * + * @param string $value A single quoted string + */ + public function unescapeSingleQuotedString(string $value): string + { + return str_replace('\'\'', '\'', $value); + } + + /** + * Unescapes a double quoted string. + * + * @param string $value A double quoted string + */ + public function unescapeDoubleQuotedString(string $value): string + { + $callback = fn ($match) => $this->unescapeCharacter($match[0]); + + // evaluate the string + return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); + } + + /** + * Unescapes a character that was found in a double-quoted string. + * + * @param string $value An escaped character + */ + private function unescapeCharacter(string $value): string + { + return match ($value[1]) { + '0' => "\x0", + 'a' => "\x7", + 'b' => "\x8", + 't' => "\t", + "\t" => "\t", + 'n' => "\n", + 'v' => "\xB", + 'f' => "\xC", + 'r' => "\r", + 'e' => "\x1B", + ' ' => ' ', + '"' => '"', + '/' => '/', + '\\' => '\\', + // U+0085 NEXT LINE + 'N' => "\xC2\x85", + // U+00A0 NO-BREAK SPACE + '_' => "\xC2\xA0", + // U+2028 LINE SEPARATOR + 'L' => "\xE2\x80\xA8", + // U+2029 PARAGRAPH SEPARATOR + 'P' => "\xE2\x80\xA9", + 'x' => self::utf8chr(hexdec(substr($value, 2, 2))), + 'u' => self::utf8chr(hexdec(substr($value, 2, 4))), + 'U' => self::utf8chr(hexdec(substr($value, 2, 8))), + default => throw new ParseException(\sprintf('Found unknown escape character "%s".', $value)), + }; + } + + /** + * Get the UTF-8 character for the given code point. + */ + private static function utf8chr(int $c): string + { + if (0x80 > $c %= 0x200000) { + return \chr($c); + } + if (0x800 > $c) { + return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); + } + if (0x10000 > $c) { + return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); + } + + return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); + } +} diff --git a/vendor/symfony/yaml/Yaml.php b/vendor/symfony/yaml/Yaml.php new file mode 100644 index 0000000..57625a5 --- /dev/null +++ b/vendor/symfony/yaml/Yaml.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml; + +use Symfony\Component\Yaml\Exception\ParseException; + +/** + * Yaml offers convenience methods to load and dump YAML. + * + * @author Fabien Potencier + * + * @final + */ +class Yaml +{ + public const DUMP_OBJECT = 1; + public const PARSE_EXCEPTION_ON_INVALID_TYPE = 2; + public const PARSE_OBJECT = 4; + public const PARSE_OBJECT_FOR_MAP = 8; + public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16; + public const PARSE_DATETIME = 32; + public const DUMP_OBJECT_AS_MAP = 64; + public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128; + public const PARSE_CONSTANT = 256; + public const PARSE_CUSTOM_TAGS = 512; + public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024; + public const DUMP_NULL_AS_TILDE = 2048; + public const DUMP_NUMERIC_KEY_AS_STRING = 4096; + public const DUMP_NULL_AS_EMPTY = 8192; + public const DUMP_COMPACT_NESTED_MAPPING = 16384; + public const DUMP_FORCE_DOUBLE_QUOTES_ON_VALUES = 32768; + + /** + * Parses a YAML file into a PHP value. + * + * Usage: + * + * $array = Yaml::parseFile('config.yml'); + * print_r($array); + * + * @param string $filename The path to the YAML file to be parsed + * @param int-mask-of $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the file could not be read or the YAML is not valid + */ + public static function parseFile(string $filename, int $flags = 0): mixed + { + $yaml = new Parser(); + + return $yaml->parseFile($filename, $flags); + } + + /** + * Parses YAML into a PHP value. + * + * Usage: + * + * $array = Yaml::parse(file_get_contents('config.yml')); + * print_r($array); + * + * + * @param string $input A string containing YAML + * @param int-mask-of $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the YAML is not valid + */ + public static function parse(string $input, int $flags = 0): mixed + { + $yaml = new Parser(); + + return $yaml->parse($input, $flags); + } + + /** + * Dumps a PHP value to a YAML string. + * + * The dump method, when supplied with an array, will do its best + * to convert the array into friendly YAML. + * + * @param mixed $input The PHP value + * @param int $inline The level where you switch to inline YAML + * @param int $indent The amount of spaces to use for indentation of nested nodes + * @param int-mask-of $flags A bit field of DUMP_* constants to customize the dumped YAML string + */ + public static function dump(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string + { + $yaml = new Dumper($indent); + + return $yaml->dump($input, $inline, 0, $flags); + } +} diff --git a/vendor/symfony/yaml/composer.json b/vendor/symfony/yaml/composer.json new file mode 100644 index 0000000..ba231b2 --- /dev/null +++ b/vendor/symfony/yaml/composer.json @@ -0,0 +1,38 @@ +{ + "name": "symfony/yaml", + "type": "library", + "description": "Loads and dumps YAML files", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.4", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0" + }, + "conflict": { + "symfony/console": "<7.4" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "minimum-stability": "dev" +}