From 2d32a568dcb81c92a5db03f903a0991608bb19ed Mon Sep 17 00:00:00 2001 From: saimedhi Date: Wed, 22 May 2024 10:43:41 -0700 Subject: [PATCH] Generating Endpoints from OpenSearch API Specification Signed-off-by: saimedhi --- composer.json | 2 +- src/OpenSearch/Endpoints/Bulk.php | 7 +- src/OpenSearch/Endpoints/Cat/Aliases.php | 7 +- src/OpenSearch/Endpoints/Cat/Allocation.php | 7 +- .../Endpoints/Cat/ClusterManager.php | 13 +- src/OpenSearch/Endpoints/Cat/Count.php | 7 +- src/OpenSearch/Endpoints/Cat/Fielddata.php | 7 +- src/OpenSearch/Endpoints/Cat/Health.php | 7 +- src/OpenSearch/Endpoints/Cat/Help.php | 7 +- src/OpenSearch/Endpoints/Cat/Indices.php | 8 +- src/OpenSearch/Endpoints/Cat/NodeAttrs.php | 8 +- src/OpenSearch/Endpoints/Cat/Nodes.php | 8 +- src/OpenSearch/Endpoints/Cat/PendingTasks.php | 8 +- src/OpenSearch/Endpoints/Cat/Plugins.php | 8 +- src/OpenSearch/Endpoints/Cat/Recovery.php | 7 +- src/OpenSearch/Endpoints/Cat/Repositories.php | 8 +- src/OpenSearch/Endpoints/Cat/Segments.php | 14 +- src/OpenSearch/Endpoints/Cat/Shards.php | 8 +- src/OpenSearch/Endpoints/Cat/Snapshots.php | 8 +- src/OpenSearch/Endpoints/Cat/Templates.php | 8 +- src/OpenSearch/Endpoints/Cat/ThreadPool.php | 8 +- .../Endpoints/Cluster/AllocationExplain.php | 7 +- .../Cluster/DeleteComponentTemplate.php | 8 +- .../Cluster/DeleteVotingConfigExclusions.php | 7 +- .../Cluster/ExistsComponentTemplate.php | 8 +- .../Endpoints/Cluster/GetSettings.php | 8 +- src/OpenSearch/Endpoints/Cluster/Health.php | 9 +- .../Endpoints/Cluster/PendingTasks.php | 8 +- .../Cluster/PostVotingConfigExclusions.php | 7 +- .../Cluster/PutComponentTemplate.php | 8 +- .../Endpoints/Cluster/PutSettings.php | 8 +- .../Endpoints/Cluster/RemoteInfo.php | 6 +- src/OpenSearch/Endpoints/Cluster/Reroute.php | 8 +- src/OpenSearch/Endpoints/Cluster/State.php | 8 +- src/OpenSearch/Endpoints/Cluster/Stats.php | 7 +- src/OpenSearch/Endpoints/Count.php | 8 +- src/OpenSearch/Endpoints/Delete.php | 8 +- src/OpenSearch/Endpoints/DeleteByQuery.php | 8 +- .../Endpoints/DeleteByQueryRethrottle.php | 7 +- src/OpenSearch/Endpoints/DeleteScript.php | 8 +- src/OpenSearch/Endpoints/Exists.php | 8 +- src/OpenSearch/Endpoints/ExistsSource.php | 8 +- src/OpenSearch/Endpoints/Explain.php | 8 +- src/OpenSearch/Endpoints/FieldCaps.php | 7 +- src/OpenSearch/Endpoints/Get.php | 8 +- src/OpenSearch/Endpoints/GetScript.php | 9 +- src/OpenSearch/Endpoints/GetScriptContext.php | 6 +- .../Endpoints/GetScriptLanguages.php | 6 +- src/OpenSearch/Endpoints/GetSource.php | 8 +- src/OpenSearch/Endpoints/Index.php | 8 +- src/OpenSearch/Endpoints/Indices/AddBlock.php | 8 +- src/OpenSearch/Endpoints/Indices/Analyze.php | 7 +- .../Endpoints/Indices/ClearCache.php | 7 +- .../Endpoints/Indices/CloneIndices.php | 10 +- src/OpenSearch/Endpoints/Indices/Close.php | 8 +- src/OpenSearch/Endpoints/Indices/Create.php | 8 +- src/OpenSearch/Endpoints/Indices/Delete.php | 8 +- .../Endpoints/Indices/DeleteAlias.php | 8 +- .../Endpoints/Indices/DeleteDataStream.php | 6 +- .../Endpoints/Indices/DeleteIndexTemplate.php | 8 +- .../Endpoints/Indices/DeleteTemplate.php | 8 +- src/OpenSearch/Endpoints/Indices/Exists.php | 7 +- .../Endpoints/Indices/ExistsAlias.php | 7 +- .../Endpoints/Indices/ExistsIndexTemplate.php | 8 +- .../Endpoints/Indices/ExistsTemplate.php | 8 +- .../Endpoints/Indices/ForceMerge.php | 9 +- src/OpenSearch/Endpoints/Indices/Get.php | 8 +- src/OpenSearch/Endpoints/Indices/GetAlias.php | 7 +- .../Endpoints/Indices/GetDataStream.php | 6 +- .../Endpoints/Indices/GetFieldMapping.php | 8 +- .../Endpoints/Indices/GetMapping.php | 9 +- .../Endpoints/Indices/GetSettings.php | 10 +- .../Endpoints/Indices/GetTemplate.php | 8 +- .../Endpoints/Indices/GetUpgrade.php | 7 +- src/OpenSearch/Endpoints/Indices/Open.php | 10 +- src/OpenSearch/Endpoints/Indices/PutAlias.php | 8 +- .../Endpoints/Indices/PutIndexTemplate.php | 8 +- .../Endpoints/Indices/PutMapping.php | 9 +- .../Endpoints/Indices/PutSettings.php | 8 +- .../Endpoints/Indices/PutTemplate.php | 8 +- src/OpenSearch/Endpoints/Indices/Recovery.php | 7 +- .../Endpoints/Indices/ResolveIndex.php | 7 +- src/OpenSearch/Endpoints/Indices/Rollover.php | 8 +- src/OpenSearch/Endpoints/Indices/Segments.php | 7 +- .../Endpoints/Indices/ShardStores.php | 7 +- src/OpenSearch/Endpoints/Indices/Shrink.php | 10 +- .../Indices/SimulateIndexTemplate.php | 8 +- .../Endpoints/Indices/SimulateTemplate.php | 8 +- src/OpenSearch/Endpoints/Indices/Split.php | 10 +- .../Endpoints/Indices/UpdateAliases.php | 8 +- src/OpenSearch/Endpoints/Indices/Upgrade.php | 7 +- .../Endpoints/Indices/ValidateQuery.php | 8 +- src/OpenSearch/Endpoints/Info.php | 6 +- .../Endpoints/Ingest/DeletePipeline.php | 8 +- .../Endpoints/Ingest/GetPipeline.php | 9 +- .../Endpoints/Ingest/ProcessorGrok.php | 6 +- .../Endpoints/Ingest/PutPipeline.php | 8 +- src/OpenSearch/Endpoints/Ingest/Simulate.php | 7 +- src/OpenSearch/Endpoints/MTermVectors.php | 8 +- src/OpenSearch/Endpoints/Mget.php | 8 +- src/OpenSearch/Endpoints/Msearch.php | 8 +- src/OpenSearch/Endpoints/MsearchTemplate.php | 8 +- src/OpenSearch/Endpoints/Nodes/Info.php | 31 +- .../Endpoints/Nodes/ReloadSecureSettings.php | 7 +- src/OpenSearch/Endpoints/Nodes/Stats.php | 7 +- src/OpenSearch/Endpoints/Nodes/Usage.php | 7 +- src/OpenSearch/Endpoints/Ping.php | 6 +- src/OpenSearch/Endpoints/RankEval.php | 7 +- src/OpenSearch/Endpoints/Reindex.php | 7 +- .../Endpoints/ReindexRethrottle.php | 7 +- .../Endpoints/RenderSearchTemplate.php | 8 +- .../Endpoints/ScriptsPainlessExecute.php | 6 +- src/OpenSearch/Endpoints/Scroll.php | 7 +- src/OpenSearch/Endpoints/Search.php | 10 +- src/OpenSearch/Endpoints/SearchShards.php | 7 +- src/OpenSearch/Endpoints/SearchTemplate.php | 8 +- .../Endpoints/Security/FlushCache.php | 14 +- .../Endpoints/Security/GetCertificates.php | 14 +- src/OpenSearch/Endpoints/Security/Health.php | 15 +- .../Endpoints/Snapshot/CleanupRepository.php | 8 +- .../Endpoints/Snapshot/CloneSnapshot.php | 9 +- src/OpenSearch/Endpoints/Snapshot/Create.php | 8 +- .../Endpoints/Snapshot/CreateRepository.php | 8 +- src/OpenSearch/Endpoints/Snapshot/Delete.php | 9 +- .../Endpoints/Snapshot/DeleteRepository.php | 8 +- src/OpenSearch/Endpoints/Snapshot/Get.php | 8 +- .../Endpoints/Snapshot/GetRepository.php | 8 +- src/OpenSearch/Endpoints/Snapshot/Restore.php | 8 +- src/OpenSearch/Endpoints/Snapshot/Status.php | 8 +- .../Endpoints/Snapshot/VerifyRepository.php | 8 +- src/OpenSearch/Endpoints/Tasks/Cancel.php | 7 +- src/OpenSearch/Endpoints/Tasks/Get.php | 7 +- src/OpenSearch/Endpoints/Tasks/ListTasks.php | 7 +- src/OpenSearch/Endpoints/TermVectors.php | 8 +- src/OpenSearch/Endpoints/Update.php | 8 +- .../Endpoints/UpdateByQueryRethrottle.php | 7 +- util/ClientEndpoint.php | 8 +- util/Endpoint.php | 60 +- util/GenerateEndpoints.php | 722 +++++++++++------- util/NamespaceEndpoint.php | 33 +- util/RestSpecRunner.php | 11 +- util/license_header.php | 62 ++ util/template/client-class | 26 +- util/template/deprecated-param-master-timeout | 4 + util/template/endpoint-bulk-class | 2 +- util/template/endpoint-class | 10 +- util/template/namespace-class | 5 +- util/template/test/unit-test-oss | 2 +- util/template/test/unit-test-skipped | 2 +- 149 files changed, 1549 insertions(+), 497 deletions(-) create mode 100644 util/license_header.php create mode 100644 util/template/deprecated-param-master-timeout diff --git a/composer.json b/composer.json index 1b0d622e1..b1b7a2bf7 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "ext-json": ">=1.3.7", "ezimuel/ringphp": "^1.1.2", "psr/log": "^1|^2|^3", - "symfony/yaml": "^7.0" + "symfony/yaml": "*" }, "require-dev": { "ext-zip": "*", diff --git a/src/OpenSearch/Endpoints/Bulk.php b/src/OpenSearch/Endpoints/Bulk.php index 39fcffbc5..4a4bd0dac 100644 --- a/src/OpenSearch/Endpoints/Bulk.php +++ b/src/OpenSearch/Endpoints/Bulk.php @@ -54,7 +54,12 @@ public function getParamWhitelist(): array '_source_excludes', '_source_includes', 'pipeline', - 'require_alias' + 'require_alias', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Aliases.php b/src/OpenSearch/Endpoints/Cat/Aliases.php index 341c2d8d6..e4fc96319 100644 --- a/src/OpenSearch/Endpoints/Cat/Aliases.php +++ b/src/OpenSearch/Endpoints/Cat/Aliases.php @@ -46,7 +46,12 @@ public function getParamWhitelist(): array 'help', 's', 'v', - 'expand_wildcards' + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Allocation.php b/src/OpenSearch/Endpoints/Cat/Allocation.php index 516beea80..f09bf4d38 100644 --- a/src/OpenSearch/Endpoints/Cat/Allocation.php +++ b/src/OpenSearch/Endpoints/Cat/Allocation.php @@ -44,11 +44,16 @@ public function getParamWhitelist(): array 'bytes', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/ClusterManager.php b/src/OpenSearch/Endpoints/Cat/ClusterManager.php index bd6296a14..d07e81074 100644 --- a/src/OpenSearch/Endpoints/Cat/ClusterManager.php +++ b/src/OpenSearch/Endpoints/Cat/ClusterManager.php @@ -35,11 +35,17 @@ public function getParamWhitelist(): array return [ 'format', 'local', + 'master_timeout', 'cluster_manager_timeout', 'h', 'help', 's', - 'v' + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -47,4 +53,9 @@ public function getMethod(): string { return 'GET'; } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } } diff --git a/src/OpenSearch/Endpoints/Cat/Count.php b/src/OpenSearch/Endpoints/Cat/Count.php index d96e2f9ab..f8653ff4c 100644 --- a/src/OpenSearch/Endpoints/Cat/Count.php +++ b/src/OpenSearch/Endpoints/Cat/Count.php @@ -42,7 +42,12 @@ public function getParamWhitelist(): array 'h', 'help', 's', - 'v' + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Fielddata.php b/src/OpenSearch/Endpoints/Cat/Fielddata.php index 7fb872b47..b7a632398 100644 --- a/src/OpenSearch/Endpoints/Cat/Fielddata.php +++ b/src/OpenSearch/Endpoints/Cat/Fielddata.php @@ -46,7 +46,12 @@ public function getParamWhitelist(): array 'help', 's', 'v', - 'fields' + 'fields', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Health.php b/src/OpenSearch/Endpoints/Cat/Health.php index 06b4f5e56..7aa72203b 100644 --- a/src/OpenSearch/Endpoints/Cat/Health.php +++ b/src/OpenSearch/Endpoints/Cat/Health.php @@ -39,7 +39,12 @@ public function getParamWhitelist(): array 's', 'time', 'ts', - 'v' + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Help.php b/src/OpenSearch/Endpoints/Cat/Help.php index 6e1bb8317..b5c737914 100644 --- a/src/OpenSearch/Endpoints/Cat/Help.php +++ b/src/OpenSearch/Endpoints/Cat/Help.php @@ -34,7 +34,12 @@ public function getParamWhitelist(): array { return [ 'help', - 's' + 's', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Indices.php b/src/OpenSearch/Endpoints/Cat/Indices.php index 57596b225..3fcca0ddb 100644 --- a/src/OpenSearch/Endpoints/Cat/Indices.php +++ b/src/OpenSearch/Endpoints/Cat/Indices.php @@ -42,6 +42,7 @@ public function getParamWhitelist(): array 'bytes', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'health', 'help', @@ -51,7 +52,11 @@ public function getParamWhitelist(): array 'v', 'include_unloaded_segments', 'expand_wildcards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -59,6 +64,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/NodeAttrs.php b/src/OpenSearch/Endpoints/Cat/NodeAttrs.php index 7071053e6..925959cea 100644 --- a/src/OpenSearch/Endpoints/Cat/NodeAttrs.php +++ b/src/OpenSearch/Endpoints/Cat/NodeAttrs.php @@ -36,11 +36,16 @@ public function getParamWhitelist(): array 'format', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -48,6 +53,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Nodes.php b/src/OpenSearch/Endpoints/Cat/Nodes.php index a8dbd9b49..4e61efa9f 100644 --- a/src/OpenSearch/Endpoints/Cat/Nodes.php +++ b/src/OpenSearch/Endpoints/Cat/Nodes.php @@ -38,12 +38,17 @@ public function getParamWhitelist(): array 'full_id', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'time', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -51,6 +56,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/PendingTasks.php b/src/OpenSearch/Endpoints/Cat/PendingTasks.php index d262c32ec..d329ecfc7 100644 --- a/src/OpenSearch/Endpoints/Cat/PendingTasks.php +++ b/src/OpenSearch/Endpoints/Cat/PendingTasks.php @@ -36,12 +36,17 @@ public function getParamWhitelist(): array 'format', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'time', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -49,6 +54,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Plugins.php b/src/OpenSearch/Endpoints/Cat/Plugins.php index 8ecfd8a43..f414ad6b4 100644 --- a/src/OpenSearch/Endpoints/Cat/Plugins.php +++ b/src/OpenSearch/Endpoints/Cat/Plugins.php @@ -36,11 +36,16 @@ public function getParamWhitelist(): array 'format', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -48,6 +53,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Recovery.php b/src/OpenSearch/Endpoints/Cat/Recovery.php index 0ba38fef1..0938f6ece 100644 --- a/src/OpenSearch/Endpoints/Cat/Recovery.php +++ b/src/OpenSearch/Endpoints/Cat/Recovery.php @@ -47,7 +47,12 @@ public function getParamWhitelist(): array 'index', 's', 'time', - 'v' + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cat/Repositories.php b/src/OpenSearch/Endpoints/Cat/Repositories.php index 97fd9fa69..eda1e31f6 100644 --- a/src/OpenSearch/Endpoints/Cat/Repositories.php +++ b/src/OpenSearch/Endpoints/Cat/Repositories.php @@ -36,11 +36,16 @@ public function getParamWhitelist(): array 'format', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -48,6 +53,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Segments.php b/src/OpenSearch/Endpoints/Cat/Segments.php index 749318379..8002a11e4 100644 --- a/src/OpenSearch/Endpoints/Cat/Segments.php +++ b/src/OpenSearch/Endpoints/Cat/Segments.php @@ -40,10 +40,17 @@ public function getParamWhitelist(): array return [ 'format', 'bytes', + 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', - 'v' + 'v', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -51,4 +58,9 @@ public function getMethod(): string { return 'GET'; } + + protected function getParamDeprecation(): array + { + return ['master_timeout' => 'cluster_manager_timeout']; + } } diff --git a/src/OpenSearch/Endpoints/Cat/Shards.php b/src/OpenSearch/Endpoints/Cat/Shards.php index ab62bb8e2..b0af61d7b 100644 --- a/src/OpenSearch/Endpoints/Cat/Shards.php +++ b/src/OpenSearch/Endpoints/Cat/Shards.php @@ -42,12 +42,17 @@ public function getParamWhitelist(): array 'bytes', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'time', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -55,6 +60,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Snapshots.php b/src/OpenSearch/Endpoints/Cat/Snapshots.php index 5a94895d3..222e8f2a4 100644 --- a/src/OpenSearch/Endpoints/Cat/Snapshots.php +++ b/src/OpenSearch/Endpoints/Cat/Snapshots.php @@ -43,12 +43,17 @@ public function getParamWhitelist(): array 'format', 'ignore_unavailable', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'time', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -69,6 +74,7 @@ public function setRepository($repository): Snapshots return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/Templates.php b/src/OpenSearch/Endpoints/Cat/Templates.php index 7fc078af5..568eb1374 100644 --- a/src/OpenSearch/Endpoints/Cat/Templates.php +++ b/src/OpenSearch/Endpoints/Cat/Templates.php @@ -43,11 +43,16 @@ public function getParamWhitelist(): array 'format', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -65,6 +70,7 @@ public function setName($name): Templates return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cat/ThreadPool.php b/src/OpenSearch/Endpoints/Cat/ThreadPool.php index 0fb196513..75657cf55 100644 --- a/src/OpenSearch/Endpoints/Cat/ThreadPool.php +++ b/src/OpenSearch/Endpoints/Cat/ThreadPool.php @@ -44,11 +44,16 @@ public function getParamWhitelist(): array 'size', 'local', 'master_timeout', + 'cluster_manager_timeout', 'h', 'help', 's', 'v', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -69,6 +74,7 @@ public function setThreadPoolPatterns($thread_pool_patterns): ThreadPool return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php b/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php index c299f7626..0df407b34 100644 --- a/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php +++ b/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php @@ -34,7 +34,12 @@ public function getParamWhitelist(): array { return [ 'include_yes_decisions', - 'include_disk_info' + 'include_disk_info', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php b/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php index 6d85f9597..2f37a5eb2 100644 --- a/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php +++ b/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setName($name): DeleteComponentTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php b/src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php index ad2960734..1a0b4eaa1 100644 --- a/src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php +++ b/src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php @@ -33,7 +33,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'wait_for_removal' + 'wait_for_removal', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php b/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php index 35aa6649f..6c76e0942 100644 --- a/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php +++ b/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php @@ -42,8 +42,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setName($name): ExistsComponentTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/GetSettings.php b/src/OpenSearch/Endpoints/Cluster/GetSettings.php index ca63e8ac8..2c7c9ded3 100644 --- a/src/OpenSearch/Endpoints/Cluster/GetSettings.php +++ b/src/OpenSearch/Endpoints/Cluster/GetSettings.php @@ -35,9 +35,14 @@ public function getParamWhitelist(): array return [ 'flat_settings', 'master_timeout', + 'cluster_manager_timeout', 'timeout', 'include_defaults', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -45,6 +50,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/Health.php b/src/OpenSearch/Endpoints/Cluster/Health.php index 89ee9fd8d..69f285e02 100644 --- a/src/OpenSearch/Endpoints/Cluster/Health.php +++ b/src/OpenSearch/Endpoints/Cluster/Health.php @@ -42,6 +42,7 @@ public function getParamWhitelist(): array 'level', 'local', 'master_timeout', + 'cluster_manager_timeout', 'timeout', 'wait_for_active_shards', 'wait_for_nodes', @@ -49,7 +50,12 @@ public function getParamWhitelist(): array 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', - 'cluster_manager_timeout' + 'awareness_attribute', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -57,6 +63,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/PendingTasks.php b/src/OpenSearch/Endpoints/Cluster/PendingTasks.php index 35e2e1162..f90507198 100644 --- a/src/OpenSearch/Endpoints/Cluster/PendingTasks.php +++ b/src/OpenSearch/Endpoints/Cluster/PendingTasks.php @@ -35,7 +35,12 @@ public function getParamWhitelist(): array return [ 'local', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -43,6 +48,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php b/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php index 1eba4850e..67d1c1701 100644 --- a/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php +++ b/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php @@ -35,7 +35,12 @@ public function getParamWhitelist(): array return [ 'node_ids', 'node_names', - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php b/src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php index a7729a51e..98c668da6 100644 --- a/src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php +++ b/src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php @@ -44,7 +44,12 @@ public function getParamWhitelist(): array 'create', 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setName($name): PutComponentTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/PutSettings.php b/src/OpenSearch/Endpoints/Cluster/PutSettings.php index 4b5659b6a..b17a1cdb2 100644 --- a/src/OpenSearch/Endpoints/Cluster/PutSettings.php +++ b/src/OpenSearch/Endpoints/Cluster/PutSettings.php @@ -35,8 +35,13 @@ public function getParamWhitelist(): array return [ 'flat_settings', 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -54,6 +59,7 @@ public function setBody($body): PutSettings return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php b/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php index 8840aab00..a1989dccd 100644 --- a/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php +++ b/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Cluster/Reroute.php b/src/OpenSearch/Endpoints/Cluster/Reroute.php index f68e4b0e3..b50da4a2b 100644 --- a/src/OpenSearch/Endpoints/Cluster/Reroute.php +++ b/src/OpenSearch/Endpoints/Cluster/Reroute.php @@ -38,8 +38,13 @@ public function getParamWhitelist(): array 'retry_failed', 'metric', 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -57,6 +62,7 @@ public function setBody($body): Reroute return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/State.php b/src/OpenSearch/Endpoints/Cluster/State.php index 173e769b7..eb44e9508 100644 --- a/src/OpenSearch/Endpoints/Cluster/State.php +++ b/src/OpenSearch/Endpoints/Cluster/State.php @@ -46,13 +46,18 @@ public function getParamWhitelist(): array return [ 'local', 'master_timeout', + 'cluster_manager_timeout', 'flat_settings', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -73,6 +78,7 @@ public function setMetric($metric): State return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Cluster/Stats.php b/src/OpenSearch/Endpoints/Cluster/Stats.php index a90a53c76..d1897beca 100644 --- a/src/OpenSearch/Endpoints/Cluster/Stats.php +++ b/src/OpenSearch/Endpoints/Cluster/Stats.php @@ -41,7 +41,12 @@ public function getParamWhitelist(): array { return [ 'flat_settings', - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Count.php b/src/OpenSearch/Endpoints/Count.php index 376719561..f58650d0f 100644 --- a/src/OpenSearch/Endpoints/Count.php +++ b/src/OpenSearch/Endpoints/Count.php @@ -28,6 +28,7 @@ class Count extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_count"; } @@ -50,7 +51,12 @@ public function getParamWhitelist(): array 'default_operator', 'df', 'lenient', - 'terminate_after' + 'terminate_after', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Delete.php b/src/OpenSearch/Endpoints/Delete.php index a695d5f33..583a48752 100644 --- a/src/OpenSearch/Endpoints/Delete.php +++ b/src/OpenSearch/Endpoints/Delete.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_doc/$id"; } @@ -53,7 +54,12 @@ public function getParamWhitelist(): array 'if_seq_no', 'if_primary_term', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/DeleteByQuery.php b/src/OpenSearch/Endpoints/DeleteByQuery.php index bb07d0798..25fba6eb2 100644 --- a/src/OpenSearch/Endpoints/DeleteByQuery.php +++ b/src/OpenSearch/Endpoints/DeleteByQuery.php @@ -34,6 +34,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_delete_by_query"; } @@ -72,7 +73,12 @@ public function getParamWhitelist(): array 'scroll_size', 'wait_for_completion', 'requests_per_second', - 'slices' + 'slices', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php b/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php index c55c7b1bf..57d2789ef 100644 --- a/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php +++ b/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php @@ -41,7 +41,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'requests_per_second' + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/DeleteScript.php b/src/OpenSearch/Endpoints/DeleteScript.php index b2e1dbfb0..4aaf6a302 100644 --- a/src/OpenSearch/Endpoints/DeleteScript.php +++ b/src/OpenSearch/Endpoints/DeleteScript.php @@ -41,7 +41,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -49,6 +54,7 @@ public function getMethod(): string { return 'DELETE'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Exists.php b/src/OpenSearch/Endpoints/Exists.php index d2cdbc089..ddc196bfd 100644 --- a/src/OpenSearch/Endpoints/Exists.php +++ b/src/OpenSearch/Endpoints/Exists.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_doc/$id"; } @@ -55,7 +56,12 @@ public function getParamWhitelist(): array '_source_excludes', '_source_includes', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/ExistsSource.php b/src/OpenSearch/Endpoints/ExistsSource.php index 1c53e81e9..58195b622 100644 --- a/src/OpenSearch/Endpoints/ExistsSource.php +++ b/src/OpenSearch/Endpoints/ExistsSource.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_source/$id"; } @@ -54,7 +55,12 @@ public function getParamWhitelist(): array '_source_excludes', '_source_includes', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Explain.php b/src/OpenSearch/Endpoints/Explain.php index b136270d0..ad5eaa2f8 100644 --- a/src/OpenSearch/Endpoints/Explain.php +++ b/src/OpenSearch/Endpoints/Explain.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_explain/$id"; } @@ -57,7 +58,12 @@ public function getParamWhitelist(): array 'routing', '_source', '_source_excludes', - '_source_includes' + '_source_includes', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/FieldCaps.php b/src/OpenSearch/Endpoints/FieldCaps.php index 9f003c8d1..85d59429f 100644 --- a/src/OpenSearch/Endpoints/FieldCaps.php +++ b/src/OpenSearch/Endpoints/FieldCaps.php @@ -42,7 +42,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'include_unmapped' + 'include_unmapped', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Get.php b/src/OpenSearch/Endpoints/Get.php index dd916feec..dde04b172 100644 --- a/src/OpenSearch/Endpoints/Get.php +++ b/src/OpenSearch/Endpoints/Get.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_doc/$id"; } @@ -55,7 +56,12 @@ public function getParamWhitelist(): array '_source_excludes', '_source_includes', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/GetScript.php b/src/OpenSearch/Endpoints/GetScript.php index d95fcfc15..d933c05b2 100644 --- a/src/OpenSearch/Endpoints/GetScript.php +++ b/src/OpenSearch/Endpoints/GetScript.php @@ -39,7 +39,13 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'master_timeout', 'cluster_manager_timeout' + 'master_timeout', + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -47,6 +53,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/GetScriptContext.php b/src/OpenSearch/Endpoints/GetScriptContext.php index a183674bd..fe906209f 100644 --- a/src/OpenSearch/Endpoints/GetScriptContext.php +++ b/src/OpenSearch/Endpoints/GetScriptContext.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/GetScriptLanguages.php b/src/OpenSearch/Endpoints/GetScriptLanguages.php index d71c76d07..fb1d92b2f 100644 --- a/src/OpenSearch/Endpoints/GetScriptLanguages.php +++ b/src/OpenSearch/Endpoints/GetScriptLanguages.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/GetSource.php b/src/OpenSearch/Endpoints/GetSource.php index a244c4daf..743583421 100644 --- a/src/OpenSearch/Endpoints/GetSource.php +++ b/src/OpenSearch/Endpoints/GetSource.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_source/$id"; } @@ -54,7 +55,12 @@ public function getParamWhitelist(): array '_source_excludes', '_source_includes', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Index.php b/src/OpenSearch/Endpoints/Index.php index ef64e1d82..d89c9bbd9 100644 --- a/src/OpenSearch/Endpoints/Index.php +++ b/src/OpenSearch/Endpoints/Index.php @@ -35,6 +35,7 @@ public function getURI(): string } $index = $this->index; $id = $this->id ?? null; + if (isset($id)) { return "/$index/_doc/$id"; } @@ -54,7 +55,12 @@ public function getParamWhitelist(): array 'if_seq_no', 'if_primary_term', 'pipeline', - 'require_alias' + 'require_alias', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/AddBlock.php b/src/OpenSearch/Endpoints/Indices/AddBlock.php index 9936bd0f5..0b570f5d8 100644 --- a/src/OpenSearch/Endpoints/Indices/AddBlock.php +++ b/src/OpenSearch/Endpoints/Indices/AddBlock.php @@ -44,10 +44,15 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -65,6 +70,7 @@ public function setBlock($block): AddBlock return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Analyze.php b/src/OpenSearch/Endpoints/Indices/Analyze.php index 087c96cb6..43a58116c 100644 --- a/src/OpenSearch/Endpoints/Indices/Analyze.php +++ b/src/OpenSearch/Endpoints/Indices/Analyze.php @@ -38,7 +38,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'index' + 'index', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ClearCache.php b/src/OpenSearch/Endpoints/Indices/ClearCache.php index 39ae3f84f..106415119 100644 --- a/src/OpenSearch/Endpoints/Indices/ClearCache.php +++ b/src/OpenSearch/Endpoints/Indices/ClearCache.php @@ -45,7 +45,12 @@ public function getParamWhitelist(): array 'allow_no_indices', 'expand_wildcards', 'index', - 'request' + 'request', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/CloneIndices.php b/src/OpenSearch/Endpoints/Indices/CloneIndices.php index 8b05dee6b..a53d29ea1 100644 --- a/src/OpenSearch/Endpoints/Indices/CloneIndices.php +++ b/src/OpenSearch/Endpoints/Indices/CloneIndices.php @@ -44,8 +44,15 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'wait_for_completion', + 'task_execution_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -73,6 +80,7 @@ public function setTarget($target): CloneIndices return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Close.php b/src/OpenSearch/Endpoints/Indices/Close.php index 664b2b572..59fc59c23 100644 --- a/src/OpenSearch/Endpoints/Indices/Close.php +++ b/src/OpenSearch/Endpoints/Indices/Close.php @@ -41,11 +41,16 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -53,6 +58,7 @@ public function getMethod(): string { return 'POST'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Create.php b/src/OpenSearch/Endpoints/Indices/Create.php index 22a43c6ad..dd754526f 100644 --- a/src/OpenSearch/Endpoints/Indices/Create.php +++ b/src/OpenSearch/Endpoints/Indices/Create.php @@ -42,7 +42,12 @@ public function getParamWhitelist(): array 'wait_for_active_shards', 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -60,6 +65,7 @@ public function setBody($body): Create return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Delete.php b/src/OpenSearch/Endpoints/Indices/Delete.php index b3aa6fe3d..0198385f2 100644 --- a/src/OpenSearch/Endpoints/Indices/Delete.php +++ b/src/OpenSearch/Endpoints/Indices/Delete.php @@ -43,8 +43,13 @@ public function getParamWhitelist(): array 'master_timeout', 'ignore_unavailable', 'allow_no_indices', + 'cluster_manager_timeout', 'expand_wildcards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -52,6 +57,7 @@ public function getMethod(): string { return 'DELETE'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/DeleteAlias.php b/src/OpenSearch/Endpoints/Indices/DeleteAlias.php index 0ec2ee23c..b45e46c0c 100644 --- a/src/OpenSearch/Endpoints/Indices/DeleteAlias.php +++ b/src/OpenSearch/Endpoints/Indices/DeleteAlias.php @@ -51,7 +51,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setName($name): DeleteAlias return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php b/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php index 969124743..3e6732441 100644 --- a/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php +++ b/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php @@ -41,7 +41,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php b/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php index 68d8ed555..0b4bb47c4 100644 --- a/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setName($name): DeleteIndexTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php b/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php index 5a5d5b25a..902fd16c9 100644 --- a/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setName($name): DeleteTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Exists.php b/src/OpenSearch/Endpoints/Indices/Exists.php index 104c179e5..9459b9e70 100644 --- a/src/OpenSearch/Endpoints/Indices/Exists.php +++ b/src/OpenSearch/Endpoints/Indices/Exists.php @@ -44,7 +44,12 @@ public function getParamWhitelist(): array 'allow_no_indices', 'expand_wildcards', 'flat_settings', - 'include_defaults' + 'include_defaults', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ExistsAlias.php b/src/OpenSearch/Endpoints/Indices/ExistsAlias.php index dc6abd993..e9cc38715 100644 --- a/src/OpenSearch/Endpoints/Indices/ExistsAlias.php +++ b/src/OpenSearch/Endpoints/Indices/ExistsAlias.php @@ -50,7 +50,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'local' + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php b/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php index a87f1d791..9f9b83b02 100644 --- a/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php @@ -43,8 +43,13 @@ public function getParamWhitelist(): array return [ 'flat_settings', 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -62,6 +67,7 @@ public function setName($name): ExistsIndexTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php b/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php index 22c0a6a4a..0e6c5c258 100644 --- a/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php @@ -43,8 +43,13 @@ public function getParamWhitelist(): array return [ 'flat_settings', 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -65,6 +70,7 @@ public function setName($name): ExistsTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/ForceMerge.php b/src/OpenSearch/Endpoints/Indices/ForceMerge.php index dced08d15..a8b758fd5 100644 --- a/src/OpenSearch/Endpoints/Indices/ForceMerge.php +++ b/src/OpenSearch/Endpoints/Indices/ForceMerge.php @@ -39,11 +39,18 @@ public function getParamWhitelist(): array { return [ 'flush', + 'primary_only', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'max_num_segments', - 'only_expunge_deletes' + 'only_expunge_deletes', + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/Get.php b/src/OpenSearch/Endpoints/Indices/Get.php index 2ab5db640..77cbd10d4 100644 --- a/src/OpenSearch/Endpoints/Indices/Get.php +++ b/src/OpenSearch/Endpoints/Indices/Get.php @@ -46,7 +46,12 @@ public function getParamWhitelist(): array 'flat_settings', 'include_defaults', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -54,6 +59,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/GetAlias.php b/src/OpenSearch/Endpoints/Indices/GetAlias.php index c6c391f6a..e8384e78e 100644 --- a/src/OpenSearch/Endpoints/Indices/GetAlias.php +++ b/src/OpenSearch/Endpoints/Indices/GetAlias.php @@ -50,7 +50,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'local' + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/GetDataStream.php b/src/OpenSearch/Endpoints/Indices/GetDataStream.php index c2baa1c26..b873748e8 100644 --- a/src/OpenSearch/Endpoints/Indices/GetDataStream.php +++ b/src/OpenSearch/Endpoints/Indices/GetDataStream.php @@ -40,7 +40,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php b/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php index 713bfcbde..bc790078d 100644 --- a/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php +++ b/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php @@ -37,6 +37,7 @@ public function getURI(): string } $fields = $this->fields; $index = $this->index ?? null; + if (isset($index)) { return "/$index/_mapping/field/$fields"; } @@ -50,7 +51,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'local' + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/GetMapping.php b/src/OpenSearch/Endpoints/Indices/GetMapping.php index 9054b28a8..d8ddc0069 100644 --- a/src/OpenSearch/Endpoints/Indices/GetMapping.php +++ b/src/OpenSearch/Endpoints/Indices/GetMapping.php @@ -28,6 +28,7 @@ class GetMapping extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_mapping"; } @@ -41,8 +42,13 @@ public function getParamWhitelist(): array 'allow_no_indices', 'expand_wildcards', 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -50,6 +56,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/GetSettings.php b/src/OpenSearch/Endpoints/Indices/GetSettings.php index f4d4f6134..f9a953a36 100644 --- a/src/OpenSearch/Endpoints/Indices/GetSettings.php +++ b/src/OpenSearch/Endpoints/Indices/GetSettings.php @@ -29,8 +29,8 @@ class GetSettings extends AbstractEndpoint public function getURI(): string { - $index = $this->index ?? null; $name = $this->name ?? null; + $index = $this->index ?? null; if (isset($index) && isset($name)) { return "/$index/_settings/$name"; @@ -48,13 +48,18 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'local', 'include_defaults', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -75,6 +80,7 @@ public function setName($name): GetSettings return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/GetTemplate.php b/src/OpenSearch/Endpoints/Indices/GetTemplate.php index 5e8f5309e..caceb77f2 100644 --- a/src/OpenSearch/Endpoints/Indices/GetTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/GetTemplate.php @@ -42,8 +42,13 @@ public function getParamWhitelist(): array return [ 'flat_settings', 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -64,6 +69,7 @@ public function setName($name): GetTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/GetUpgrade.php b/src/OpenSearch/Endpoints/Indices/GetUpgrade.php index 5b3d2cef9..ee59027d6 100644 --- a/src/OpenSearch/Endpoints/Indices/GetUpgrade.php +++ b/src/OpenSearch/Endpoints/Indices/GetUpgrade.php @@ -40,7 +40,12 @@ public function getParamWhitelist(): array return [ 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/Open.php b/src/OpenSearch/Endpoints/Indices/Open.php index 4c7ecbf17..ff7850e81 100644 --- a/src/OpenSearch/Endpoints/Indices/Open.php +++ b/src/OpenSearch/Endpoints/Indices/Open.php @@ -44,8 +44,15 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'cluster_manager_timeout', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'wait_for_completion', + 'task_execution_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -53,6 +60,7 @@ public function getMethod(): string { return 'POST'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/PutAlias.php b/src/OpenSearch/Endpoints/Indices/PutAlias.php index 6e98bbe5c..142b27aac 100644 --- a/src/OpenSearch/Endpoints/Indices/PutAlias.php +++ b/src/OpenSearch/Endpoints/Indices/PutAlias.php @@ -51,7 +51,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -79,6 +84,7 @@ public function setName($name): PutAlias return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php b/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php index e9f796cc6..9940e26e5 100644 --- a/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php @@ -44,7 +44,12 @@ public function getParamWhitelist(): array 'create', 'cause', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setName($name): PutIndexTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/PutMapping.php b/src/OpenSearch/Endpoints/Indices/PutMapping.php index e21973924..25d36f14a 100644 --- a/src/OpenSearch/Endpoints/Indices/PutMapping.php +++ b/src/OpenSearch/Endpoints/Indices/PutMapping.php @@ -29,6 +29,7 @@ class PutMapping extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_mapping"; } @@ -40,11 +41,16 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'write_index_only', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -62,6 +68,7 @@ public function setBody($body): PutMapping return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/PutSettings.php b/src/OpenSearch/Endpoints/Indices/PutSettings.php index 0e031e7f2..270c04c3f 100644 --- a/src/OpenSearch/Endpoints/Indices/PutSettings.php +++ b/src/OpenSearch/Endpoints/Indices/PutSettings.php @@ -39,13 +39,18 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', 'preserve_existing', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -63,6 +68,7 @@ public function setBody($body): PutSettings return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/PutTemplate.php b/src/OpenSearch/Endpoints/Indices/PutTemplate.php index 6c1908e79..37c36f42e 100644 --- a/src/OpenSearch/Endpoints/Indices/PutTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/PutTemplate.php @@ -44,7 +44,12 @@ public function getParamWhitelist(): array 'order', 'create', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setName($name): PutTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Recovery.php b/src/OpenSearch/Endpoints/Indices/Recovery.php index 34002dda2..7438c51ef 100644 --- a/src/OpenSearch/Endpoints/Indices/Recovery.php +++ b/src/OpenSearch/Endpoints/Indices/Recovery.php @@ -39,7 +39,12 @@ public function getParamWhitelist(): array { return [ 'detailed', - 'active_only' + 'active_only', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ResolveIndex.php b/src/OpenSearch/Endpoints/Indices/ResolveIndex.php index bccc5e0d9..a2f25d0d5 100644 --- a/src/OpenSearch/Endpoints/Indices/ResolveIndex.php +++ b/src/OpenSearch/Endpoints/Indices/ResolveIndex.php @@ -41,7 +41,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'expand_wildcards' + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/Rollover.php b/src/OpenSearch/Endpoints/Indices/Rollover.php index c103c93f6..f41e7dcbb 100644 --- a/src/OpenSearch/Endpoints/Indices/Rollover.php +++ b/src/OpenSearch/Endpoints/Indices/Rollover.php @@ -51,8 +51,13 @@ public function getParamWhitelist(): array 'timeout', 'dry_run', 'master_timeout', + 'cluster_manager_timeout', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -90,6 +95,7 @@ public function setNewIndex($new_index): Rollover return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Segments.php b/src/OpenSearch/Endpoints/Indices/Segments.php index 464bc245a..436e098ee 100644 --- a/src/OpenSearch/Endpoints/Indices/Segments.php +++ b/src/OpenSearch/Endpoints/Indices/Segments.php @@ -41,7 +41,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'verbose' + 'verbose', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ShardStores.php b/src/OpenSearch/Endpoints/Indices/ShardStores.php index 484cd5d47..cbba217b2 100644 --- a/src/OpenSearch/Endpoints/Indices/ShardStores.php +++ b/src/OpenSearch/Endpoints/Indices/ShardStores.php @@ -41,7 +41,12 @@ public function getParamWhitelist(): array 'status', 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/Shrink.php b/src/OpenSearch/Endpoints/Indices/Shrink.php index 2b035ca8f..715684e6b 100644 --- a/src/OpenSearch/Endpoints/Indices/Shrink.php +++ b/src/OpenSearch/Endpoints/Indices/Shrink.php @@ -45,8 +45,15 @@ public function getParamWhitelist(): array 'copy_settings', 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'wait_for_completion', + 'task_execution_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -74,6 +81,7 @@ public function setTarget($target): Shrink return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php b/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php index 4c45eedd0..5ba49b96e 100644 --- a/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php @@ -44,7 +44,12 @@ public function getParamWhitelist(): array 'create', 'cause', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setName($name): SimulateIndexTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php b/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php index e13b10da8..a5722faca 100644 --- a/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php +++ b/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array 'create', 'cause', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -71,6 +76,7 @@ public function setName($name): SimulateTemplate return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Split.php b/src/OpenSearch/Endpoints/Indices/Split.php index 1d40adf42..205454519 100644 --- a/src/OpenSearch/Endpoints/Indices/Split.php +++ b/src/OpenSearch/Endpoints/Indices/Split.php @@ -45,8 +45,15 @@ public function getParamWhitelist(): array 'copy_settings', 'timeout', 'master_timeout', + 'cluster_manager_timeout', 'wait_for_active_shards', - 'cluster_manager_timeout' + 'wait_for_completion', + 'task_execution_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -74,6 +81,7 @@ public function setTarget($target): Split return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/UpdateAliases.php b/src/OpenSearch/Endpoints/Indices/UpdateAliases.php index 3a073ec41..8d1e9aea7 100644 --- a/src/OpenSearch/Endpoints/Indices/UpdateAliases.php +++ b/src/OpenSearch/Endpoints/Indices/UpdateAliases.php @@ -35,7 +35,12 @@ public function getParamWhitelist(): array return [ 'timeout', 'master_timeout', - 'cluster_manager_timeout' + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -53,6 +58,7 @@ public function setBody($body): UpdateAliases return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Indices/Upgrade.php b/src/OpenSearch/Endpoints/Indices/Upgrade.php index aaf85bbe7..97ae23dd3 100644 --- a/src/OpenSearch/Endpoints/Indices/Upgrade.php +++ b/src/OpenSearch/Endpoints/Indices/Upgrade.php @@ -42,7 +42,12 @@ public function getParamWhitelist(): array 'expand_wildcards', 'ignore_unavailable', 'wait_for_completion', - 'only_ancient_segments' + 'only_ancient_segments', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Indices/ValidateQuery.php b/src/OpenSearch/Endpoints/Indices/ValidateQuery.php index 1dc77b06f..cc4f808e9 100644 --- a/src/OpenSearch/Endpoints/Indices/ValidateQuery.php +++ b/src/OpenSearch/Endpoints/Indices/ValidateQuery.php @@ -28,6 +28,7 @@ class ValidateQuery extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_validate/query"; } @@ -48,7 +49,12 @@ public function getParamWhitelist(): array 'df', 'lenient', 'rewrite', - 'all_shards' + 'all_shards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Info.php b/src/OpenSearch/Endpoints/Info.php index fc3b8821f..feeee6f83 100644 --- a/src/OpenSearch/Endpoints/Info.php +++ b/src/OpenSearch/Endpoints/Info.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Ingest/DeletePipeline.php b/src/OpenSearch/Endpoints/Ingest/DeletePipeline.php index d065920b0..83ae614bb 100644 --- a/src/OpenSearch/Endpoints/Ingest/DeletePipeline.php +++ b/src/OpenSearch/Endpoints/Ingest/DeletePipeline.php @@ -40,8 +40,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -49,6 +54,7 @@ public function getMethod(): string { return 'DELETE'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Ingest/GetPipeline.php b/src/OpenSearch/Endpoints/Ingest/GetPipeline.php index 1bd0ad324..93d58aa68 100644 --- a/src/OpenSearch/Endpoints/Ingest/GetPipeline.php +++ b/src/OpenSearch/Endpoints/Ingest/GetPipeline.php @@ -38,7 +38,13 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'master_timeout', 'cluster_manager_timeout' + 'master_timeout', + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -46,6 +52,7 @@ public function getMethod(): string { return 'GET'; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php b/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php index e03f556b7..5c4e11a2b 100644 --- a/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php +++ b/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Ingest/PutPipeline.php b/src/OpenSearch/Endpoints/Ingest/PutPipeline.php index f6ab7890d..3ef567885 100644 --- a/src/OpenSearch/Endpoints/Ingest/PutPipeline.php +++ b/src/OpenSearch/Endpoints/Ingest/PutPipeline.php @@ -40,8 +40,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -59,6 +64,7 @@ public function setBody($body): PutPipeline return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Ingest/Simulate.php b/src/OpenSearch/Endpoints/Ingest/Simulate.php index 92bf7eed8..1900102c8 100644 --- a/src/OpenSearch/Endpoints/Ingest/Simulate.php +++ b/src/OpenSearch/Endpoints/Ingest/Simulate.php @@ -38,7 +38,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'verbose' + 'verbose', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/MTermVectors.php b/src/OpenSearch/Endpoints/MTermVectors.php index f1dd8b38f..f84797cec 100644 --- a/src/OpenSearch/Endpoints/MTermVectors.php +++ b/src/OpenSearch/Endpoints/MTermVectors.php @@ -28,6 +28,7 @@ class MTermVectors extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_mtermvectors"; } @@ -48,7 +49,12 @@ public function getParamWhitelist(): array 'routing', 'realtime', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Mget.php b/src/OpenSearch/Endpoints/Mget.php index 89f70eb94..addcfb7b9 100644 --- a/src/OpenSearch/Endpoints/Mget.php +++ b/src/OpenSearch/Endpoints/Mget.php @@ -28,6 +28,7 @@ class Mget extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_mget"; } @@ -44,7 +45,12 @@ public function getParamWhitelist(): array 'routing', '_source', '_source_excludes', - '_source_includes' + '_source_includes', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Msearch.php b/src/OpenSearch/Endpoints/Msearch.php index f304d28e1..fd08cc6f5 100644 --- a/src/OpenSearch/Endpoints/Msearch.php +++ b/src/OpenSearch/Endpoints/Msearch.php @@ -36,6 +36,7 @@ public function __construct(SerializerInterface $serializer) public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_msearch"; } @@ -51,7 +52,12 @@ public function getParamWhitelist(): array 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips' + 'ccs_minimize_roundtrips', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/MsearchTemplate.php b/src/OpenSearch/Endpoints/MsearchTemplate.php index 80e31377a..95dd11dcc 100644 --- a/src/OpenSearch/Endpoints/MsearchTemplate.php +++ b/src/OpenSearch/Endpoints/MsearchTemplate.php @@ -36,6 +36,7 @@ public function __construct(SerializerInterface $serializer) public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_msearch/template"; } @@ -49,7 +50,12 @@ public function getParamWhitelist(): array 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips' + 'ccs_minimize_roundtrips', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Nodes/Info.php b/src/OpenSearch/Endpoints/Nodes/Info.php index 985d79ba2..ea2665d7f 100644 --- a/src/OpenSearch/Endpoints/Nodes/Info.php +++ b/src/OpenSearch/Endpoints/Nodes/Info.php @@ -25,13 +25,13 @@ class Info extends AbstractEndpoint { - protected $node_id; protected $metric; + protected $node_id; public function getURI(): string { - $node_id = $this->node_id ?? null; $metric = $this->metric ?? null; + $node_id = $this->node_id ?? null; if (isset($node_id) && isset($metric)) { return "/_nodes/$node_id/$metric"; @@ -49,7 +49,12 @@ public function getParamWhitelist(): array { return [ 'flat_settings', - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -58,28 +63,28 @@ public function getMethod(): string return 'GET'; } - public function setNodeId($node_id): Info + public function setMetric($metric): Info { - if (isset($node_id) !== true) { + if (isset($metric) !== true) { return $this; } - if (is_array($node_id) === true) { - $node_id = implode(",", $node_id); + if (is_array($metric) === true) { + $metric = implode(",", $metric); } - $this->node_id = $node_id; + $this->metric = $metric; return $this; } - public function setMetric($metric): Info + public function setNodeId($node_id): Info { - if (isset($metric) !== true) { + if (isset($node_id) !== true) { return $this; } - if (is_array($metric) === true) { - $metric = implode(",", $metric); + if (is_array($node_id) === true) { + $node_id = implode(",", $node_id); } - $this->metric = $metric; + $this->node_id = $node_id; return $this; } diff --git a/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php b/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php index c56fef6ec..6797fb90b 100644 --- a/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php +++ b/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php @@ -40,7 +40,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Nodes/Stats.php b/src/OpenSearch/Endpoints/Nodes/Stats.php index bf28fa07a..2836510e1 100644 --- a/src/OpenSearch/Endpoints/Nodes/Stats.php +++ b/src/OpenSearch/Endpoints/Nodes/Stats.php @@ -63,7 +63,12 @@ public function getParamWhitelist(): array 'level', 'types', 'timeout', - 'include_segment_file_sizes' + 'include_segment_file_sizes', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Nodes/Usage.php b/src/OpenSearch/Endpoints/Nodes/Usage.php index ca864da9d..83483f1d0 100644 --- a/src/OpenSearch/Endpoints/Nodes/Usage.php +++ b/src/OpenSearch/Endpoints/Nodes/Usage.php @@ -48,7 +48,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Ping.php b/src/OpenSearch/Endpoints/Ping.php index 4e562ffcf..8b6420fc3 100644 --- a/src/OpenSearch/Endpoints/Ping.php +++ b/src/OpenSearch/Endpoints/Ping.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/RankEval.php b/src/OpenSearch/Endpoints/RankEval.php index a128da03d..d62eb110c 100644 --- a/src/OpenSearch/Endpoints/RankEval.php +++ b/src/OpenSearch/Endpoints/RankEval.php @@ -41,7 +41,12 @@ public function getParamWhitelist(): array 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'search_type' + 'search_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Reindex.php b/src/OpenSearch/Endpoints/Reindex.php index b90fefaf6..6aff98e8e 100644 --- a/src/OpenSearch/Endpoints/Reindex.php +++ b/src/OpenSearch/Endpoints/Reindex.php @@ -40,7 +40,12 @@ public function getParamWhitelist(): array 'requests_per_second', 'scroll', 'slices', - 'max_docs' + 'max_docs', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/ReindexRethrottle.php b/src/OpenSearch/Endpoints/ReindexRethrottle.php index 4a5d3598a..a83eb9323 100644 --- a/src/OpenSearch/Endpoints/ReindexRethrottle.php +++ b/src/OpenSearch/Endpoints/ReindexRethrottle.php @@ -41,7 +41,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'requests_per_second' + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/RenderSearchTemplate.php b/src/OpenSearch/Endpoints/RenderSearchTemplate.php index a31647ab3..47e5f1454 100644 --- a/src/OpenSearch/Endpoints/RenderSearchTemplate.php +++ b/src/OpenSearch/Endpoints/RenderSearchTemplate.php @@ -37,7 +37,13 @@ public function getURI(): string public function getParamWhitelist(): array { - return []; + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string diff --git a/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php b/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php index b5fc62e74..0577c5787 100644 --- a/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php +++ b/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php @@ -33,7 +33,11 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Scroll.php b/src/OpenSearch/Endpoints/Scroll.php index c933f5b43..2829a43ef 100644 --- a/src/OpenSearch/Endpoints/Scroll.php +++ b/src/OpenSearch/Endpoints/Scroll.php @@ -45,7 +45,12 @@ public function getParamWhitelist(): array return [ 'scroll', 'scroll_id', - 'rest_total_hits_as_int' + 'rest_total_hits_as_int', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Search.php b/src/OpenSearch/Endpoints/Search.php index 3898143d8..f3d6e1245 100644 --- a/src/OpenSearch/Endpoints/Search.php +++ b/src/OpenSearch/Endpoints/Search.php @@ -28,6 +28,7 @@ class Search extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_search"; } @@ -78,7 +79,14 @@ public function getParamWhitelist(): array 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', - 'rest_total_hits_as_int' + 'rest_total_hits_as_int', + 'search_pipeline', + 'include_named_queries_score', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/SearchShards.php b/src/OpenSearch/Endpoints/SearchShards.php index 39fbd96eb..372a43e2e 100644 --- a/src/OpenSearch/Endpoints/SearchShards.php +++ b/src/OpenSearch/Endpoints/SearchShards.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array 'local', 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' + 'expand_wildcards', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/SearchTemplate.php b/src/OpenSearch/Endpoints/SearchTemplate.php index 827f1e802..760c611a9 100644 --- a/src/OpenSearch/Endpoints/SearchTemplate.php +++ b/src/OpenSearch/Endpoints/SearchTemplate.php @@ -28,6 +28,7 @@ class SearchTemplate extends AbstractEndpoint public function getURI(): string { $index = $this->index ?? null; + if (isset($index)) { return "/$index/_search/template"; } @@ -49,7 +50,12 @@ public function getParamWhitelist(): array 'profile', 'typed_keys', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips' + 'ccs_minimize_roundtrips', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Security/FlushCache.php b/src/OpenSearch/Endpoints/Security/FlushCache.php index 834d082e5..a0dc7c819 100644 --- a/src/OpenSearch/Endpoints/Security/FlushCache.php +++ b/src/OpenSearch/Endpoints/Security/FlushCache.php @@ -19,14 +19,20 @@ class FlushCache extends AbstractEndpoint { - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/cache"; } - public function getURI(): string + public function getParamWhitelist(): array { - return "/_plugins/_security/api/cache"; + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string diff --git a/src/OpenSearch/Endpoints/Security/GetCertificates.php b/src/OpenSearch/Endpoints/Security/GetCertificates.php index bec2a9445..3eb4827cb 100644 --- a/src/OpenSearch/Endpoints/Security/GetCertificates.php +++ b/src/OpenSearch/Endpoints/Security/GetCertificates.php @@ -19,14 +19,20 @@ class GetCertificates extends AbstractEndpoint { - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/ssl/certs"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_opendistro/_security/api/ssl/certs'; + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string diff --git a/src/OpenSearch/Endpoints/Security/Health.php b/src/OpenSearch/Endpoints/Security/Health.php index cd1c9127a..ae305507b 100644 --- a/src/OpenSearch/Endpoints/Security/Health.php +++ b/src/OpenSearch/Endpoints/Security/Health.php @@ -19,14 +19,21 @@ class Health extends AbstractEndpoint { - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/health"; } - public function getURI(): string + public function getParamWhitelist(): array { - return "/_plugins/_security/health"; + return [ + 'mode', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string diff --git a/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php b/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php index 124e461a5..141a029ef 100644 --- a/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php +++ b/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php @@ -42,8 +42,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setRepository($repository): CleanupRepository return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php b/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php index 7566a8542..716b975b8 100644 --- a/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php +++ b/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php @@ -45,7 +45,13 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'master_timeout', 'cluster_manager_timeout' + 'master_timeout', + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -93,6 +99,7 @@ public function setTargetSnapshot($target_snapshot): CloneSnapshot return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/Create.php b/src/OpenSearch/Endpoints/Snapshot/Create.php index 739b525ef..97a12fee8 100644 --- a/src/OpenSearch/Endpoints/Snapshot/Create.php +++ b/src/OpenSearch/Endpoints/Snapshot/Create.php @@ -44,8 +44,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'wait_for_completion', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -83,6 +88,7 @@ public function setSnapshot($snapshot): Create return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php b/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php index 7e212ae36..e7e97e20e 100644 --- a/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php +++ b/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php @@ -42,9 +42,14 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', 'verify', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -72,6 +77,7 @@ public function setRepository($repository): CreateRepository return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/Delete.php b/src/OpenSearch/Endpoints/Snapshot/Delete.php index 3ca214e73..4c58a74a0 100644 --- a/src/OpenSearch/Endpoints/Snapshot/Delete.php +++ b/src/OpenSearch/Endpoints/Snapshot/Delete.php @@ -43,7 +43,13 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'master_timeout', 'cluster_manager_timeout' + 'master_timeout', + 'cluster_manager_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -71,6 +77,7 @@ public function setSnapshot($snapshot): Delete return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php b/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php index eb1f4b9e6..604c4aa8f 100644 --- a/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php +++ b/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php @@ -42,8 +42,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -64,6 +69,7 @@ public function setRepository($repository): DeleteRepository return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/Get.php b/src/OpenSearch/Endpoints/Snapshot/Get.php index cde6ac1b6..2963df6e3 100644 --- a/src/OpenSearch/Endpoints/Snapshot/Get.php +++ b/src/OpenSearch/Endpoints/Snapshot/Get.php @@ -44,9 +44,14 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', 'verbose', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -77,6 +82,7 @@ public function setSnapshot($snapshot): Get return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/GetRepository.php b/src/OpenSearch/Endpoints/Snapshot/GetRepository.php index 51db10371..5be023e1f 100644 --- a/src/OpenSearch/Endpoints/Snapshot/GetRepository.php +++ b/src/OpenSearch/Endpoints/Snapshot/GetRepository.php @@ -41,8 +41,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'local', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -63,6 +68,7 @@ public function setRepository($repository): GetRepository return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/Restore.php b/src/OpenSearch/Endpoints/Snapshot/Restore.php index b3612c989..b26ff7029 100644 --- a/src/OpenSearch/Endpoints/Snapshot/Restore.php +++ b/src/OpenSearch/Endpoints/Snapshot/Restore.php @@ -44,8 +44,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'wait_for_completion', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -83,6 +88,7 @@ public function setSnapshot($snapshot): Restore return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/Status.php b/src/OpenSearch/Endpoints/Snapshot/Status.php index 056753fd3..16d2af556 100644 --- a/src/OpenSearch/Endpoints/Snapshot/Status.php +++ b/src/OpenSearch/Endpoints/Snapshot/Status.php @@ -46,8 +46,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'ignore_unavailable', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -78,6 +83,7 @@ public function setSnapshot($snapshot): Status return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php b/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php index f247fd2ce..72269c9ca 100644 --- a/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php +++ b/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php @@ -42,8 +42,13 @@ public function getParamWhitelist(): array { return [ 'master_timeout', + 'cluster_manager_timeout', 'timeout', - 'cluster_manager_timeout' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } @@ -61,6 +66,7 @@ public function setRepository($repository): VerifyRepository return $this; } + protected function getParamDeprecation(): array { return ['master_timeout' => 'cluster_manager_timeout']; diff --git a/src/OpenSearch/Endpoints/Tasks/Cancel.php b/src/OpenSearch/Endpoints/Tasks/Cancel.php index de81946a5..6c62de531 100644 --- a/src/OpenSearch/Endpoints/Tasks/Cancel.php +++ b/src/OpenSearch/Endpoints/Tasks/Cancel.php @@ -43,7 +43,12 @@ public function getParamWhitelist(): array 'nodes', 'actions', 'parent_task_id', - 'wait_for_completion' + 'wait_for_completion', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Tasks/Get.php b/src/OpenSearch/Endpoints/Tasks/Get.php index 38140b298..e78d83c3e 100644 --- a/src/OpenSearch/Endpoints/Tasks/Get.php +++ b/src/OpenSearch/Endpoints/Tasks/Get.php @@ -42,7 +42,12 @@ public function getParamWhitelist(): array { return [ 'wait_for_completion', - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Tasks/ListTasks.php b/src/OpenSearch/Endpoints/Tasks/ListTasks.php index 3429ff2f6..3b4f20ea0 100644 --- a/src/OpenSearch/Endpoints/Tasks/ListTasks.php +++ b/src/OpenSearch/Endpoints/Tasks/ListTasks.php @@ -39,7 +39,12 @@ public function getParamWhitelist(): array 'parent_task_id', 'wait_for_completion', 'group_by', - 'timeout' + 'timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/TermVectors.php b/src/OpenSearch/Endpoints/TermVectors.php index b245d8c44..ace86289b 100644 --- a/src/OpenSearch/Endpoints/TermVectors.php +++ b/src/OpenSearch/Endpoints/TermVectors.php @@ -35,6 +35,7 @@ public function getURI(): string } $index = $this->index; $id = $this->id ?? null; + if (isset($id)) { return "/$index/_termvectors/$id"; } @@ -54,7 +55,12 @@ public function getParamWhitelist(): array 'routing', 'realtime', 'version', - 'version_type' + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/Update.php b/src/OpenSearch/Endpoints/Update.php index c6ece449e..d9affb3c2 100644 --- a/src/OpenSearch/Endpoints/Update.php +++ b/src/OpenSearch/Endpoints/Update.php @@ -40,6 +40,7 @@ public function getURI(): string ); } $index = $this->index; + return "/$index/_update/$id"; } @@ -57,7 +58,12 @@ public function getParamWhitelist(): array 'timeout', 'if_seq_no', 'if_primary_term', - 'require_alias' + 'require_alias', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php b/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php index 7ce3b80fc..9d7fdc6ea 100644 --- a/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php +++ b/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php @@ -41,7 +41,12 @@ public function getURI(): string public function getParamWhitelist(): array { return [ - 'requests_per_second' + 'requests_per_second', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } diff --git a/util/ClientEndpoint.php b/util/ClientEndpoint.php index c75d2761e..e0c3dc72b 100644 --- a/util/ClientEndpoint.php +++ b/util/ClientEndpoint.php @@ -34,14 +34,10 @@ class ClientEndpoint extends NamespaceEndpoint protected $endpoints = []; protected $endpointNames = []; protected $namespace = []; - protected $version; - protected $buildhash; - public function __construct(array $namespace, string $version, string $buildhash) + public function __construct(array $namespace) { $this->namespace = $namespace; - $this->version = $version; - $this->buildhash = $buildhash; } public function renderClass(): string @@ -108,8 +104,6 @@ public function renderClass(): string $functions .= $func; } $class = str_replace(':functions', $functions, $class); - $class = str_replace(':version', $this->version, $class); - $class = str_replace(':buildhash', $this->buildhash, $class); return $class; } diff --git a/util/Endpoint.php b/util/Endpoint.php index 43700064e..39944211f 100644 --- a/util/Endpoint.php +++ b/util/Endpoint.php @@ -35,6 +35,7 @@ class Endpoint public const CHECK_OPTIONS_TEMPLATE = __DIR__ . '/template/check-options'; public const SET_BULK_BODY_TEMPLATE = __DIR__ . '/template/set-bulk-body'; public const DEPRECATED_PART = __DIR__ . '/template/deprecated'; + public const DEPRECATED_PARAM = __DIR__ . '/template/deprecated-param-master-timeout'; public const PHP_RESERVED_WORDS = [ 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', @@ -58,8 +59,6 @@ class Endpoint public $name; public $apiName; protected $content; - protected $version; - protected $buildhash; protected $parts = []; protected $requiredParts = []; protected $useNamespace = []; @@ -69,8 +68,6 @@ class Endpoint public function __construct( string $fileName, string $content, - string $version, - string $buildhash ) { $this->apiName = basename($fileName, '.json'); $parts = explode('.', $this->apiName); @@ -95,8 +92,6 @@ public function __construct( )); } $this->content = $this->content[$this->apiName]; - $this->version = $version; - $this->buildhash = $buildhash; $this->parts = $this->getPartsFromContent($this->content); $this->requiredParts = $this->getRequiredParts($this->content); @@ -127,6 +122,8 @@ private function getRequiredParts(array $content): array } if (count($required) > 1) { return call_user_func_array('array_intersect', $required); + } elseif (count($required) === 1) { + return $required[0]; } return $required; } @@ -146,7 +143,7 @@ public function renderClass(): string } $class = str_replace( ':uri', - $this->extractUrl($this->content['url']['paths']), + trim($this->extractUrl($this->content['url']['paths'])), $class ); $class = str_replace( @@ -164,11 +161,15 @@ public function renderClass(): string // Set the HTTP method $action = $this->getMethod(); - if (!empty($this->content['body']) && - ($action === ['GET', 'POST'] || $action === ['POST', 'GET'])) { - $method = 'isset($this->body) ? \'POST\' : \'GET\''; + if ($action === ['POST', 'PUT'] && $this->getClassName() !== 'Bulk') { + $method = "'PUT'"; } else { - $method = sprintf("'%s'", reset($action)); + if (!empty($this->content['body']) && + ($action === ['GET', 'POST'] || $action === ['POST', 'GET'])) { + $method = 'isset($this->body) ? \'POST\' : \'GET\''; + } else { + $method = sprintf("'%s'", reset($action)); + } } $class = str_replace(':method', $method, $class); @@ -186,7 +187,7 @@ public function renderClass(): string if (in_array($part, ['type', 'index', 'id'])) { continue; } - if (isset($value['type']) && $value['type'] === 'list') { + if (isset($value['type']) && $value['type'] === 'array') { $parts .= $this->getSetPartList($part); } else { $parts .= $this->getSetPart($part); @@ -194,11 +195,36 @@ public function renderClass(): string } $class = str_replace(':set-parts', $parts, $class); $class = str_replace(':endpoint', $this->getClassName(), $class); - $class = str_replace(':version', $this->version, $class); - $class = str_replace(':buildhash', $this->buildhash, $class); $class = str_replace(':use-namespace', $this->getNamespaces(), $class); $class = str_replace(':properties', $this->getProperties(), $class); + if (isset($this->content['params']['master_timeout'])) { + $deprecatedContent = file_get_contents(self::DEPRECATED_PARAM); + $class = str_replace(':master_timeout_ParamDeprecation', $deprecatedContent, $class); + } else { + $class = preg_replace('/\s*:master_timeout_ParamDeprecation\s*\}/', '}', $class); + } + + // Adding licence header + $currentDir = dirname(__FILE__); + $baseDir = dirname($currentDir); + $EndpointName = $this->getClassName(); + + if (!empty($this->namespace)) { + $filePath = $baseDir . "/src/OpenSearch/Endpoints/$this->namespace/$EndpointName.php"; + } else { + $filePath = $baseDir . "/src/OpenSearch/Endpoints/$EndpointName.php"; + } + + if (file_exists($filePath)) { + $content = file_get_contents($filePath); + if (strpos($content, 'Copyright OpenSearch') !== false) { + $pattern = '/\/\*\*.*?\*\//s'; + if (preg_match($pattern, $content, $matches)) { + $class = str_replace('declare(strict_types=1);', 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $matches[0], $class); + } + } + } return str_replace(':apiname', $this->apiName, $class); } @@ -495,7 +521,7 @@ private function extractPartsDescription(int $space): string $part, str_repeat(' ', $space - strlen($part)), $part === 'type' || (isset($values['deprecated']) && $values['deprecated']) ? 'DEPRECATED ' : '', - $values['type'], + $values['type'] ?? 'any', $values['description'] ?? '', in_array($part, $this->requiredParts) ? ' (Required)' : '' ); @@ -518,11 +544,11 @@ private function extractParamsDescription(int $space): string " * \$params['%s']%s = (%s) %s%s%s%s\n", $param, str_repeat(' ', $space - strlen($param)), - $values['type'], + $values['type'] ?? 'any', $values['description'] ?? '', isset($values['required']) && $values['required'] ? ' (Required)' : '', isset($values['options']) ? sprintf(" (Options = %s)", implode(',', $values['options'])) : '', - isset($values['default']) ? sprintf(" (Default = %s)", $values['type'] === 'boolean' ? ($values['default'] ? 'true' : 'false') : (is_array($values['default']) ? implode(',', $values['default']) : $values['default'])) : '' + isset($values['default']) ? sprintf(" (Default = %s)", $values['type'] ?? 'any' === 'boolean' ? ($values['default'] ? 'true' : 'false') : (is_array($values['default']) ? implode(',', $values['default']) : $values['default'])) : '' ); } return $result; diff --git a/util/GenerateEndpoints.php b/util/GenerateEndpoints.php index 272d8c2ba..c12a12776 100644 --- a/util/GenerateEndpoints.php +++ b/util/GenerateEndpoints.php @@ -29,53 +29,12 @@ use Symfony\Component\Yaml\Yaml; require_once dirname(__DIR__) . '/vendor/autoload.php'; - - -// try { -// $client = Utility::getClient(); -// } catch (RuntimeException $e) { -// printf("ERROR: I cannot find STACK_VERSION and TEST_SUITE environment variables\n"); -// exit(1); -// } - -// try { -// $serverInfo = $client->info(); -// } catch (NoNodesAvailableException $e) { -// printf("ERROR: Host %s is offline\n", Utility::getHost()); -// exit(1); -// } - -// $version = $serverInfo['version']['number']; -// $buildHash = $serverInfo['version']['build_hash']; -// echo "buildHash = $buildHash , version = $version"; -/* -if (version_compare($version, '7.4.0', '<')) { - printf("Error: the ES version must be >= 7.4.0\n"); - exit(1); -} - -$backupFileName = sprintf( - "%s/backup_endpoint_namespace_%s.zip", - __DIR__, - Client::VERSION -); - -printf("Backup Endpoints and Namespaces in:\n%s\n", $backupFileName); -backup($backupFileName); -*/ +require_once dirname(__DIR__) . '/util/license_header.php'; $start = microtime(true); printf("Generating endpoints for OpenSearch\n"); $success = true; -// Check if the rest-spec folder with the build hash exists -/* -if (!is_dir(sprintf("%s/rest-spec/%s", __DIR__, $buildHash))) { - printf("ERROR: I cannot find the rest-spec for build hash %s\n", $buildHash); - printf("You need to execute 'php util/RestSpecRunner.php'\n"); - exit(1); -} -*/ // Load the OpenAPI specification file $url = "https://github.com/opensearch-project/opensearch-api-specification/releases/download/main/opensearch-openapi.yaml"; @@ -84,246 +43,453 @@ $list_of_dicts = []; foreach ($data["paths"] as $path => $pathDetails) { - echo "path=$path \n"; - // print_r($pathDetails); - echo ".....\n"; foreach ($pathDetails as $method => $methodDetails) { - echo "method=$method \n"; - print_r($methodDetails); - // Check if the key exists and its value equals "nodes.hot_threads" - // if (isset($methodDetails["x-operation-group"]) && $methodDetails["x-operation-group"] === "nodes.hot_threads") { - // // Check if the "deprecated" key is not present - // if (!isset($methodDetails["deprecated"])) { - // Add additional keys "path" and "method" to the methodDetails array $methodDetails["path"] = $path; $methodDetails["method"] = $method; - // Append the modified methodDetails array to the list_of_dicts array $list_of_dicts[] = $methodDetails; - // } - // } } } -print_r($list_of_dicts); - -$length = count($list_of_dicts); -echo "Length of \$list_of_dicts array: $length \n\n\n"; -//var_dump($list_of_dicts); - -// Now $list_of_dicts contains the required data -// Parse YAML content into PHP data structure -//$data = yaml_parse($yamlContent); - - -// $files = glob(sprintf("https://github.com/opensearch-project/opensearch-api-specification/releases/download/main/opensearch-openapi.yaml")); - -// $outputDir = __DIR__ . "/output"; -// if (!file_exists($outputDir)) { -// mkdir($outputDir); -// } - -// $endpointDir = "$outputDir/Endpoints/"; -// if (!file_exists($endpointDir)) { -// mkdir($endpointDir); -// } - -// $countEndpoint = 0; -// $namespaces = []; - -// // Generate endpoints -// foreach ($files as $file) { -// if (stripos($file, 'xpack') !== false) { -// continue; -// } - -// if (empty($file) || (basename($file) === '_common.json')) { -// continue; -// } -// printf("Generating %s...", basename($file)); - -// $endpoint = new Endpoint($file, file_get_contents($file), $version, $buildHash); - -// $dir = $endpointDir . NamespaceEndpoint::normalizeName($endpoint->namespace); -// if (!file_exists($dir)) { -// mkdir($dir); -// } -// $outputFile = sprintf("%s/%s.php", $dir, $endpoint->getClassName()); -// file_put_contents( -// $outputFile, -// $endpoint->renderClass() -// ); -// if (!isValidPhpSyntax($outputFile)) { -// printf("Error: syntax error in %s\n", $outputFile); -// exit(1); -// } - -// printf("done\n"); - -// $namespaces[$endpoint->namespace][] = $endpoint; -// $countEndpoint++; -// } - -// // Generate namespaces -// $namespaceDir = "$outputDir/Namespaces/"; -// if (!file_exists($namespaceDir)) { -// mkdir($namespaceDir); -// } - -// $countNamespace = 0; -// $clientFile = "$outputDir/Client.php"; - -// foreach ($namespaces as $name => $endpoints) { -// if (empty($name)) { -// $clientEndpoint = new ClientEndpoint(array_keys($namespaces), $version, $buildHash); -// foreach ($endpoints as $ep) { -// $clientEndpoint->addEndpoint($ep); -// } -// file_put_contents( -// $clientFile, -// $clientEndpoint->renderClass() -// ); -// if (!isValidPhpSyntax($clientFile)) { -// printf("Error: syntax error in %s\n", $clientFile); -// exit(1); -// } -// $countNamespace++; -// continue; -// } -// $namespace = new NamespaceEndpoint($name, $version, $buildHash); -// foreach ($endpoints as $ep) { -// $namespace->addEndpoint($ep); -// } -// $namespaceFile = $namespaceDir . $namespace->getNamespaceName() . 'Namespace.php'; -// file_put_contents( -// $namespaceFile, -// $namespace->renderClass() -// ); -// if (!isValidPhpSyntax($namespaceFile)) { -// printf("Error: syntax error in %s\n", $namespaceFile); -// exit(1); -// } -// $countNamespace++; -// } - -// $destDir = __DIR__ . "/../src/OpenSearch"; - -// printf("Copying the generated files to %s\n", $destDir); -// cleanFolders(); -// moveSubFolder($outputDir . "/Endpoints", $destDir . "/Endpoints"); -// moveSubFolder($outputDir . "/Namespaces", $destDir . "/Namespaces"); -// rename($outputDir . "/Client.php", $destDir . "/Client.php"); - -// $end = microtime(true); -// printf("\nGenerated %d endpoints and %d namespaces in %.3f seconds\n", $countEndpoint, $countNamespace, $end - $start); -// printf("\n"); - -// removeDirectory($outputDir); - -// /** -// * ---------------------------------- FUNCTIONS ---------------------------------- -// */ - -// /** -// * Remove a directory recursively -// */ -// function removeDirectory($directory, array $omit = []) -// { -// foreach (glob("{$directory}/*") as $file) { -// if (is_dir($file)) { -// if (!in_array($file, $omit)) { -// removeDirectory($file, $omit); -// } -// } else { -// if (!in_array($file, $omit)) { -// @unlink($file); -// } -// } -// } -// if (is_dir($directory)) { -// @rmdir($directory); -// } -// } - -// /** -// * Remove Endpoints, Namespaces and Client in src/OpenSearch -// */ -// function cleanFolders() -// { -// removeDirectory(__DIR__ . '/../src/OpenSearch/Endpoints', [ -// __DIR__ . '/../src/OpenSearch/Endpoints/AbstractEndpoint.php', -// ]); -// removeDirectory(__DIR__ . '/../src/OpenSearch/Namespaces', [ -// __DIR__ . '/../src/OpenSearch/Namespaces/AbstractNamespace.php', -// __DIR__ . '/../src/OpenSearch/Namespaces/BooleanRequestWrapper.php', -// __DIR__ . '/../src/OpenSearch/Namespaces/NamespaceBuilderInterface.php' -// ]); -// @unlink(__DIR__ . '/../src/OpenSearch/Client.php'); -// } - -// /** -// * Move subfolder -// */ -// function moveSubFolder(string $origin, string $destination) -// { -// foreach (glob("{$origin}/*") as $file) { -// rename($file, $destination . "/" . basename($file)); -// } -// } - -// /** -// * Backup Endpoints, Namespaces and Client in src/OpenSearch -// */ -// function backup(string $fileName) -// { -// $zip = new ZipArchive(); -// $result = $zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); -// if ($result !== true) { -// printf("Error opening the zip file %s: %s\n", $fileName, $result); -// exit(1); -// } else { -// $zip->addFile(__DIR__ . '/../src/OpenSearch/Client.php', 'Client.php'); -// $zip->addGlob(__DIR__ . '/../src/OpenSearch/Namespaces/*.php', GLOB_BRACE, [ -// 'remove_path' => __DIR__ . '/../src/OpenSearch' -// ]); -// // Add the Endpoints (including subfolders) -// foreach (glob(__DIR__ . '/../src/OpenSearch/Endpoints/*') as $file) { -// if (is_dir($file)) { -// $zip->addGlob("$file/*.php", GLOB_BRACE, [ -// 'remove_path' => __DIR__ . '/../src/OpenSearch' -// ]); -// } else { -// $zip->addGlob("$file", GLOB_BRACE, [ -// 'remove_path' => __DIR__ . '/../src/OpenSearch' -// ]); -// } -// } -// $zip->close(); -// } -// } - -// /** -// * Restore Endpoints, Namespaces and Client in src/OpenSearch -// */ -// function restore(string $fileName) -// { -// $zip = new ZipArchive(); -// $result = $zip->open($fileName); -// if ($result !== true) { -// printf("Error opening the zip file %s: %s\n", $fileName, $result); -// exit(1); -// } -// $zip->extractTo(__DIR__ . '/../src/OpenSearch'); -// $zip->close(); -// } - -// /** -// * Check if the generated code has a valid PHP syntax -// */ -// function isValidPhpSyntax(string $filename): bool -// { -// if (file_exists($filename)) { -// $result = exec("php -l $filename"); -// return false !== strpos($result, "No syntax errors"); -// } -// return false; -// }; + + +$outputDir = __DIR__ . "/output"; +if (!file_exists($outputDir)) { + mkdir($outputDir); +} + +$endpointDir = "$outputDir/Endpoints/"; +if (!file_exists($endpointDir)) { + mkdir($endpointDir); +} + +$countEndpoint = 0; +$namespaces = []; + +$count = 0; +foreach ($list_of_dicts as $index => $endpoint) { + + if (array_key_exists("parameters", $endpoint)) { + + $params = []; + $parts = []; + // Iterate over the list of parameters and update them + foreach ($endpoint["parameters"] as $param_ref) { + $param_ref_value = substr($param_ref["$"."ref"], strrpos($param_ref["$"."ref"], '/') + 1); + $param = $data["components"]["parameters"][$param_ref_value]; + if (isset($param["schema"]) && isset($param["schema"]["$"."ref"])) { + $schema_path_ref = substr($param["schema"]["$"."ref"], strrpos($param["schema"]["$"."ref"], '/') + 1); + $param["schema"] = $data["components"]["schemas"][$schema_path_ref]; + $params[] = $param; + } else { + $params[] = $param; + } + } + var_dump($params); + + // Iterate over the list of updated parameters to separate "parts" from "params" + $params_copy = $params; + + foreach ($params_copy as $key => $param) { + if ($param["in"] === "path") { + $parts[] = $param; + unset($params[$key]); + } + } + + // Convert "params" and "parts" into the structure required for generator. + $params_new = []; + $parts_new = []; + + foreach ($params as $param) { + $param_dict = []; + + if (isset($param['description'])) { + $param_dict['description'] = str_replace("\n", "", $param['description']); + } + + if (isset($param['schema']['type'])) { + $param_dict['type'] = $param['schema']['type']; + } + + if (isset($param['schema']['default'])) { + $param_dict['default'] = $param['schema']['default']; + } + + if (isset($param['schema']['enum'])) { + $param_dict['type'] = 'enum'; + $param_dict['options'] = $param['schema']['enum']; + } + + if (isset($param['deprecated'])) { + $param_dict['deprecated'] = $param['deprecated']; + } + + if (isset($param['x-deprecation-message'])) { + $param_dict['deprecation_message'] = $param['x-deprecation-message']; + } + + $params_new[$param['name']] = $param_dict; + } + + if ($endpoint['x-operation-group'] !== 'nodes.hot_threads' && isset($params_new['type'])) { + unset($params_new['type']); + } + if (!empty($params_new)) { + $endpoint['params'] = $params_new; + } + + foreach ($parts as $part) { + $parts_dict = []; + + if (isset($part['schema']['type'])) { + $parts_dict['type'] = $part['schema']['type']; + } elseif (isset($part['schema']['oneOf'])) { + foreach ($part['schema']['oneOf'] as $item) { + if (isset($item['type'])) { + $parts_dict['type'] = $item['type']; + break; + } + } + } + + if (isset($part['description'])) { + $parts_dict['description'] = str_replace("\n", " ", $part['description']); + } + + if (isset($part['schema']['x-enum-options'])) { + $parts_dict['options'] = $part['schema']['x-enum-options']; + } + + if (isset($part['deprecated'])) { + $parts_dict['deprecated'] = $part['deprecated']; + } + + $parts_new[$part['name']] = $parts_dict; + } + if (!empty($parts_new)) { + $endpoint['parts'] = $parts_new; + } + $list_of_dicts[$index] = $endpoint; + } +} +$files = []; +// Sort $list_of_dicts by the value of the "x-operation-group" key +usort($list_of_dicts, function ($a, $b) { + return $a['x-operation-group'] <=> $b['x-operation-group']; +}); + +// Group $list_of_dicts by the value of the "x-operation-group" key +$grouped = []; +foreach ($list_of_dicts as $dict) { + $grouped[$dict['x-operation-group']][] = $dict; +} + +foreach ($grouped as $key => $value) { + $api = []; + + // Extract the namespace and name from the 'x-operation-group' + if (strpos($key, '.') !== false) { + list($namespace, $name) = explode('.', $key); + } else { + $namespace = "__init__"; + $name = $key; + } + + // Group the data in the current group by the "path" key + $grouped_by_path = []; + foreach ($value as $dict) { + $grouped_by_path[$dict['path']][] = $dict; + } + + $paths = []; + $all_paths_have_deprecation = true; + + foreach ($grouped_by_path as $path => $path_dicts) { + + $methods = []; + $parts_final = []; + $deprecated_path_dict = []; + + foreach ($path_dicts as $method_dict) { + $methods[] = strtoupper($method_dict['method']); + + if (!isset($api['documentation'])) { + $api['documentation'] = ['description' => $method_dict['description']]; + } + + if (isset($method_dict["x-version-deprecated"])) { + $deprecated_path_dict = array_merge($deprecated_path_dict, ["version" => $method_dict["x-version-deprecated"]]); + } + + if (isset($method_dict["x-deprecation-message"])) { + $deprecated_path_dict = array_merge($deprecated_path_dict, ["description" => $method_dict["x-deprecation-message"]]); + } else { + $all_paths_have_deprecation = false; + } + + if (!isset($api['params']) && isset($method_dict['params'])) { + $api['params'] = $method_dict['params']; + } + + if (!isset($api['body']) && isset($method_dict['requestBody']) && isset($method_dict['requestBody']['$ref'])) { + $requestbody_ref = explode('/', $method_dict['requestBody']['$ref']); + $requestbody_ref = end($requestbody_ref); + $body = ['required' => false]; + + if (isset($data['components']['requestBodies'][$requestbody_ref]['required'])) { + $body['required'] = $data['components']['requestBodies'][$requestbody_ref]['required']; + } + + if (isset($data['components']['requestBodies'][$requestbody_ref]['content']['application/x-ndjson'])) { + $requestbody_schema = $data['components']['requestBodies'][$requestbody_ref]['content']['application/x-ndjson']['schema']; + $body['serialize'] = "bulk"; + } else { + $requestbody_schema = $data['components']['requestBodies'][$requestbody_ref]['content']['application/json']['schema']; + } + + if (isset($requestbody_schema['description'])) { + $body['description'] = $requestbody_schema['description']; + } + + $api['body'] = $body; + } + + if (isset($method_dict['parts'])) { + $parts_final = array_merge($parts_final, $method_dict['parts']); + } + } + + // Update api dictionary with stability, visibility and headers + if (in_array('POST', $methods) || in_array('PUT', $methods)) { + $api['stability'] = 'stable'; + $api['visibility'] = 'public'; + $api['headers'] = [ + 'accept' => ['application/json'], + 'content_type' => ['application/json'], + ]; + } else { + $api['stability'] = 'stable'; + $api['visibility'] = 'public'; + $api['headers'] = ['accept' => ['application/json']]; + } + + $path_data = ['path' => $path, 'methods' => $methods]; + + if (!empty($deprecated_path_dict)) { + $path_data['deprecated'] = $deprecated_path_dict; + } + + if (!empty($parts_final)) { + $path_data['parts'] = $parts_final; + } + + $paths[] = $path_data; + } + + $api['url'] = ['paths' => $paths]; + $files[] = [$key => $api]; +} +// Generate endpoints +foreach ($files as $entry) { + foreach ($entry as $key => $api) { + if (empty($key) || ($key === '_common')) { + continue; + } + + printf("Generating %s...", $key); + + $entry_json = json_encode($entry); + + $endpoint = new Endpoint($key . '.json', $entry_json); + + $dir = $endpointDir . NamespaceEndpoint::normalizeName($endpoint->namespace); + if (!file_exists($dir)) { + mkdir($dir); + } + + $outputFile = sprintf("%s/%s.php", $dir, $endpoint->getClassName()); + + file_put_contents($outputFile, $endpoint->renderClass()); + + if (!isValidPhpSyntax($outputFile)) { + printf("Error: syntax error in %s\n", $outputFile); + exit(1); + } + + printf("done\n"); + + $namespaces[$endpoint->namespace][] = $endpoint; + $countEndpoint++; + } +} + + +// Generate namespaces +$namespaceDir = "$outputDir/Namespaces/"; +if (!file_exists($namespaceDir)) { + mkdir($namespaceDir); +} + +$countNamespace = 0; +$clientFile = "$outputDir/Client.php"; + +foreach ($namespaces as $name => $endpoints) { + if (empty($name)) { + $clientEndpoint = new ClientEndpoint(array_keys($namespaces)); + foreach ($endpoints as $ep) { + $clientEndpoint->addEndpoint($ep); + } + file_put_contents( + $clientFile, + $clientEndpoint->renderClass() + ); + if (!isValidPhpSyntax($clientFile)) { + printf("Error: syntax error in %s\n", $clientFile); + exit(1); + } + $countNamespace++; + continue; + } + $namespace = new NamespaceEndpoint($name); + foreach ($endpoints as $ep) { + $namespace->addEndpoint($ep); + } + $namespaceFile = $namespaceDir . $namespace->getNamespaceName() . 'Namespace.php'; + + file_put_contents( + $namespaceFile, + $namespace->renderClass() + ); + + if (!isValidPhpSyntax($namespaceFile)) { + printf("Error: syntax error in %s\n", $namespaceFile); + exit(1); + } + $countNamespace++; +} + + +$destDir = __DIR__ . "/../src/OpenSearch"; + +printf("Copying the generated files to %s\n", $destDir); +cleanFolders(); +fix_license_header($outputDir . "/Namespaces"); +fix_license_header($outputDir . "/Endpoints"); +moveSubFolder($outputDir . "/Endpoints", $destDir . "/Endpoints"); +moveSubFolder($outputDir . "/Namespaces", $destDir . "/Namespaces"); +rename($outputDir . "/Client.php", $destDir . "/Client.php"); + +$end = microtime(true); +printf("\nGenerated %d endpoints and %d namespaces in %.3f seconds\n", $countEndpoint, $countNamespace, $end - $start); +printf("\n"); + +removeDirectory($outputDir); + +/** + * ---------------------------------- FUNCTIONS ---------------------------------- + */ + +/** + * Remove a directory recursively + */ +function removeDirectory($directory, array $omit = []) +{ + foreach (glob("{$directory}/*") as $file) { + if (is_dir($file)) { + if (!in_array($file, $omit)) { + removeDirectory($file, $omit); + } + } else { + if (!in_array($file, $omit)) { + @unlink($file); + } + } + } + if (is_dir($directory)) { + @rmdir($directory); + } +} + +/** + * Remove Endpoints, Namespaces and Client in src/OpenSearch + */ +function cleanFolders() +{ + removeDirectory(__DIR__ . '/../src/OpenSearch/Endpoints', [ + __DIR__ . '/../src/OpenSearch/Endpoints/AbstractEndpoint.php', + ]); + removeDirectory(__DIR__ . '/../src/OpenSearch/Namespaces', [ + __DIR__ . '/../src/OpenSearch/Namespaces/AbstractNamespace.php', + __DIR__ . '/../src/OpenSearch/Namespaces/BooleanRequestWrapper.php', + __DIR__ . '/../src/OpenSearch/Namespaces/NamespaceBuilderInterface.php' + ]); + @unlink(__DIR__ . '/../src/OpenSearch/Client.php'); +} + +/** + * Move subfolder + */ +function moveSubFolder(string $origin, string $destination) +{ + foreach (glob("{$origin}/*") as $file) { + rename($file, $destination . "/" . basename($file)); + } +} + +/** + * Backup Endpoints, Namespaces and Client in src/OpenSearch + */ +function backup(string $fileName) +{ + $zip = new ZipArchive(); + $result = $zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); + if ($result !== true) { + printf("Error opening the zip file %s: %s\n", $fileName, $result); + exit(1); + } else { + $zip->addFile(__DIR__ . '/../src/OpenSearch/Client.php', 'Client.php'); + $zip->addGlob(__DIR__ . '/../src/OpenSearch/Namespaces/*.php', GLOB_BRACE, [ + 'remove_path' => __DIR__ . '/../src/OpenSearch' + ]); + // Add the Endpoints (including subfolders) + foreach (glob(__DIR__ . '/../src/OpenSearch/Endpoints/*') as $file) { + if (is_dir($file)) { + $zip->addGlob("$file/*.php", GLOB_BRACE, [ + 'remove_path' => __DIR__ . '/../src/OpenSearch' + ]); + } else { + $zip->addGlob("$file", GLOB_BRACE, [ + 'remove_path' => __DIR__ . '/../src/OpenSearch' + ]); + } + } + $zip->close(); + } +} + +/** + * Restore Endpoints, Namespaces and Client in src/OpenSearch + */ +function restore(string $fileName) +{ + $zip = new ZipArchive(); + $result = $zip->open($fileName); + if ($result !== true) { + printf("Error opening the zip file %s: %s\n", $fileName, $result); + exit(1); + } + $zip->extractTo(__DIR__ . '/../src/OpenSearch'); + $zip->close(); +} + +/** + * Check if the generated code has a valid PHP syntax + */ +function isValidPhpSyntax(string $filename): bool +{ + if (file_exists($filename)) { + $result = exec("php -l $filename"); + return false !== strpos($result, "No syntax errors"); + } + return false; +}; diff --git a/util/NamespaceEndpoint.php b/util/NamespaceEndpoint.php index 36ca224fd..98757a523 100644 --- a/util/NamespaceEndpoint.php +++ b/util/NamespaceEndpoint.php @@ -35,14 +35,10 @@ class NamespaceEndpoint protected $name; protected $endpoints = []; protected $endpointNames = []; - protected $version; - protected $buildhash; - public function __construct(string $name, string $version, string $buildhash) + public function __construct(string $name) { $this->name = $name; - $this->version = $version; - $this->buildhash = $buildhash; } public function renderClass(): string @@ -51,7 +47,24 @@ public function renderClass(): string throw new Exception("No endpoints has been added. I cannot render the class"); } $class = file_get_contents(static::NAMESPACE_CLASS_TEMPLATE); - $class = str_replace(':namespace', $this->getNamespaceName() . 'Namespace', $class); + $namespaceName = $this->getNamespaceName(). 'Namespace'; + $class = str_replace(':namespace', $namespaceName, $class); + + # Add license header + $currentDir = dirname(__FILE__); + $baseDir = dirname($currentDir); + $filePath = $baseDir . "/src/OpenSearch/Namespaces/$namespaceName.php"; + + if (file_exists($filePath)) { + $content = file_get_contents($filePath); + if (strpos($content, 'Copyright OpenSearch') !== false) { + $pattern = '/\/\*\*.*?\*\//s'; + if (preg_match($pattern, $content, $matches)) { + $class = str_replace('declare(strict_types=1);', 'declare(strict_types=1);' . PHP_EOL . PHP_EOL . $matches[0], $class); + + } + } + } $endpoints = ''; foreach ($this->endpoints as $endpoint) { @@ -67,8 +80,6 @@ public function renderClass(): string break; } $class = str_replace(':endpoints', $endpoints, $class); - $class = str_replace(':version', $this->version, $class); - $class = str_replace(':buildhash', $this->buildhash, $class); return $class; } @@ -113,7 +124,11 @@ protected function renderEndpoint(Endpoint $endpoint): string $param = str_replace(':param', 'body', file_get_contents(self::SET_PARAM_TEMPLATE)); $setParams .= str_replace(':Param', 'Body', $param); } - $code = str_replace(':extract', $extract, $code); + if (!empty($extract)) { + $code = str_replace(':extract', $extract, $code); + } else { + $code = str_replace("\n" . ':extract', '', $code); + } $code = str_replace(':setparam', $setParams, $code); if (empty($endpoint->namespace)) { diff --git a/util/RestSpecRunner.php b/util/RestSpecRunner.php index dfa5ec065..a162da36a 100644 --- a/util/RestSpecRunner.php +++ b/util/RestSpecRunner.php @@ -50,13 +50,10 @@ exit(1); } -// $version = $serverInfo['version']['number']; -// $artifactFile = sprintf("rest-resources-zip-%s.zip", $version); -// echo "artifactFile = $artifactFile"; -// $tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $serverInfo['version']['build_hash']); +$version = $serverInfo['version']['number']; +$artifactFile = sprintf("rest-resources-zip-%s.zip", $version); +$tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $serverInfo['version']['build_hash']); -/* -echo "tempFilePath = $tempFilePath"; if (!file_exists($tempFilePath)) { printf("ERROR: the commit_hash %s has not been found\n", $serverInfo['version']['build_hash']); exit(1); @@ -66,7 +63,5 @@ printf("Extracting %s\ninto %s/rest-spec/%s\n", $tempFilePath, __DIR__, $serverInfo['version']['build_hash']); $zip->extractTo(sprintf("%s/rest-spec/%s", __DIR__, $serverInfo['version']['build_hash'])); $zip->close(); -*/ - printf("Rest-spec API installed successfully!\n\n"); diff --git a/util/license_header.php b/util/license_header.php new file mode 100644 index 000000000..fa1d0aa3d --- /dev/null +++ b/util/license_header.php @@ -0,0 +1,62 @@ + $line) { + if (strpos($line, 'declare(strict_types=1);') !== false) { + array_splice($lines, $i + 1, 0, "\n" . $LICENSE_HEADER . "\n"); + break; + } + } + file_put_contents($filepath, implode('', $lines)); + echo "Fixed " . realpath($filepath) . "\n"; +} + +function fix_license_header(string $path): void +{ + if (is_file($path)) { + if (doesFileNeedFix($path)) { + addHeaderToFile($path); + } + } elseif (is_dir($path)) { + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), + RecursiveIteratorIterator::LEAVES_ONLY + ); + foreach ($iterator as $file) { + if ($file->isFile() && doesFileNeedFix($file->getPathname())) { + addHeaderToFile($file->getPathname()); + } + } + } +} diff --git a/util/template/client-class b/util/template/client-class index 017b05e79..d167d8326 100644 --- a/util/template/client-class +++ b/util/template/client-class @@ -1,15 +1,28 @@ 'cluster_manager_timeout']; + } \ No newline at end of file diff --git a/util/template/endpoint-bulk-class b/util/template/endpoint-bulk-class index d23ab612e..af887e1e4 100644 --- a/util/template/endpoint-bulk-class +++ b/util/template/endpoint-bulk-class @@ -1,6 +1,6 @@