From b8e5b173efd2f51257dab7f6ec93f7780699fd60 Mon Sep 17 00:00:00 2001 From: Julien Guittard Date: Tue, 22 Oct 2024 03:00:29 +0200 Subject: [PATCH] feat: refactored namespace, use elastic transport Signed-off-by: Julien Guittard --- USER_GUIDE.md | 20 +- composer.json | 17 +- src/{OpenSearch => }/Client.php | 12 +- src/ClientBuilder.php | 309 +++++++ src/{OpenSearch => }/Common/EmptyLogger.php | 1 - .../AuthenticationConfigException.php | 0 .../Exceptions/BadMethodCallException.php | 0 .../Exceptions/BadRequest400Exception.php | 0 .../ClientErrorResponseException.php | 0 .../Exceptions/Conflict409Exception.php | 0 .../Exceptions/Curl/CouldNotConnectToHost.php | 0 .../Curl/CouldNotResolveHostException.php | 0 .../Curl/OperationTimeoutException.php | 0 .../Exceptions/Forbidden403Exception.php | 0 .../Exceptions/InvalidArgumentException.php | 0 .../Common/Exceptions/MaxRetriesException.php | 0 .../Common/Exceptions/Missing404Exception.php | 0 .../Exceptions/NoDocumentsToGetException.php | 0 .../Exceptions/NoNodesAvailableException.php | 0 .../Exceptions/NoShardAvailableException.php | 0 .../Common/Exceptions/OpenSearchException.php | 0 .../Exceptions/RequestTimeout408Exception.php | 0 .../Exceptions/RoutingMissingException.php | 0 .../Common/Exceptions/RuntimeException.php | 0 .../ScriptLangNotSupportedException.php | 0 .../Serializer/JsonErrorException.php | 0 .../ServerErrorResponseException.php | 0 .../Common/Exceptions/TransportException.php | 0 .../Exceptions/Unauthorized401Exception.php | 0 .../Exceptions/UnexpectedValueException.php | 0 .../Endpoints/AbstractEndpoint.php | 1 - .../Endpoints/AsyncSearch/Delete.php | 0 .../Endpoints/AsyncSearch/Get.php | 0 .../Endpoints/AsyncSearch/Submit.php | 0 src/{OpenSearch => }/Endpoints/Bulk.php | 1 - .../Endpoints/Cat/Aliases.php | 0 .../Endpoints/Cat/AllPitSegments.php | 0 .../Endpoints/Cat/Allocation.php | 0 .../Endpoints/Cat/ClusterManager.php | 0 src/{OpenSearch => }/Endpoints/Cat/Count.php | 0 .../Endpoints/Cat/Fielddata.php | 0 src/{OpenSearch => }/Endpoints/Cat/Health.php | 0 src/{OpenSearch => }/Endpoints/Cat/Help.php | 0 .../Endpoints/Cat/Indices.php | 0 src/{OpenSearch => }/Endpoints/Cat/Master.php | 0 .../Endpoints/Cat/NodeAttrs.php | 0 src/{OpenSearch => }/Endpoints/Cat/Nodes.php | 0 .../Endpoints/Cat/PendingTasks.php | 0 .../Endpoints/Cat/PitSegments.php | 0 .../Endpoints/Cat/Plugins.php | 0 .../Endpoints/Cat/Recovery.php | 0 .../Endpoints/Cat/Repositories.php | 0 .../Endpoints/Cat/SegmentReplication.php | 0 .../Endpoints/Cat/Segments.php | 0 src/{OpenSearch => }/Endpoints/Cat/Shards.php | 0 .../Endpoints/Cat/Snapshots.php | 0 src/{OpenSearch => }/Endpoints/Cat/Tasks.php | 0 .../Endpoints/Cat/Templates.php | 0 .../Endpoints/Cat/ThreadPool.php | 0 .../Endpoints/ClearScroll.php | 2 - .../Endpoints/Cluster/AllocationExplain.php | 0 .../Cluster/DeleteComponentTemplate.php | 0 .../Cluster/DeleteDecommissionAwareness.php | 0 .../Cluster/DeleteVotingConfigExclusions.php | 0 .../Cluster/DeleteWeightedRouting.php | 0 .../Cluster/ExistsComponentTemplate.php | 0 .../Cluster/GetComponentTemplate.php | 0 .../Cluster/GetDecommissionAwareness.php | 0 .../Endpoints/Cluster/GetSettings.php | 0 .../Endpoints/Cluster/GetWeightedRouting.php | 0 .../Endpoints/Cluster/Health.php | 0 .../Endpoints/Cluster/PendingTasks.php | 0 .../Cluster/PostVotingConfigExclusions.php | 0 .../Cluster/PutComponentTemplate.php | 0 .../Cluster/PutDecommissionAwareness.php | 0 .../Endpoints/Cluster/PutSettings.php | 0 .../Endpoints/Cluster/PutWeightedRouting.php | 0 .../Endpoints/Cluster/RemoteInfo.php | 0 .../Endpoints/Cluster/Reroute.php | 0 .../Endpoints/Cluster/State.php | 0 .../Endpoints/Cluster/Stats.php | 0 src/{OpenSearch => }/Endpoints/Count.php | 2 - src/{OpenSearch => }/Endpoints/Create.php | 1 - src/{OpenSearch => }/Endpoints/CreatePit.php | 1 - .../DanglingIndices/DeleteDanglingIndex.php | 0 .../DanglingIndices/ImportDanglingIndex.php | 0 .../DanglingIndices/ListDanglingIndices.php | 0 .../DeleteTransform.php | 0 .../GetTransform.php | 0 .../GetTransformStats.php | 0 .../PreviewTransform.php | 0 .../PutTransform.php | 0 .../StartTransform.php | 0 .../StopTransform.php | 0 .../UpdateTransform.php | 0 src/{OpenSearch => }/Endpoints/Delete.php | 1 - .../Endpoints/DeleteAllPits.php | 2 - .../Endpoints/DeleteByQuery.php | 1 - .../Endpoints/DeleteByQueryRethrottle.php | 1 - src/{OpenSearch => }/Endpoints/DeletePit.php | 2 - .../Endpoints/DeleteScript.php | 1 - src/{OpenSearch => }/Endpoints/Exists.php | 1 - .../Endpoints/ExistsSource.php | 1 - src/{OpenSearch => }/Endpoints/Explain.php | 1 - src/{OpenSearch => }/Endpoints/FieldCaps.php | 2 - src/{OpenSearch => }/Endpoints/Get.php | 1 - src/{OpenSearch => }/Endpoints/GetAllPits.php | 2 - src/{OpenSearch => }/Endpoints/GetScript.php | 1 - .../Endpoints/GetScriptContext.php | 2 - .../Endpoints/GetScriptLanguages.php | 2 - src/{OpenSearch => }/Endpoints/GetSource.php | 1 - src/{OpenSearch => }/Endpoints/Index.php | 1 - .../Endpoints/Indices/AddBlock.php | 0 .../Endpoints/Indices/Analyze.php | 0 .../Endpoints/Indices/ClearCache.php | 0 .../Endpoints/Indices/CloneIndices.php | 0 .../Endpoints/Indices/Close.php | 0 .../Endpoints/Indices/Create.php | 0 .../Endpoints/Indices/CreateDataStream.php | 0 .../Endpoints/Indices/DataStreamsStats.php | 0 .../Endpoints/Indices/Delete.php | 0 .../Endpoints/Indices/DeleteAlias.php | 0 .../Endpoints/Indices/DeleteDataStream.php | 0 .../Endpoints/Indices/DeleteIndexTemplate.php | 0 .../Endpoints/Indices/DeleteTemplate.php | 0 .../Endpoints/Indices/Exists.php | 0 .../Endpoints/Indices/ExistsAlias.php | 0 .../Endpoints/Indices/ExistsIndexTemplate.php | 0 .../Endpoints/Indices/ExistsTemplate.php | 0 .../Endpoints/Indices/Flush.php | 0 .../Endpoints/Indices/ForceMerge.php | 0 .../Endpoints/Indices/Get.php | 0 .../Endpoints/Indices/GetAlias.php | 0 .../Endpoints/Indices/GetDataStream.php | 0 .../Endpoints/Indices/GetFieldMapping.php | 0 .../Endpoints/Indices/GetIndexTemplate.php | 0 .../Endpoints/Indices/GetMapping.php | 0 .../Endpoints/Indices/GetSettings.php | 0 .../Endpoints/Indices/GetTemplate.php | 0 .../Endpoints/Indices/GetUpgrade.php | 0 .../Endpoints/Indices/Open.php | 0 .../Endpoints/Indices/PutAlias.php | 0 .../Endpoints/Indices/PutIndexTemplate.php | 0 .../Endpoints/Indices/PutMapping.php | 0 .../Endpoints/Indices/PutSettings.php | 0 .../Endpoints/Indices/PutTemplate.php | 0 .../Endpoints/Indices/Recovery.php | 0 .../Endpoints/Indices/Refresh.php | 0 .../Indices/RefreshSearchAnalyzers.php | 0 .../Endpoints/Indices/ResolveIndex.php | 0 .../Endpoints/Indices/Rollover.php | 0 .../Endpoints/Indices/Segments.php | 0 .../Endpoints/Indices/ShardStores.php | 0 .../Endpoints/Indices/Shrink.php | 0 .../Indices/SimulateIndexTemplate.php | 0 .../Endpoints/Indices/SimulateTemplate.php | 0 .../Endpoints/Indices/Split.php | 0 .../Endpoints/Indices/Stats.php | 0 .../Endpoints/Indices/UpdateAliases.php | 0 .../Endpoints/Indices/Upgrade.php | 0 .../Endpoints/Indices/ValidateQuery.php | 0 src/{OpenSearch => }/Endpoints/Info.php | 2 - .../Endpoints/Ingest/DeletePipeline.php | 0 .../Endpoints/Ingest/GetPipeline.php | 0 .../Endpoints/Ingest/ProcessorGrok.php | 0 .../Endpoints/Ingest/PutPipeline.php | 0 .../Endpoints/Ingest/Simulate.php | 0 .../Endpoints/Knn/DeleteModel.php | 0 .../Endpoints/Knn/GetModel.php | 0 .../Endpoints/Knn/SearchModels.php | 0 src/{OpenSearch => }/Endpoints/Knn/Stats.php | 0 .../Endpoints/Knn/TrainModel.php | 0 src/{OpenSearch => }/Endpoints/Knn/Warmup.php | 0 .../Endpoints/MTermVectors.php | 2 - src/{OpenSearch => }/Endpoints/Mget.php | 2 - .../Endpoints/Ml/CreateConnector.php | 0 .../Endpoints/Ml/DeleteConnector.php | 0 .../Endpoints/Ml/DeleteModel.php | 0 .../Endpoints/Ml/DeleteModelGroup.php | 0 .../Endpoints/Ml/DeployModel.php | 0 .../Endpoints/Ml/GetConnector.php | 0 .../Endpoints/Ml/GetConnectors.php | 0 .../Endpoints/Ml/GetModel.php | 0 .../Endpoints/Ml/GetModelGroup.php | 0 .../Endpoints/Ml/GetModelGroups.php | 0 src/{OpenSearch => }/Endpoints/Ml/GetTask.php | 0 src/{OpenSearch => }/Endpoints/Ml/Predict.php | 0 .../Endpoints/Ml/RegisterModel.php | 0 .../Endpoints/Ml/RegisterModelGroup.php | 0 .../Endpoints/Ml/SearchModels.php | 0 .../Endpoints/Ml/UndeployModel.php | 0 .../Endpoints/Ml/UpdateModelGroup.php | 0 .../Endpoints/Monitoring/Bulk.php | 0 src/{OpenSearch => }/Endpoints/Msearch.php | 1 - .../Endpoints/MsearchTemplate.php | 1 - .../Endpoints/Nodes/HotThreads.php | 0 src/{OpenSearch => }/Endpoints/Nodes/Info.php | 0 .../Endpoints/Nodes/ReloadSecureSettings.php | 0 .../Endpoints/Nodes/Stats.php | 0 .../Endpoints/Nodes/Usage.php | 0 .../Endpoints/Notifications/CreateConfig.php | 0 .../Endpoints/Notifications/DeleteConfig.php | 0 .../Endpoints/Notifications/DeleteConfigs.php | 0 .../Endpoints/Notifications/GetConfig.php | 0 .../Endpoints/Notifications/GetConfigs.php | 0 .../Endpoints/Notifications/ListChannels.php | 0 .../Endpoints/Notifications/ListFeatures.php | 0 .../Endpoints/Notifications/SendTest.php | 0 .../Endpoints/Notifications/UpdateConfig.php | 0 .../Endpoints/Observability/CreateObject.php | 0 .../Endpoints/Observability/DeleteObject.php | 0 .../Endpoints/Observability/DeleteObjects.php | 0 .../Endpoints/Observability/GetLocalstats.php | 0 .../Endpoints/Observability/GetObject.php | 0 .../Endpoints/Observability/ListObjects.php | 0 .../Endpoints/Observability/UpdateObject.php | 0 src/{OpenSearch => }/Endpoints/Ping.php | 2 - .../Endpoints/Ppl/Explain.php | 0 .../Endpoints/Ppl/GetStats.php | 0 .../Endpoints/Ppl/PostStats.php | 0 src/{OpenSearch => }/Endpoints/Ppl/Query.php | 0 src/{OpenSearch => }/Endpoints/PutScript.php | 1 - .../Endpoints/Query/DatasourceDelete.php | 0 .../Endpoints/Query/DatasourceRetrieve.php | 0 .../Endpoints/Query/DatasourcesCreate.php | 0 .../Endpoints/Query/DatasourcesList.php | 0 .../Endpoints/Query/DatasourcesUpdate.php | 0 src/{OpenSearch => }/Endpoints/RankEval.php | 2 - src/{OpenSearch => }/Endpoints/Reindex.php | 2 - .../Endpoints/ReindexRethrottle.php | 1 - .../Endpoints/RemoteStore/Restore.php | 0 .../Endpoints/RenderSearchTemplate.php | 2 - .../Endpoints/Rollups/Delete.php | 0 .../Endpoints/Rollups/Explain.php | 0 .../Endpoints/Rollups/Get.php | 0 .../Endpoints/Rollups/Put.php | 0 .../Endpoints/Rollups/Start.php | 0 .../Endpoints/Rollups/Stop.php | 0 .../Endpoints/ScriptsPainlessExecute.php | 2 - src/{OpenSearch => }/Endpoints/Scroll.php | 2 - src/{OpenSearch => }/Endpoints/Search.php | 2 - .../Endpoints/SearchPipeline/Delete.php | 0 .../Endpoints/SearchPipeline/Get.php | 0 .../Endpoints/SearchPipeline/Put.php | 0 .../Endpoints/SearchShards.php | 2 - .../Endpoints/SearchTemplate.php | 2 - .../SearchableSnapshots/ClearCache.php | 0 .../Endpoints/SearchableSnapshots/Mount.php | 0 .../SearchableSnapshots/RepositoryStats.php | 0 .../Endpoints/SearchableSnapshots/Stats.php | 0 .../Endpoints/Security/Authinfo.php | 0 .../Endpoints/Security/Authtoken.php | 0 .../Endpoints/Security/Cache.php | 0 .../Endpoints/Security/ChangePassword.php | 0 .../Endpoints/Security/ConfigUpgradeCheck.php | 0 .../Security/ConfigUpgradePerform.php | 0 .../Endpoints/Security/CreateActionGroup.php | 0 .../Endpoints/Security/CreateAllowlist.php | 0 .../Endpoints/Security/CreateRole.php | 0 .../Endpoints/Security/CreateRoleMapping.php | 0 .../Endpoints/Security/CreateTenant.php | 0 .../Security/CreateUpdateTenancyConfig.php | 0 .../Endpoints/Security/CreateUser.php | 0 .../Endpoints/Security/CreateUserLegacy.php | 0 .../Endpoints/Security/DeleteActionGroup.php | 0 .../Security/DeleteDistinguishedName.php | 0 .../Endpoints/Security/DeleteRole.php | 0 .../Endpoints/Security/DeleteRoleMapping.php | 0 .../Endpoints/Security/DeleteTenant.php | 0 .../Endpoints/Security/DeleteUser.php | 0 .../Endpoints/Security/DeleteUserLegacy.php | 0 .../Endpoints/Security/FlushCache.php | 0 .../Endpoints/Security/GenerateOboToken.php | 0 .../Endpoints/Security/GenerateUserToken.php | 0 .../Security/GenerateUserTokenLegacy.php | 0 .../Endpoints/Security/GetAccountDetails.php | 0 .../Endpoints/Security/GetActionGroup.php | 0 .../Endpoints/Security/GetActionGroups.php | 0 .../Endpoints/Security/GetAllowlist.php | 0 .../Security/GetAuditConfiguration.php | 0 .../Endpoints/Security/GetCertificates.php | 0 .../Endpoints/Security/GetConfiguration.php | 0 .../Endpoints/Security/GetDashboardsInfo.php | 0 .../Security/GetDistinguishedName.php | 0 .../Security/GetDistinguishedNames.php | 0 .../Endpoints/Security/GetPermissionsInfo.php | 0 .../Endpoints/Security/GetRole.php | 0 .../Endpoints/Security/GetRoleMapping.php | 0 .../Endpoints/Security/GetRoleMappings.php | 0 .../Endpoints/Security/GetRoles.php | 0 .../Endpoints/Security/GetSslinfo.php | 0 .../Endpoints/Security/GetTenancyConfig.php | 0 .../Endpoints/Security/GetTenant.php | 0 .../Endpoints/Security/GetTenants.php | 0 .../Endpoints/Security/GetUser.php | 0 .../Endpoints/Security/GetUserLegacy.php | 0 .../Endpoints/Security/GetUsers.php | 0 .../Endpoints/Security/GetUsersLegacy.php | 0 .../Endpoints/Security/Health.php | 0 .../Endpoints/Security/Migrate.php | 0 .../Endpoints/Security/PatchActionGroup.php | 0 .../Endpoints/Security/PatchActionGroups.php | 0 .../Endpoints/Security/PatchAllowlist.php | 0 .../Security/PatchAuditConfiguration.php | 0 .../Endpoints/Security/PatchConfiguration.php | 0 .../Security/PatchDistinguishedName.php | 0 .../Security/PatchDistinguishedNames.php | 0 .../Endpoints/Security/PatchRole.php | 0 .../Endpoints/Security/PatchRoleMapping.php | 0 .../Endpoints/Security/PatchRoleMappings.php | 0 .../Endpoints/Security/PatchRoles.php | 0 .../Endpoints/Security/PatchTenant.php | 0 .../Endpoints/Security/PatchTenants.php | 0 .../Endpoints/Security/PatchUser.php | 0 .../Endpoints/Security/PatchUsers.php | 0 .../Endpoints/Security/PostDashboardsInfo.php | 0 .../Security/ReloadHttpCertificates.php | 0 .../Security/ReloadTransportCertificates.php | 0 .../Endpoints/Security/TenantInfo.php | 0 .../Security/UpdateAuditConfiguration.php | 0 .../Security/UpdateConfiguration.php | 0 .../Security/UpdateDistinguishedName.php | 0 .../Endpoints/Security/Validate.php | 0 .../Endpoints/Security/WhoAmI.php | 0 .../Endpoints/Security/WhoAmIProtected.php | 0 .../Endpoints/Snapshot/CleanupRepository.php | 0 .../Endpoints/Snapshot/CloneSnapshot.php | 0 .../Endpoints/Snapshot/Create.php | 0 .../Endpoints/Snapshot/CreateRepository.php | 0 .../Endpoints/Snapshot/Delete.php | 0 .../Endpoints/Snapshot/DeleteRepository.php | 0 .../Endpoints/Snapshot/Get.php | 0 .../Endpoints/Snapshot/GetRepository.php | 0 .../Endpoints/Snapshot/Restore.php | 0 .../Endpoints/Snapshot/Status.php | 0 .../Endpoints/Snapshot/VerifyRepository.php | 0 src/{OpenSearch => }/Endpoints/Sql/Close.php | 0 .../Endpoints/Sql/CursorClose.php | 0 .../Endpoints/Sql/Explain.php | 0 .../Endpoints/Sql/GetStats.php | 0 .../Endpoints/Sql/PostStats.php | 0 src/{OpenSearch => }/Endpoints/Sql/Query.php | 0 .../Endpoints/Sql/Settings.php | 0 .../Endpoints/Ssl/Certificates.php | 0 .../Endpoints/Tasks/Cancel.php | 0 src/{OpenSearch => }/Endpoints/Tasks/Get.php | 0 .../Endpoints/Tasks/ListTasks.php | 0 .../Endpoints/TermVectors.php | 1 - .../Endpoints/Transforms/Delete.php | 0 .../Endpoints/Transforms/Explain.php | 0 .../Endpoints/Transforms/Get.php | 0 .../Endpoints/Transforms/Preview.php | 0 .../Endpoints/Transforms/Put.php | 0 .../Endpoints/Transforms/Search.php | 0 .../Endpoints/Transforms/Start.php | 0 .../Endpoints/Transforms/Stop.php | 0 src/{OpenSearch => }/Endpoints/Update.php | 1 - .../Endpoints/UpdateByQuery.php | 1 - .../Endpoints/UpdateByQueryRethrottle.php | 1 - .../Helper/Iterators/SearchHitIterator.php | 0 .../Iterators/SearchResponseIterator.php | 2 +- .../Namespaces/AbstractNamespace.php | 11 +- .../Namespaces/AsyncSearchNamespace.php | 2 - .../Namespaces/BooleanRequestWrapper.php | 23 +- .../Namespaces/CatNamespace.php | 2 - .../Namespaces/ClusterNamespace.php | 2 - .../Namespaces/DanglingIndicesNamespace.php | 2 - .../DataFrameTransformDeprecatedNamespace.php | 2 - .../Namespaces/IndicesNamespace.php | 2 - .../Namespaces/IngestNamespace.php | 2 - .../Namespaces/KnnNamespace.php | 2 - .../Namespaces/MlNamespace.php | 2 - .../Namespaces/MonitoringNamespace.php | 2 - .../Namespaces/NamespaceBuilderInterface.php | 0 .../Namespaces/NodesNamespace.php | 2 - .../Namespaces/NotificationsNamespace.php | 2 - .../Namespaces/ObservabilityNamespace.php | 2 - .../Namespaces/PplNamespace.php | 2 - .../Namespaces/QueryNamespace.php | 2 - .../Namespaces/RemoteStoreNamespace.php | 2 - .../Namespaces/RollupsNamespace.php | 2 - .../Namespaces/SearchPipelineNamespace.php | 2 - .../SearchableSnapshotsNamespace.php | 2 - .../Namespaces/SecurityNamespace.php | 2 - .../Namespaces/SnapshotNamespace.php | 2 - .../Namespaces/SqlNamespace.php | 2 - .../Namespaces/SslNamespace.php | 2 - .../Namespaces/TasksNamespace.php | 2 - .../Namespaces/TransformsNamespace.php | 2 - src/OpenSearch/ClientBuilder.php | 859 ------------------ .../ConnectionPool/AbstractConnectionPool.php | 95 -- .../ConnectionPoolInterface.php | 31 - .../Selectors/RandomSelector.php | 37 - .../Selectors/RoundRobinSelector.php | 46 - .../Selectors/SelectorInterface.php | 34 - .../Selectors/StickyRoundRobinSelector.php | 57 -- .../ConnectionPool/SimpleConnectionPool.php | 48 - .../ConnectionPool/SniffingConnectionPool.php | 181 ---- .../ConnectionPool/StaticConnectionPool.php | 105 --- .../StaticNoPingConnectionPool.php | 88 -- src/OpenSearch/Connections/Connection.php | 789 ---------------- .../Connections/ConnectionFactory.php | 81 -- .../ConnectionFactoryInterface.php | 30 - .../Connections/ConnectionInterface.php | 83 -- src/OpenSearch/Handlers/SigV4Handler.php | 151 --- src/OpenSearch/Transport.php | 178 ---- .../Serializers/ArrayToJSONSerializer.php | 0 .../EverythingToJSONSerializer.php | 5 - .../Serializers/SerializerInterface.php | 0 .../Serializers/SmartSerializer.php | 0 src/Transport.php | 165 ++++ tests/ClientBuilderTest.php | 129 +-- tests/ClientTest.php | 244 +---- .../ConnectionPool/ConnectionFactoryTest.php | 66 -- .../Selectors/RoundRobinSelectorTest.php | 114 --- .../StickyRoundRobinSelectorTest.php | 80 -- .../SniffingConnectionPoolIntegrationTest.php | 50 - .../SniffingConnectionPoolTest.php | 293 ------ .../StaticConnectionPoolIntegrationTest.php | 66 -- .../StaticConnectionPoolTest.php | 225 ----- tests/Connections/ConnectionTest.php | 504 ---------- .../Endpoints/MlNamespaceIntegrationTest.php | 1 - tests/Endpoints/StatusEndpointTest.php | 1 - tests/Handlers/SigV4HandlerTest.php | 241 ----- .../Iterators/SearchHitIteratorTest.php | 2 +- .../Iterators/SearchResponseIteratorTest.php | 2 +- .../MachineLearningNamespaceTest.php | 18 +- tests/Namespaces/SecurityNamespaceTest.php | 1 - tests/RegisteredNamespaceTest.php | 5 +- .../Serializers/ArrayToJSONSerializerTest.php | 2 +- .../EverythingToJSONSerializerTest.php | 2 +- tests/Serializers/SmartSerializerTest.php | 1 - tests/TransportTest.php | 99 -- tests/Utility.php | 8 - util/ActionTest.php | 3 +- util/GenerateEndpoints.php | 5 +- util/build_tests.php | 2 +- 437 files changed, 532 insertions(+), 5203 deletions(-) rename src/{OpenSearch => }/Client.php (99%) create mode 100644 src/ClientBuilder.php rename src/{OpenSearch => }/Common/EmptyLogger.php (98%) rename src/{OpenSearch => }/Common/Exceptions/AuthenticationConfigException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/BadMethodCallException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/BadRequest400Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/ClientErrorResponseException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Conflict409Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Curl/CouldNotConnectToHost.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Curl/CouldNotResolveHostException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Curl/OperationTimeoutException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Forbidden403Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/InvalidArgumentException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/MaxRetriesException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Missing404Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/NoDocumentsToGetException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/NoNodesAvailableException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/NoShardAvailableException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/OpenSearchException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/RequestTimeout408Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/RoutingMissingException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/RuntimeException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/ScriptLangNotSupportedException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Serializer/JsonErrorException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/ServerErrorResponseException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/TransportException.php (100%) rename src/{OpenSearch => }/Common/Exceptions/Unauthorized401Exception.php (100%) rename src/{OpenSearch => }/Common/Exceptions/UnexpectedValueException.php (100%) rename src/{OpenSearch => }/Endpoints/AbstractEndpoint.php (99%) rename src/{OpenSearch => }/Endpoints/AsyncSearch/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/AsyncSearch/Get.php (100%) rename src/{OpenSearch => }/Endpoints/AsyncSearch/Submit.php (100%) rename src/{OpenSearch => }/Endpoints/Bulk.php (98%) rename src/{OpenSearch => }/Endpoints/Cat/Aliases.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/AllPitSegments.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Allocation.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/ClusterManager.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Count.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Fielddata.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Health.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Help.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Indices.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Master.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/NodeAttrs.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Nodes.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/PendingTasks.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/PitSegments.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Plugins.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Recovery.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Repositories.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/SegmentReplication.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Segments.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Shards.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Snapshots.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Tasks.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/Templates.php (100%) rename src/{OpenSearch => }/Endpoints/Cat/ThreadPool.php (100%) rename src/{OpenSearch => }/Endpoints/ClearScroll.php (97%) rename src/{OpenSearch => }/Endpoints/Cluster/AllocationExplain.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/DeleteComponentTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/DeleteDecommissionAwareness.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/DeleteVotingConfigExclusions.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/DeleteWeightedRouting.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/ExistsComponentTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/GetComponentTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/GetDecommissionAwareness.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/GetSettings.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/GetWeightedRouting.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/Health.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PendingTasks.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PostVotingConfigExclusions.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PutComponentTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PutDecommissionAwareness.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PutSettings.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/PutWeightedRouting.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/RemoteInfo.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/Reroute.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/State.php (100%) rename src/{OpenSearch => }/Endpoints/Cluster/Stats.php (100%) rename src/{OpenSearch => }/Endpoints/Count.php (97%) rename src/{OpenSearch => }/Endpoints/Create.php (97%) rename src/{OpenSearch => }/Endpoints/CreatePit.php (96%) rename src/{OpenSearch => }/Endpoints/DanglingIndices/DeleteDanglingIndex.php (100%) rename src/{OpenSearch => }/Endpoints/DanglingIndices/ImportDanglingIndex.php (100%) rename src/{OpenSearch => }/Endpoints/DanglingIndices/ListDanglingIndices.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/DeleteTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/GetTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/PutTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/StartTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/StopTransform.php (100%) rename src/{OpenSearch => }/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php (100%) rename src/{OpenSearch => }/Endpoints/Delete.php (97%) rename src/{OpenSearch => }/Endpoints/DeleteAllPits.php (95%) rename src/{OpenSearch => }/Endpoints/DeleteByQuery.php (98%) rename src/{OpenSearch => }/Endpoints/DeleteByQueryRethrottle.php (97%) rename src/{OpenSearch => }/Endpoints/DeletePit.php (95%) rename src/{OpenSearch => }/Endpoints/DeleteScript.php (97%) rename src/{OpenSearch => }/Endpoints/Exists.php (97%) rename src/{OpenSearch => }/Endpoints/ExistsSource.php (97%) rename src/{OpenSearch => }/Endpoints/Explain.php (98%) rename src/{OpenSearch => }/Endpoints/FieldCaps.php (97%) rename src/{OpenSearch => }/Endpoints/Get.php (97%) rename src/{OpenSearch => }/Endpoints/GetAllPits.php (95%) rename src/{OpenSearch => }/Endpoints/GetScript.php (97%) rename src/{OpenSearch => }/Endpoints/GetScriptContext.php (96%) rename src/{OpenSearch => }/Endpoints/GetScriptLanguages.php (96%) rename src/{OpenSearch => }/Endpoints/GetSource.php (97%) rename src/{OpenSearch => }/Endpoints/Index.php (97%) rename src/{OpenSearch => }/Endpoints/Indices/AddBlock.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Analyze.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ClearCache.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/CloneIndices.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Close.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Create.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/CreateDataStream.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/DataStreamsStats.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/DeleteAlias.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/DeleteDataStream.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/DeleteIndexTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/DeleteTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Exists.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ExistsAlias.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ExistsIndexTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ExistsTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Flush.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ForceMerge.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Get.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetAlias.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetDataStream.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetFieldMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetIndexTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetSettings.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/GetUpgrade.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Open.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/PutAlias.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/PutIndexTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/PutMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/PutSettings.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/PutTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Recovery.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Refresh.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/RefreshSearchAnalyzers.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ResolveIndex.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Rollover.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Segments.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ShardStores.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Shrink.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/SimulateIndexTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/SimulateTemplate.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Split.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Stats.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/UpdateAliases.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/Upgrade.php (100%) rename src/{OpenSearch => }/Endpoints/Indices/ValidateQuery.php (100%) rename src/{OpenSearch => }/Endpoints/Info.php (96%) rename src/{OpenSearch => }/Endpoints/Ingest/DeletePipeline.php (100%) rename src/{OpenSearch => }/Endpoints/Ingest/GetPipeline.php (100%) rename src/{OpenSearch => }/Endpoints/Ingest/ProcessorGrok.php (100%) rename src/{OpenSearch => }/Endpoints/Ingest/PutPipeline.php (100%) rename src/{OpenSearch => }/Endpoints/Ingest/Simulate.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/DeleteModel.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/GetModel.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/SearchModels.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/Stats.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/TrainModel.php (100%) rename src/{OpenSearch => }/Endpoints/Knn/Warmup.php (100%) rename src/{OpenSearch => }/Endpoints/MTermVectors.php (97%) rename src/{OpenSearch => }/Endpoints/Mget.php (97%) rename src/{OpenSearch => }/Endpoints/Ml/CreateConnector.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/DeleteConnector.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/DeleteModel.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/DeleteModelGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/DeployModel.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetConnector.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetConnectors.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetModel.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetModelGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetModelGroups.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/GetTask.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/Predict.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/RegisterModel.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/RegisterModelGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/SearchModels.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/UndeployModel.php (100%) rename src/{OpenSearch => }/Endpoints/Ml/UpdateModelGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Monitoring/Bulk.php (100%) rename src/{OpenSearch => }/Endpoints/Msearch.php (98%) rename src/{OpenSearch => }/Endpoints/MsearchTemplate.php (98%) rename src/{OpenSearch => }/Endpoints/Nodes/HotThreads.php (100%) rename src/{OpenSearch => }/Endpoints/Nodes/Info.php (100%) rename src/{OpenSearch => }/Endpoints/Nodes/ReloadSecureSettings.php (100%) rename src/{OpenSearch => }/Endpoints/Nodes/Stats.php (100%) rename src/{OpenSearch => }/Endpoints/Nodes/Usage.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/CreateConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/DeleteConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/DeleteConfigs.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/GetConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/GetConfigs.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/ListChannels.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/ListFeatures.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/SendTest.php (100%) rename src/{OpenSearch => }/Endpoints/Notifications/UpdateConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/CreateObject.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/DeleteObject.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/DeleteObjects.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/GetLocalstats.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/GetObject.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/ListObjects.php (100%) rename src/{OpenSearch => }/Endpoints/Observability/UpdateObject.php (100%) rename src/{OpenSearch => }/Endpoints/Ping.php (96%) rename src/{OpenSearch => }/Endpoints/Ppl/Explain.php (100%) rename src/{OpenSearch => }/Endpoints/Ppl/GetStats.php (100%) rename src/{OpenSearch => }/Endpoints/Ppl/PostStats.php (100%) rename src/{OpenSearch => }/Endpoints/Ppl/Query.php (100%) rename src/{OpenSearch => }/Endpoints/PutScript.php (98%) rename src/{OpenSearch => }/Endpoints/Query/DatasourceDelete.php (100%) rename src/{OpenSearch => }/Endpoints/Query/DatasourceRetrieve.php (100%) rename src/{OpenSearch => }/Endpoints/Query/DatasourcesCreate.php (100%) rename src/{OpenSearch => }/Endpoints/Query/DatasourcesList.php (100%) rename src/{OpenSearch => }/Endpoints/Query/DatasourcesUpdate.php (100%) rename src/{OpenSearch => }/Endpoints/RankEval.php (97%) rename src/{OpenSearch => }/Endpoints/Reindex.php (97%) rename src/{OpenSearch => }/Endpoints/ReindexRethrottle.php (97%) rename src/{OpenSearch => }/Endpoints/RemoteStore/Restore.php (100%) rename src/{OpenSearch => }/Endpoints/RenderSearchTemplate.php (97%) rename src/{OpenSearch => }/Endpoints/Rollups/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/Rollups/Explain.php (100%) rename src/{OpenSearch => }/Endpoints/Rollups/Get.php (100%) rename src/{OpenSearch => }/Endpoints/Rollups/Put.php (100%) rename src/{OpenSearch => }/Endpoints/Rollups/Start.php (100%) rename src/{OpenSearch => }/Endpoints/Rollups/Stop.php (100%) rename src/{OpenSearch => }/Endpoints/ScriptsPainlessExecute.php (97%) rename src/{OpenSearch => }/Endpoints/Scroll.php (97%) rename src/{OpenSearch => }/Endpoints/Search.php (98%) rename src/{OpenSearch => }/Endpoints/SearchPipeline/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/SearchPipeline/Get.php (100%) rename src/{OpenSearch => }/Endpoints/SearchPipeline/Put.php (100%) rename src/{OpenSearch => }/Endpoints/SearchShards.php (97%) rename src/{OpenSearch => }/Endpoints/SearchTemplate.php (97%) rename src/{OpenSearch => }/Endpoints/SearchableSnapshots/ClearCache.php (100%) rename src/{OpenSearch => }/Endpoints/SearchableSnapshots/Mount.php (100%) rename src/{OpenSearch => }/Endpoints/SearchableSnapshots/RepositoryStats.php (100%) rename src/{OpenSearch => }/Endpoints/SearchableSnapshots/Stats.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Authinfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Authtoken.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Cache.php (100%) rename src/{OpenSearch => }/Endpoints/Security/ChangePassword.php (100%) rename src/{OpenSearch => }/Endpoints/Security/ConfigUpgradeCheck.php (100%) rename src/{OpenSearch => }/Endpoints/Security/ConfigUpgradePerform.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateActionGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateAllowlist.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateRole.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateRoleMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateTenant.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateUpdateTenancyConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateUser.php (100%) rename src/{OpenSearch => }/Endpoints/Security/CreateUserLegacy.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteActionGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteDistinguishedName.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteRole.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteRoleMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteTenant.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteUser.php (100%) rename src/{OpenSearch => }/Endpoints/Security/DeleteUserLegacy.php (100%) rename src/{OpenSearch => }/Endpoints/Security/FlushCache.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GenerateOboToken.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GenerateUserToken.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GenerateUserTokenLegacy.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetAccountDetails.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetActionGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetActionGroups.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetAllowlist.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetAuditConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetCertificates.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetDashboardsInfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetDistinguishedName.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetDistinguishedNames.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetPermissionsInfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetRole.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetRoleMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetRoleMappings.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetRoles.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetSslinfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetTenancyConfig.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetTenant.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetTenants.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetUser.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetUserLegacy.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetUsers.php (100%) rename src/{OpenSearch => }/Endpoints/Security/GetUsersLegacy.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Health.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Migrate.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchActionGroup.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchActionGroups.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchAllowlist.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchAuditConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchDistinguishedName.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchDistinguishedNames.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchRole.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchRoleMapping.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchRoleMappings.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchRoles.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchTenant.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchTenants.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchUser.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PatchUsers.php (100%) rename src/{OpenSearch => }/Endpoints/Security/PostDashboardsInfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/ReloadHttpCertificates.php (100%) rename src/{OpenSearch => }/Endpoints/Security/ReloadTransportCertificates.php (100%) rename src/{OpenSearch => }/Endpoints/Security/TenantInfo.php (100%) rename src/{OpenSearch => }/Endpoints/Security/UpdateAuditConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/UpdateConfiguration.php (100%) rename src/{OpenSearch => }/Endpoints/Security/UpdateDistinguishedName.php (100%) rename src/{OpenSearch => }/Endpoints/Security/Validate.php (100%) rename src/{OpenSearch => }/Endpoints/Security/WhoAmI.php (100%) rename src/{OpenSearch => }/Endpoints/Security/WhoAmIProtected.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/CleanupRepository.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/CloneSnapshot.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/Create.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/CreateRepository.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/DeleteRepository.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/Get.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/GetRepository.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/Restore.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/Status.php (100%) rename src/{OpenSearch => }/Endpoints/Snapshot/VerifyRepository.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/Close.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/CursorClose.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/Explain.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/GetStats.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/PostStats.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/Query.php (100%) rename src/{OpenSearch => }/Endpoints/Sql/Settings.php (100%) rename src/{OpenSearch => }/Endpoints/Ssl/Certificates.php (100%) rename src/{OpenSearch => }/Endpoints/Tasks/Cancel.php (100%) rename src/{OpenSearch => }/Endpoints/Tasks/Get.php (100%) rename src/{OpenSearch => }/Endpoints/Tasks/ListTasks.php (100%) rename src/{OpenSearch => }/Endpoints/TermVectors.php (98%) rename src/{OpenSearch => }/Endpoints/Transforms/Delete.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Explain.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Get.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Preview.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Put.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Search.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Start.php (100%) rename src/{OpenSearch => }/Endpoints/Transforms/Stop.php (100%) rename src/{OpenSearch => }/Endpoints/Update.php (98%) rename src/{OpenSearch => }/Endpoints/UpdateByQuery.php (98%) rename src/{OpenSearch => }/Endpoints/UpdateByQueryRethrottle.php (97%) rename src/{OpenSearch => }/Helper/Iterators/SearchHitIterator.php (100%) rename src/{OpenSearch => }/Helper/Iterators/SearchResponseIterator.php (100%) rename src/{OpenSearch => }/Namespaces/AbstractNamespace.php (89%) rename src/{OpenSearch => }/Namespaces/AsyncSearchNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/BooleanRequestWrapper.php (67%) rename src/{OpenSearch => }/Namespaces/CatNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/ClusterNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/DanglingIndicesNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/DataFrameTransformDeprecatedNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/IndicesNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/IngestNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/KnnNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/MlNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/MonitoringNamespace.php (97%) rename src/{OpenSearch => }/Namespaces/NamespaceBuilderInterface.php (100%) rename src/{OpenSearch => }/Namespaces/NodesNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/NotificationsNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/ObservabilityNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/PplNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/QueryNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/RemoteStoreNamespace.php (97%) rename src/{OpenSearch => }/Namespaces/RollupsNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SearchPipelineNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SearchableSnapshotsNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SecurityNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SnapshotNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SqlNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/SslNamespace.php (96%) rename src/{OpenSearch => }/Namespaces/TasksNamespace.php (99%) rename src/{OpenSearch => }/Namespaces/TransformsNamespace.php (99%) delete mode 100644 src/OpenSearch/ClientBuilder.php delete mode 100644 src/OpenSearch/ConnectionPool/AbstractConnectionPool.php delete mode 100644 src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php delete mode 100644 src/OpenSearch/ConnectionPool/Selectors/RandomSelector.php delete mode 100644 src/OpenSearch/ConnectionPool/Selectors/RoundRobinSelector.php delete mode 100644 src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php delete mode 100644 src/OpenSearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php delete mode 100644 src/OpenSearch/ConnectionPool/SimpleConnectionPool.php delete mode 100644 src/OpenSearch/ConnectionPool/SniffingConnectionPool.php delete mode 100644 src/OpenSearch/ConnectionPool/StaticConnectionPool.php delete mode 100644 src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php delete mode 100644 src/OpenSearch/Connections/Connection.php delete mode 100644 src/OpenSearch/Connections/ConnectionFactory.php delete mode 100644 src/OpenSearch/Connections/ConnectionFactoryInterface.php delete mode 100644 src/OpenSearch/Connections/ConnectionInterface.php delete mode 100644 src/OpenSearch/Handlers/SigV4Handler.php delete mode 100644 src/OpenSearch/Transport.php rename src/{OpenSearch => }/Serializers/ArrayToJSONSerializer.php (100%) rename src/{OpenSearch => }/Serializers/EverythingToJSONSerializer.php (90%) rename src/{OpenSearch => }/Serializers/SerializerInterface.php (100%) rename src/{OpenSearch => }/Serializers/SmartSerializer.php (100%) create mode 100644 src/Transport.php delete mode 100644 tests/ConnectionPool/ConnectionFactoryTest.php delete mode 100644 tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php delete mode 100644 tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php delete mode 100644 tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php delete mode 100644 tests/ConnectionPool/SniffingConnectionPoolTest.php delete mode 100644 tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php delete mode 100644 tests/ConnectionPool/StaticConnectionPoolTest.php delete mode 100644 tests/Connections/ConnectionTest.php delete mode 100644 tests/Handlers/SigV4HandlerTest.php delete mode 100644 tests/TransportTest.php diff --git a/USER_GUIDE.md b/USER_GUIDE.md index c0c90a39e..ae51ca154 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -16,7 +16,7 @@ define('INDEX_NAME', 'test_elastic_index_name2'); class MyOpenSearchClass { - protected ?\OpenSearch\Client $client; + protected ?OpenSearch\Client $client; protected $existingID = 1668504743; protected $deleteID = 1668504743; protected $bulkIds = []; @@ -369,7 +369,7 @@ This method allows you to set the hosts to use for the client. By default, the ` ```php setHosts(['https://localhost:9200']) ->build(); ``` @@ -380,7 +380,7 @@ This method allows you to set the host selection mode to use for the client. ```php setSelector(new \OpenSearch\ConnectionPool\Selectors\RandomSelector()) ->build(); @@ -391,7 +391,7 @@ This method allows you to set the host selection mode to use for the client. This method allows you to set the basic authentication credentials to use for the client. ```php -$client = (new \OpenSearch\ClientBuilder()) +$client = (new OpenSearch\ClientBuilder()) ->setBasicAuthentication('username', 'password') ->build(); ``` @@ -401,7 +401,7 @@ $client = (new \OpenSearch\ClientBuilder()) This method allows you to enable AWS SigV4 authentication for the client. The AWS SDK is required for this to work. ```php -$client = (new \OpenSearch\ClientBuilder()) +$client = (new OpenSearch\ClientBuilder()) ->setSigV4Region('us-east-2') ->setSigV4Service('es') @@ -422,7 +422,7 @@ $client = (new \OpenSearch\ClientBuilder()) This method allows you to enable AWS SigV4 authentication for the client. The AWS SDK is required for this to work. ```php -$client = (new \OpenSearch\ClientBuilder()) +$client = (new OpenSearch\ClientBuilder()) ->setSigV4Region('us-east-2') ->setSigV4Service('aoss') @@ -444,7 +444,7 @@ $client = (new \OpenSearch\ClientBuilder()) This method allows you to set custom curl options such as timeout/compression/etc. ```php -$client = (new \OpenSearch\ClientBuilder()) +$client = (new OpenSearch\ClientBuilder()) ->setConnectionParams([ 'client' => [ 'curl' => [ @@ -463,7 +463,7 @@ This method allows you to set a PSR-3 logger to use for the client. This will lo ```php setLogger($monologLogger) ->build(); ``` @@ -474,7 +474,7 @@ This method allows you to set the number of retries to use for the client. ```php -$client = (new \OpenSearch\ClientBuilder()) +$client = (new OpenSearch\ClientBuilder()) ->setRetries(3) ->build(); ``` @@ -497,7 +497,7 @@ $config = [ 'includePortInHostHeader' => true, // forces port from Hosts URL ]; -$client = \OpenSearch\ClientBuilder::fromConfig($config); +$client = OpenSearch\ClientBuilder::fromConfig($config); ... ``` diff --git a/composer.json b/composer.json index 9efae1dbc..6efe9a29b 100644 --- a/composer.json +++ b/composer.json @@ -21,12 +21,12 @@ } ], "require": { - "php": "^7.3 || ^8.0", - "ext-json": ">=1.3.7", + "php": "^8.0", "ext-curl": "*", - "ezimuel/ringphp": "^1.2.2", - "psr/log": "^1|^2|^3", - "symfony/yaml": "*" + "ext-json": ">=1.3.7", + "elastic/transport": "^v8.10", + "fig/http-message-util": "^1.1", + "psr/log": "^1|^2|^3" }, "require-dev": { "ext-zip": "*", @@ -44,7 +44,7 @@ }, "autoload": { "psr-4": { - "OpenSearch\\": "src/OpenSearch/" + "OpenSearch\\": "src/" } }, "autoload-dev": { @@ -54,7 +54,10 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "php-http/discovery": false + } }, "scripts": { "php-cs": [ diff --git a/src/OpenSearch/Client.php b/src/Client.php similarity index 99% rename from src/OpenSearch/Client.php rename to src/Client.php index e679a65e2..72334514a 100644 --- a/src/OpenSearch/Client.php +++ b/src/Client.php @@ -24,9 +24,8 @@ use OpenSearch\Common\Exceptions\BadMethodCallException; use OpenSearch\Common\Exceptions\NoNodesAvailableException; use OpenSearch\Endpoints\AbstractEndpoint; -use OpenSearch\Namespaces\NamespaceBuilderInterface; -use OpenSearch\Namespaces\BooleanRequestWrapper; use OpenSearch\Namespaces\AsyncSearchNamespace; +use OpenSearch\Namespaces\BooleanRequestWrapper; use OpenSearch\Namespaces\CatNamespace; use OpenSearch\Namespaces\ClusterNamespace; use OpenSearch\Namespaces\DanglingIndicesNamespace; @@ -36,6 +35,7 @@ use OpenSearch\Namespaces\KnnNamespace; use OpenSearch\Namespaces\MlNamespace; use OpenSearch\Namespaces\MonitoringNamespace; +use OpenSearch\Namespaces\NamespaceBuilderInterface; use OpenSearch\Namespaces\NodesNamespace; use OpenSearch\Namespaces\NotificationsNamespace; use OpenSearch\Namespaces\ObservabilityNamespace; @@ -43,8 +43,8 @@ use OpenSearch\Namespaces\QueryNamespace; use OpenSearch\Namespaces\RemoteStoreNamespace; use OpenSearch\Namespaces\RollupsNamespace; -use OpenSearch\Namespaces\SearchPipelineNamespace; use OpenSearch\Namespaces\SearchableSnapshotsNamespace; +use OpenSearch\Namespaces\SearchPipelineNamespace; use OpenSearch\Namespaces\SecurityNamespace; use OpenSearch\Namespaces\SnapshotNamespace; use OpenSearch\Namespaces\SqlNamespace; @@ -1893,9 +1893,9 @@ public function request(string $method, string $uri, array $attributes = []) $body = $attributes['body'] ?? null; $options = $attributes['options'] ?? []; - $promise = $this->transport->performRequest($method, $uri, $params, $body, $options); + $promise = $this->transport->performRequest($method, $uri, $params, $body); - return $this->transport->resultOrFuture($promise, $options); + return $this->transport->resultOrFuture($promise); } /** @@ -1911,6 +1911,6 @@ private function performRequest(AbstractEndpoint $endpoint) $endpoint->getOptions() ); - return $this->transport->resultOrFuture($promise, $endpoint->getOptions()); + return $this->transport->resultOrFuture($promise); } } diff --git a/src/ClientBuilder.php b/src/ClientBuilder.php new file mode 100644 index 000000000..0a19932c0 --- /dev/null +++ b/src/ClientBuilder.php @@ -0,0 +1,309 @@ +logger = new NullLogger(); + } + + /** + * Create an instance of ClientBuilder + */ + public static function create(): ClientBuilder + { + return new self(); + } + + /** + * Can supply second param to Client::__construct() when invoking manually or with dependency injection + */ + public function getEndpoint(): callable + { + return $this->endpoint; + } + + /** + * Can supply third param to Client::__construct() when invoking manually or with dependency injection + * + * @return NamespaceBuilderInterface[] + */ + public function getRegisteredNamespacesBuilders(): array + { + return $this->registeredNamespacesBuilders; + } + + /** + * Build a new client from the provided config. Hash keys + * should correspond to the method name e.g. ['connectionPool'] + * corresponds to setConnectionPool(). + * + * Missing keys will use the default for that setting if applicable + * + * Unknown keys will throw an exception by default, but this can be silenced + * by setting `quiet` to true + * + * @param array $config + * @param bool $quiet False if unknown settings throw exception, true to silently + * ignore unknown settings + * @throws \OpenSearch\Common\Exceptions\RuntimeException + */ + public static function fromConfig(array $config, bool $quiet = false): Client + { + $builder = new self(); + foreach ($config as $key => $value) { + $method = "set$key"; + $reflection = new ReflectionClass($builder); + if ($reflection->hasMethod($method)) { + $func = $reflection->getMethod($method); + if ($func->getNumberOfParameters() > 1) { + $builder->$method(...$value); + } else { + $builder->$method($value); + } + unset($config[$key]); + } + } + + if ($quiet === false && count($config) > 0) { + $unknown = implode(array_keys($config)); + throw new RuntimeException("Unknown parameters provided: $unknown"); + } + return $builder->build(); + } + + /** + * Set the endpoint + * + * @param callable $endpoint + */ + public function setEndpoint(callable $endpoint): ClientBuilder + { + $this->endpoint = $endpoint; + + return $this; + } + + /** + * Register namespace + * + * @param NamespaceBuilderInterface $namespaceBuilder + */ + public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder): ClientBuilder + { + $this->registeredNamespacesBuilders[] = $namespaceBuilder; + + return $this; + } + + /** + * Set the PSR-3 Logger + * + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): ClientBuilder + { + $this->logger = $logger; + + return $this; + } + + /** + * Set the hosts (nodes) + * + * @param array $hosts + */ + public function setHosts(array $hosts): ClientBuilder + { + $this->hosts = $hosts; + return $this; + } + + public function setBasicAuthentication(string $username, ?string $password = null): ClientBuilder + { + $this->basicAuthentication = array_filter([$username, $password]); + return $this; + } + + /** + * Set number or retries (default is equal to number of nodes) + * + * @param int $retries + */ + public function setRetries(int $retries): ClientBuilder + { + $this->retries = $retries; + return $this; + } + + /** + * Set SSL certificate + * + * @param string $cert The name of a file containing a PEM formatted certificate. + * @param string $password if the certificate requires a password + */ + public function setSSLCert(string $cert, ?string $password = null): ClientBuilder + { + $this->sslCert = [$cert, $password]; + return $this; + } + + /** + * Set SSL key + * + * @param string $key The name of a file containing a private SSL key + * @param string $password if the private key requires a password + */ + public function setSSLKey(string $key, ?string $password = null): ClientBuilder + { + $this->sslKey = [$key, $password]; + + return $this; + } + + /** + * Set SSL verification + * + * @param bool|string $value + * @return $this + */ + public function setSSLVerification(bool $value = true): ClientBuilder + { + $this->sslVerification = $value; + return $this; + } + + /** + * Build and returns the Client object + */ + public function build(): Client + { + $sslOptions = null; + if (isset($this->sslKey)) { + $sslOptions['ssl_key'] = $this->sslKey; + } + if (isset($this->sslCert)) { + $sslOptions['cert'] = $this->sslCert; + } + if (isset($this->sslVerification)) { + $sslOptions['verify'] = $this->sslVerification; + } + + if (!is_null($sslOptions)) { + $sslHandler = function (callable $handler, array $sslOptions) { + return function (array $request) use ($handler, $sslOptions) { + // Add our custom headers + foreach ($sslOptions as $key => $value) { + $request['client'][$key] = $value; + } + + // Send the request using the handler and return the response. + return $handler($request); + }; + }; + } + + $transport = $this->buildTransport(); + + if (is_null($this->endpoint)) { + + $this->endpoint = function ($class) { + $fullPath = '\\OpenSearch\\Endpoints\\' . $class; + + $reflection = new ReflectionClass($fullPath); + $constructor = $reflection->getConstructor(); + + if ($constructor && $constructor->getParameters()) { + return new $fullPath(new SmartSerializer()); + } + + return new $fullPath(); + }; + } + + $registeredNamespaces = []; + foreach ($this->registeredNamespacesBuilders as $builder) { + /** + * @var NamespaceBuilderInterface $builder + */ + $registeredNamespaces[$builder->getName()] = $builder->getObject($transport, new SmartSerializer()); + } + + return $this->instantiate($transport, $this->endpoint, $registeredNamespaces); + } + + protected function instantiate(Transport $transport, callable $endpoint, array $registeredNamespaces): Client + { + return new Client($transport, $endpoint, $registeredNamespaces); + } + + private function buildTransport(): Transport + { + $transport = TransportBuilder::create() + ->setHosts($this->hosts) + ->setLogger($this->logger) + ->build(); + + $transport->setUserAgent('opensearch-php', Client::VERSION); + + if ($this->basicAuthentication) { + $transport->setUserInfo(...$this->basicAuthentication); + } + + if ($this->retries) { + $transport->setRetries($this->retries); + } + + return new Transport($transport); + } +} diff --git a/src/OpenSearch/Common/EmptyLogger.php b/src/Common/EmptyLogger.php similarity index 98% rename from src/OpenSearch/Common/EmptyLogger.php rename to src/Common/EmptyLogger.php index c2bfeaf41..236edc168 100644 --- a/src/OpenSearch/Common/EmptyLogger.php +++ b/src/Common/EmptyLogger.php @@ -37,6 +37,5 @@ class EmptyLogger extends AbstractLogger implements LoggerInterface */ public function log($level, $message, array $context = []): void { - return; } } diff --git a/src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php b/src/Common/Exceptions/AuthenticationConfigException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/AuthenticationConfigException.php rename to src/Common/Exceptions/AuthenticationConfigException.php diff --git a/src/OpenSearch/Common/Exceptions/BadMethodCallException.php b/src/Common/Exceptions/BadMethodCallException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/BadMethodCallException.php rename to src/Common/Exceptions/BadMethodCallException.php diff --git a/src/OpenSearch/Common/Exceptions/BadRequest400Exception.php b/src/Common/Exceptions/BadRequest400Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/BadRequest400Exception.php rename to src/Common/Exceptions/BadRequest400Exception.php diff --git a/src/OpenSearch/Common/Exceptions/ClientErrorResponseException.php b/src/Common/Exceptions/ClientErrorResponseException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/ClientErrorResponseException.php rename to src/Common/Exceptions/ClientErrorResponseException.php diff --git a/src/OpenSearch/Common/Exceptions/Conflict409Exception.php b/src/Common/Exceptions/Conflict409Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Conflict409Exception.php rename to src/Common/Exceptions/Conflict409Exception.php diff --git a/src/OpenSearch/Common/Exceptions/Curl/CouldNotConnectToHost.php b/src/Common/Exceptions/Curl/CouldNotConnectToHost.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Curl/CouldNotConnectToHost.php rename to src/Common/Exceptions/Curl/CouldNotConnectToHost.php diff --git a/src/OpenSearch/Common/Exceptions/Curl/CouldNotResolveHostException.php b/src/Common/Exceptions/Curl/CouldNotResolveHostException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Curl/CouldNotResolveHostException.php rename to src/Common/Exceptions/Curl/CouldNotResolveHostException.php diff --git a/src/OpenSearch/Common/Exceptions/Curl/OperationTimeoutException.php b/src/Common/Exceptions/Curl/OperationTimeoutException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Curl/OperationTimeoutException.php rename to src/Common/Exceptions/Curl/OperationTimeoutException.php diff --git a/src/OpenSearch/Common/Exceptions/Forbidden403Exception.php b/src/Common/Exceptions/Forbidden403Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Forbidden403Exception.php rename to src/Common/Exceptions/Forbidden403Exception.php diff --git a/src/OpenSearch/Common/Exceptions/InvalidArgumentException.php b/src/Common/Exceptions/InvalidArgumentException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/InvalidArgumentException.php rename to src/Common/Exceptions/InvalidArgumentException.php diff --git a/src/OpenSearch/Common/Exceptions/MaxRetriesException.php b/src/Common/Exceptions/MaxRetriesException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/MaxRetriesException.php rename to src/Common/Exceptions/MaxRetriesException.php diff --git a/src/OpenSearch/Common/Exceptions/Missing404Exception.php b/src/Common/Exceptions/Missing404Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Missing404Exception.php rename to src/Common/Exceptions/Missing404Exception.php diff --git a/src/OpenSearch/Common/Exceptions/NoDocumentsToGetException.php b/src/Common/Exceptions/NoDocumentsToGetException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/NoDocumentsToGetException.php rename to src/Common/Exceptions/NoDocumentsToGetException.php diff --git a/src/OpenSearch/Common/Exceptions/NoNodesAvailableException.php b/src/Common/Exceptions/NoNodesAvailableException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/NoNodesAvailableException.php rename to src/Common/Exceptions/NoNodesAvailableException.php diff --git a/src/OpenSearch/Common/Exceptions/NoShardAvailableException.php b/src/Common/Exceptions/NoShardAvailableException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/NoShardAvailableException.php rename to src/Common/Exceptions/NoShardAvailableException.php diff --git a/src/OpenSearch/Common/Exceptions/OpenSearchException.php b/src/Common/Exceptions/OpenSearchException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/OpenSearchException.php rename to src/Common/Exceptions/OpenSearchException.php diff --git a/src/OpenSearch/Common/Exceptions/RequestTimeout408Exception.php b/src/Common/Exceptions/RequestTimeout408Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/RequestTimeout408Exception.php rename to src/Common/Exceptions/RequestTimeout408Exception.php diff --git a/src/OpenSearch/Common/Exceptions/RoutingMissingException.php b/src/Common/Exceptions/RoutingMissingException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/RoutingMissingException.php rename to src/Common/Exceptions/RoutingMissingException.php diff --git a/src/OpenSearch/Common/Exceptions/RuntimeException.php b/src/Common/Exceptions/RuntimeException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/RuntimeException.php rename to src/Common/Exceptions/RuntimeException.php diff --git a/src/OpenSearch/Common/Exceptions/ScriptLangNotSupportedException.php b/src/Common/Exceptions/ScriptLangNotSupportedException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/ScriptLangNotSupportedException.php rename to src/Common/Exceptions/ScriptLangNotSupportedException.php diff --git a/src/OpenSearch/Common/Exceptions/Serializer/JsonErrorException.php b/src/Common/Exceptions/Serializer/JsonErrorException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Serializer/JsonErrorException.php rename to src/Common/Exceptions/Serializer/JsonErrorException.php diff --git a/src/OpenSearch/Common/Exceptions/ServerErrorResponseException.php b/src/Common/Exceptions/ServerErrorResponseException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/ServerErrorResponseException.php rename to src/Common/Exceptions/ServerErrorResponseException.php diff --git a/src/OpenSearch/Common/Exceptions/TransportException.php b/src/Common/Exceptions/TransportException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/TransportException.php rename to src/Common/Exceptions/TransportException.php diff --git a/src/OpenSearch/Common/Exceptions/Unauthorized401Exception.php b/src/Common/Exceptions/Unauthorized401Exception.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/Unauthorized401Exception.php rename to src/Common/Exceptions/Unauthorized401Exception.php diff --git a/src/OpenSearch/Common/Exceptions/UnexpectedValueException.php b/src/Common/Exceptions/UnexpectedValueException.php similarity index 100% rename from src/OpenSearch/Common/Exceptions/UnexpectedValueException.php rename to src/Common/Exceptions/UnexpectedValueException.php diff --git a/src/OpenSearch/Endpoints/AbstractEndpoint.php b/src/Endpoints/AbstractEndpoint.php similarity index 99% rename from src/OpenSearch/Endpoints/AbstractEndpoint.php rename to src/Endpoints/AbstractEndpoint.php index 0b049daeb..08d696806 100644 --- a/src/OpenSearch/Endpoints/AbstractEndpoint.php +++ b/src/Endpoints/AbstractEndpoint.php @@ -23,7 +23,6 @@ use OpenSearch\Common\Exceptions\UnexpectedValueException; use OpenSearch\Serializers\SerializerInterface; - use function array_filter; abstract class AbstractEndpoint diff --git a/src/OpenSearch/Endpoints/AsyncSearch/Delete.php b/src/Endpoints/AsyncSearch/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/AsyncSearch/Delete.php rename to src/Endpoints/AsyncSearch/Delete.php diff --git a/src/OpenSearch/Endpoints/AsyncSearch/Get.php b/src/Endpoints/AsyncSearch/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/AsyncSearch/Get.php rename to src/Endpoints/AsyncSearch/Get.php diff --git a/src/OpenSearch/Endpoints/AsyncSearch/Submit.php b/src/Endpoints/AsyncSearch/Submit.php similarity index 100% rename from src/OpenSearch/Endpoints/AsyncSearch/Submit.php rename to src/Endpoints/AsyncSearch/Submit.php diff --git a/src/OpenSearch/Endpoints/Bulk.php b/src/Endpoints/Bulk.php similarity index 98% rename from src/OpenSearch/Endpoints/Bulk.php rename to src/Endpoints/Bulk.php index 6376a6fb6..8e8f0d04f 100644 --- a/src/OpenSearch/Endpoints/Bulk.php +++ b/src/Endpoints/Bulk.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\InvalidArgumentException; -use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Serializers\SerializerInterface; use Traversable; diff --git a/src/OpenSearch/Endpoints/Cat/Aliases.php b/src/Endpoints/Cat/Aliases.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Aliases.php rename to src/Endpoints/Cat/Aliases.php diff --git a/src/OpenSearch/Endpoints/Cat/AllPitSegments.php b/src/Endpoints/Cat/AllPitSegments.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/AllPitSegments.php rename to src/Endpoints/Cat/AllPitSegments.php diff --git a/src/OpenSearch/Endpoints/Cat/Allocation.php b/src/Endpoints/Cat/Allocation.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Allocation.php rename to src/Endpoints/Cat/Allocation.php diff --git a/src/OpenSearch/Endpoints/Cat/ClusterManager.php b/src/Endpoints/Cat/ClusterManager.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/ClusterManager.php rename to src/Endpoints/Cat/ClusterManager.php diff --git a/src/OpenSearch/Endpoints/Cat/Count.php b/src/Endpoints/Cat/Count.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Count.php rename to src/Endpoints/Cat/Count.php diff --git a/src/OpenSearch/Endpoints/Cat/Fielddata.php b/src/Endpoints/Cat/Fielddata.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Fielddata.php rename to src/Endpoints/Cat/Fielddata.php diff --git a/src/OpenSearch/Endpoints/Cat/Health.php b/src/Endpoints/Cat/Health.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Health.php rename to src/Endpoints/Cat/Health.php diff --git a/src/OpenSearch/Endpoints/Cat/Help.php b/src/Endpoints/Cat/Help.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Help.php rename to src/Endpoints/Cat/Help.php diff --git a/src/OpenSearch/Endpoints/Cat/Indices.php b/src/Endpoints/Cat/Indices.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Indices.php rename to src/Endpoints/Cat/Indices.php diff --git a/src/OpenSearch/Endpoints/Cat/Master.php b/src/Endpoints/Cat/Master.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Master.php rename to src/Endpoints/Cat/Master.php diff --git a/src/OpenSearch/Endpoints/Cat/NodeAttrs.php b/src/Endpoints/Cat/NodeAttrs.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/NodeAttrs.php rename to src/Endpoints/Cat/NodeAttrs.php diff --git a/src/OpenSearch/Endpoints/Cat/Nodes.php b/src/Endpoints/Cat/Nodes.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Nodes.php rename to src/Endpoints/Cat/Nodes.php diff --git a/src/OpenSearch/Endpoints/Cat/PendingTasks.php b/src/Endpoints/Cat/PendingTasks.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/PendingTasks.php rename to src/Endpoints/Cat/PendingTasks.php diff --git a/src/OpenSearch/Endpoints/Cat/PitSegments.php b/src/Endpoints/Cat/PitSegments.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/PitSegments.php rename to src/Endpoints/Cat/PitSegments.php diff --git a/src/OpenSearch/Endpoints/Cat/Plugins.php b/src/Endpoints/Cat/Plugins.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Plugins.php rename to src/Endpoints/Cat/Plugins.php diff --git a/src/OpenSearch/Endpoints/Cat/Recovery.php b/src/Endpoints/Cat/Recovery.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Recovery.php rename to src/Endpoints/Cat/Recovery.php diff --git a/src/OpenSearch/Endpoints/Cat/Repositories.php b/src/Endpoints/Cat/Repositories.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Repositories.php rename to src/Endpoints/Cat/Repositories.php diff --git a/src/OpenSearch/Endpoints/Cat/SegmentReplication.php b/src/Endpoints/Cat/SegmentReplication.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/SegmentReplication.php rename to src/Endpoints/Cat/SegmentReplication.php diff --git a/src/OpenSearch/Endpoints/Cat/Segments.php b/src/Endpoints/Cat/Segments.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Segments.php rename to src/Endpoints/Cat/Segments.php diff --git a/src/OpenSearch/Endpoints/Cat/Shards.php b/src/Endpoints/Cat/Shards.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Shards.php rename to src/Endpoints/Cat/Shards.php diff --git a/src/OpenSearch/Endpoints/Cat/Snapshots.php b/src/Endpoints/Cat/Snapshots.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Snapshots.php rename to src/Endpoints/Cat/Snapshots.php diff --git a/src/OpenSearch/Endpoints/Cat/Tasks.php b/src/Endpoints/Cat/Tasks.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Tasks.php rename to src/Endpoints/Cat/Tasks.php diff --git a/src/OpenSearch/Endpoints/Cat/Templates.php b/src/Endpoints/Cat/Templates.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/Templates.php rename to src/Endpoints/Cat/Templates.php diff --git a/src/OpenSearch/Endpoints/Cat/ThreadPool.php b/src/Endpoints/Cat/ThreadPool.php similarity index 100% rename from src/OpenSearch/Endpoints/Cat/ThreadPool.php rename to src/Endpoints/Cat/ThreadPool.php diff --git a/src/OpenSearch/Endpoints/ClearScroll.php b/src/Endpoints/ClearScroll.php similarity index 97% rename from src/OpenSearch/Endpoints/ClearScroll.php rename to src/Endpoints/ClearScroll.php index 190e9be52..0fe46060c 100644 --- a/src/OpenSearch/Endpoints/ClearScroll.php +++ b/src/Endpoints/ClearScroll.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Cluster/AllocationExplain.php b/src/Endpoints/Cluster/AllocationExplain.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/AllocationExplain.php rename to src/Endpoints/Cluster/AllocationExplain.php diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php b/src/Endpoints/Cluster/DeleteComponentTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/DeleteComponentTemplate.php rename to src/Endpoints/Cluster/DeleteComponentTemplate.php diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteDecommissionAwareness.php b/src/Endpoints/Cluster/DeleteDecommissionAwareness.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/DeleteDecommissionAwareness.php rename to src/Endpoints/Cluster/DeleteDecommissionAwareness.php diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php b/src/Endpoints/Cluster/DeleteVotingConfigExclusions.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/DeleteVotingConfigExclusions.php rename to src/Endpoints/Cluster/DeleteVotingConfigExclusions.php diff --git a/src/OpenSearch/Endpoints/Cluster/DeleteWeightedRouting.php b/src/Endpoints/Cluster/DeleteWeightedRouting.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/DeleteWeightedRouting.php rename to src/Endpoints/Cluster/DeleteWeightedRouting.php diff --git a/src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php b/src/Endpoints/Cluster/ExistsComponentTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/ExistsComponentTemplate.php rename to src/Endpoints/Cluster/ExistsComponentTemplate.php diff --git a/src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php b/src/Endpoints/Cluster/GetComponentTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/GetComponentTemplate.php rename to src/Endpoints/Cluster/GetComponentTemplate.php diff --git a/src/OpenSearch/Endpoints/Cluster/GetDecommissionAwareness.php b/src/Endpoints/Cluster/GetDecommissionAwareness.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/GetDecommissionAwareness.php rename to src/Endpoints/Cluster/GetDecommissionAwareness.php diff --git a/src/OpenSearch/Endpoints/Cluster/GetSettings.php b/src/Endpoints/Cluster/GetSettings.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/GetSettings.php rename to src/Endpoints/Cluster/GetSettings.php diff --git a/src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php b/src/Endpoints/Cluster/GetWeightedRouting.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/GetWeightedRouting.php rename to src/Endpoints/Cluster/GetWeightedRouting.php diff --git a/src/OpenSearch/Endpoints/Cluster/Health.php b/src/Endpoints/Cluster/Health.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/Health.php rename to src/Endpoints/Cluster/Health.php diff --git a/src/OpenSearch/Endpoints/Cluster/PendingTasks.php b/src/Endpoints/Cluster/PendingTasks.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PendingTasks.php rename to src/Endpoints/Cluster/PendingTasks.php diff --git a/src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php b/src/Endpoints/Cluster/PostVotingConfigExclusions.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PostVotingConfigExclusions.php rename to src/Endpoints/Cluster/PostVotingConfigExclusions.php diff --git a/src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php b/src/Endpoints/Cluster/PutComponentTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PutComponentTemplate.php rename to src/Endpoints/Cluster/PutComponentTemplate.php diff --git a/src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php b/src/Endpoints/Cluster/PutDecommissionAwareness.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PutDecommissionAwareness.php rename to src/Endpoints/Cluster/PutDecommissionAwareness.php diff --git a/src/OpenSearch/Endpoints/Cluster/PutSettings.php b/src/Endpoints/Cluster/PutSettings.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PutSettings.php rename to src/Endpoints/Cluster/PutSettings.php diff --git a/src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php b/src/Endpoints/Cluster/PutWeightedRouting.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/PutWeightedRouting.php rename to src/Endpoints/Cluster/PutWeightedRouting.php diff --git a/src/OpenSearch/Endpoints/Cluster/RemoteInfo.php b/src/Endpoints/Cluster/RemoteInfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/RemoteInfo.php rename to src/Endpoints/Cluster/RemoteInfo.php diff --git a/src/OpenSearch/Endpoints/Cluster/Reroute.php b/src/Endpoints/Cluster/Reroute.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/Reroute.php rename to src/Endpoints/Cluster/Reroute.php diff --git a/src/OpenSearch/Endpoints/Cluster/State.php b/src/Endpoints/Cluster/State.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/State.php rename to src/Endpoints/Cluster/State.php diff --git a/src/OpenSearch/Endpoints/Cluster/Stats.php b/src/Endpoints/Cluster/Stats.php similarity index 100% rename from src/OpenSearch/Endpoints/Cluster/Stats.php rename to src/Endpoints/Cluster/Stats.php diff --git a/src/OpenSearch/Endpoints/Count.php b/src/Endpoints/Count.php similarity index 97% rename from src/OpenSearch/Endpoints/Count.php rename to src/Endpoints/Count.php index 43abf6b74..4a352974a 100644 --- a/src/OpenSearch/Endpoints/Count.php +++ b/src/Endpoints/Count.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Create.php b/src/Endpoints/Create.php similarity index 97% rename from src/OpenSearch/Endpoints/Create.php rename to src/Endpoints/Create.php index 9fd7b60b9..acf640078 100644 --- a/src/OpenSearch/Endpoints/Create.php +++ b/src/Endpoints/Create.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/CreatePit.php b/src/Endpoints/CreatePit.php similarity index 96% rename from src/OpenSearch/Endpoints/CreatePit.php rename to src/Endpoints/CreatePit.php index 5bebbb454..315bc4914 100644 --- a/src/OpenSearch/Endpoints/CreatePit.php +++ b/src/Endpoints/CreatePit.php @@ -16,7 +16,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/DanglingIndices/DeleteDanglingIndex.php b/src/Endpoints/DanglingIndices/DeleteDanglingIndex.php similarity index 100% rename from src/OpenSearch/Endpoints/DanglingIndices/DeleteDanglingIndex.php rename to src/Endpoints/DanglingIndices/DeleteDanglingIndex.php diff --git a/src/OpenSearch/Endpoints/DanglingIndices/ImportDanglingIndex.php b/src/Endpoints/DanglingIndices/ImportDanglingIndex.php similarity index 100% rename from src/OpenSearch/Endpoints/DanglingIndices/ImportDanglingIndex.php rename to src/Endpoints/DanglingIndices/ImportDanglingIndex.php diff --git a/src/OpenSearch/Endpoints/DanglingIndices/ListDanglingIndices.php b/src/Endpoints/DanglingIndices/ListDanglingIndices.php similarity index 100% rename from src/OpenSearch/Endpoints/DanglingIndices/ListDanglingIndices.php rename to src/Endpoints/DanglingIndices/ListDanglingIndices.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/DeleteTransform.php b/src/Endpoints/DataFrameTransformDeprecated/DeleteTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/DeleteTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/DeleteTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransform.php b/src/Endpoints/DataFrameTransformDeprecated/GetTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/GetTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php b/src/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php rename to src/Endpoints/DataFrameTransformDeprecated/GetTransformStats.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php b/src/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/PreviewTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PutTransform.php b/src/Endpoints/DataFrameTransformDeprecated/PutTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/PutTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/PutTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StartTransform.php b/src/Endpoints/DataFrameTransformDeprecated/StartTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StartTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/StartTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StopTransform.php b/src/Endpoints/DataFrameTransformDeprecated/StopTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/StopTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/StopTransform.php diff --git a/src/OpenSearch/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php b/src/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php similarity index 100% rename from src/OpenSearch/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php rename to src/Endpoints/DataFrameTransformDeprecated/UpdateTransform.php diff --git a/src/OpenSearch/Endpoints/Delete.php b/src/Endpoints/Delete.php similarity index 97% rename from src/OpenSearch/Endpoints/Delete.php rename to src/Endpoints/Delete.php index 8ef0db8db..e7b20fee7 100644 --- a/src/OpenSearch/Endpoints/Delete.php +++ b/src/Endpoints/Delete.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/DeleteAllPits.php b/src/Endpoints/DeleteAllPits.php similarity index 95% rename from src/OpenSearch/Endpoints/DeleteAllPits.php rename to src/Endpoints/DeleteAllPits.php index 14360cfce..92b2886cc 100644 --- a/src/OpenSearch/Endpoints/DeleteAllPits.php +++ b/src/Endpoints/DeleteAllPits.php @@ -15,8 +15,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/DeleteByQuery.php b/src/Endpoints/DeleteByQuery.php similarity index 98% rename from src/OpenSearch/Endpoints/DeleteByQuery.php rename to src/Endpoints/DeleteByQuery.php index cbcf95eb4..faa9445c3 100644 --- a/src/OpenSearch/Endpoints/DeleteByQuery.php +++ b/src/Endpoints/DeleteByQuery.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php b/src/Endpoints/DeleteByQueryRethrottle.php similarity index 97% rename from src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php rename to src/Endpoints/DeleteByQueryRethrottle.php index a8cab68c9..8704dd728 100644 --- a/src/OpenSearch/Endpoints/DeleteByQueryRethrottle.php +++ b/src/Endpoints/DeleteByQueryRethrottle.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/DeletePit.php b/src/Endpoints/DeletePit.php similarity index 95% rename from src/OpenSearch/Endpoints/DeletePit.php rename to src/Endpoints/DeletePit.php index df9768d35..8421e55b3 100644 --- a/src/OpenSearch/Endpoints/DeletePit.php +++ b/src/Endpoints/DeletePit.php @@ -15,8 +15,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/DeleteScript.php b/src/Endpoints/DeleteScript.php similarity index 97% rename from src/OpenSearch/Endpoints/DeleteScript.php rename to src/Endpoints/DeleteScript.php index 36d3bfd7c..81662fbe2 100644 --- a/src/OpenSearch/Endpoints/DeleteScript.php +++ b/src/Endpoints/DeleteScript.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Exists.php b/src/Endpoints/Exists.php similarity index 97% rename from src/OpenSearch/Endpoints/Exists.php rename to src/Endpoints/Exists.php index be7f3a4c6..3777d6ed8 100644 --- a/src/OpenSearch/Endpoints/Exists.php +++ b/src/Endpoints/Exists.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/ExistsSource.php b/src/Endpoints/ExistsSource.php similarity index 97% rename from src/OpenSearch/Endpoints/ExistsSource.php rename to src/Endpoints/ExistsSource.php index 7d2b9e7f1..16afc11dd 100644 --- a/src/OpenSearch/Endpoints/ExistsSource.php +++ b/src/Endpoints/ExistsSource.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Explain.php b/src/Endpoints/Explain.php similarity index 98% rename from src/OpenSearch/Endpoints/Explain.php rename to src/Endpoints/Explain.php index cf5a6f1c2..6fbb306be 100644 --- a/src/OpenSearch/Endpoints/Explain.php +++ b/src/Endpoints/Explain.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/FieldCaps.php b/src/Endpoints/FieldCaps.php similarity index 97% rename from src/OpenSearch/Endpoints/FieldCaps.php rename to src/Endpoints/FieldCaps.php index 93cd37492..245ae13fa 100644 --- a/src/OpenSearch/Endpoints/FieldCaps.php +++ b/src/Endpoints/FieldCaps.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Get.php b/src/Endpoints/Get.php similarity index 97% rename from src/OpenSearch/Endpoints/Get.php rename to src/Endpoints/Get.php index dce7661a2..cc1161bcf 100644 --- a/src/OpenSearch/Endpoints/Get.php +++ b/src/Endpoints/Get.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/GetAllPits.php b/src/Endpoints/GetAllPits.php similarity index 95% rename from src/OpenSearch/Endpoints/GetAllPits.php rename to src/Endpoints/GetAllPits.php index 6301d6746..460df80bc 100644 --- a/src/OpenSearch/Endpoints/GetAllPits.php +++ b/src/Endpoints/GetAllPits.php @@ -15,8 +15,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/GetScript.php b/src/Endpoints/GetScript.php similarity index 97% rename from src/OpenSearch/Endpoints/GetScript.php rename to src/Endpoints/GetScript.php index eb9ee4ad2..6cc755005 100644 --- a/src/OpenSearch/Endpoints/GetScript.php +++ b/src/Endpoints/GetScript.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/GetScriptContext.php b/src/Endpoints/GetScriptContext.php similarity index 96% rename from src/OpenSearch/Endpoints/GetScriptContext.php rename to src/Endpoints/GetScriptContext.php index 325c5d320..270c440a2 100644 --- a/src/OpenSearch/Endpoints/GetScriptContext.php +++ b/src/Endpoints/GetScriptContext.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/GetScriptLanguages.php b/src/Endpoints/GetScriptLanguages.php similarity index 96% rename from src/OpenSearch/Endpoints/GetScriptLanguages.php rename to src/Endpoints/GetScriptLanguages.php index bf4620d6f..0dcd610f2 100644 --- a/src/OpenSearch/Endpoints/GetScriptLanguages.php +++ b/src/Endpoints/GetScriptLanguages.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/GetSource.php b/src/Endpoints/GetSource.php similarity index 97% rename from src/OpenSearch/Endpoints/GetSource.php rename to src/Endpoints/GetSource.php index 5ee7df939..440c0d5c8 100644 --- a/src/OpenSearch/Endpoints/GetSource.php +++ b/src/Endpoints/GetSource.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Index.php b/src/Endpoints/Index.php similarity index 97% rename from src/OpenSearch/Endpoints/Index.php rename to src/Endpoints/Index.php index abeecc314..9b1f1515d 100644 --- a/src/OpenSearch/Endpoints/Index.php +++ b/src/Endpoints/Index.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Indices/AddBlock.php b/src/Endpoints/Indices/AddBlock.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/AddBlock.php rename to src/Endpoints/Indices/AddBlock.php diff --git a/src/OpenSearch/Endpoints/Indices/Analyze.php b/src/Endpoints/Indices/Analyze.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Analyze.php rename to src/Endpoints/Indices/Analyze.php diff --git a/src/OpenSearch/Endpoints/Indices/ClearCache.php b/src/Endpoints/Indices/ClearCache.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ClearCache.php rename to src/Endpoints/Indices/ClearCache.php diff --git a/src/OpenSearch/Endpoints/Indices/CloneIndices.php b/src/Endpoints/Indices/CloneIndices.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/CloneIndices.php rename to src/Endpoints/Indices/CloneIndices.php diff --git a/src/OpenSearch/Endpoints/Indices/Close.php b/src/Endpoints/Indices/Close.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Close.php rename to src/Endpoints/Indices/Close.php diff --git a/src/OpenSearch/Endpoints/Indices/Create.php b/src/Endpoints/Indices/Create.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Create.php rename to src/Endpoints/Indices/Create.php diff --git a/src/OpenSearch/Endpoints/Indices/CreateDataStream.php b/src/Endpoints/Indices/CreateDataStream.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/CreateDataStream.php rename to src/Endpoints/Indices/CreateDataStream.php diff --git a/src/OpenSearch/Endpoints/Indices/DataStreamsStats.php b/src/Endpoints/Indices/DataStreamsStats.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/DataStreamsStats.php rename to src/Endpoints/Indices/DataStreamsStats.php diff --git a/src/OpenSearch/Endpoints/Indices/Delete.php b/src/Endpoints/Indices/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Delete.php rename to src/Endpoints/Indices/Delete.php diff --git a/src/OpenSearch/Endpoints/Indices/DeleteAlias.php b/src/Endpoints/Indices/DeleteAlias.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/DeleteAlias.php rename to src/Endpoints/Indices/DeleteAlias.php diff --git a/src/OpenSearch/Endpoints/Indices/DeleteDataStream.php b/src/Endpoints/Indices/DeleteDataStream.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/DeleteDataStream.php rename to src/Endpoints/Indices/DeleteDataStream.php diff --git a/src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php b/src/Endpoints/Indices/DeleteIndexTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/DeleteIndexTemplate.php rename to src/Endpoints/Indices/DeleteIndexTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/DeleteTemplate.php b/src/Endpoints/Indices/DeleteTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/DeleteTemplate.php rename to src/Endpoints/Indices/DeleteTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/Exists.php b/src/Endpoints/Indices/Exists.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Exists.php rename to src/Endpoints/Indices/Exists.php diff --git a/src/OpenSearch/Endpoints/Indices/ExistsAlias.php b/src/Endpoints/Indices/ExistsAlias.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ExistsAlias.php rename to src/Endpoints/Indices/ExistsAlias.php diff --git a/src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php b/src/Endpoints/Indices/ExistsIndexTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ExistsIndexTemplate.php rename to src/Endpoints/Indices/ExistsIndexTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/ExistsTemplate.php b/src/Endpoints/Indices/ExistsTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ExistsTemplate.php rename to src/Endpoints/Indices/ExistsTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/Flush.php b/src/Endpoints/Indices/Flush.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Flush.php rename to src/Endpoints/Indices/Flush.php diff --git a/src/OpenSearch/Endpoints/Indices/ForceMerge.php b/src/Endpoints/Indices/ForceMerge.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ForceMerge.php rename to src/Endpoints/Indices/ForceMerge.php diff --git a/src/OpenSearch/Endpoints/Indices/Get.php b/src/Endpoints/Indices/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Get.php rename to src/Endpoints/Indices/Get.php diff --git a/src/OpenSearch/Endpoints/Indices/GetAlias.php b/src/Endpoints/Indices/GetAlias.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetAlias.php rename to src/Endpoints/Indices/GetAlias.php diff --git a/src/OpenSearch/Endpoints/Indices/GetDataStream.php b/src/Endpoints/Indices/GetDataStream.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetDataStream.php rename to src/Endpoints/Indices/GetDataStream.php diff --git a/src/OpenSearch/Endpoints/Indices/GetFieldMapping.php b/src/Endpoints/Indices/GetFieldMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetFieldMapping.php rename to src/Endpoints/Indices/GetFieldMapping.php diff --git a/src/OpenSearch/Endpoints/Indices/GetIndexTemplate.php b/src/Endpoints/Indices/GetIndexTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetIndexTemplate.php rename to src/Endpoints/Indices/GetIndexTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/GetMapping.php b/src/Endpoints/Indices/GetMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetMapping.php rename to src/Endpoints/Indices/GetMapping.php diff --git a/src/OpenSearch/Endpoints/Indices/GetSettings.php b/src/Endpoints/Indices/GetSettings.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetSettings.php rename to src/Endpoints/Indices/GetSettings.php diff --git a/src/OpenSearch/Endpoints/Indices/GetTemplate.php b/src/Endpoints/Indices/GetTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetTemplate.php rename to src/Endpoints/Indices/GetTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/GetUpgrade.php b/src/Endpoints/Indices/GetUpgrade.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/GetUpgrade.php rename to src/Endpoints/Indices/GetUpgrade.php diff --git a/src/OpenSearch/Endpoints/Indices/Open.php b/src/Endpoints/Indices/Open.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Open.php rename to src/Endpoints/Indices/Open.php diff --git a/src/OpenSearch/Endpoints/Indices/PutAlias.php b/src/Endpoints/Indices/PutAlias.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/PutAlias.php rename to src/Endpoints/Indices/PutAlias.php diff --git a/src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php b/src/Endpoints/Indices/PutIndexTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/PutIndexTemplate.php rename to src/Endpoints/Indices/PutIndexTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/PutMapping.php b/src/Endpoints/Indices/PutMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/PutMapping.php rename to src/Endpoints/Indices/PutMapping.php diff --git a/src/OpenSearch/Endpoints/Indices/PutSettings.php b/src/Endpoints/Indices/PutSettings.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/PutSettings.php rename to src/Endpoints/Indices/PutSettings.php diff --git a/src/OpenSearch/Endpoints/Indices/PutTemplate.php b/src/Endpoints/Indices/PutTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/PutTemplate.php rename to src/Endpoints/Indices/PutTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/Recovery.php b/src/Endpoints/Indices/Recovery.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Recovery.php rename to src/Endpoints/Indices/Recovery.php diff --git a/src/OpenSearch/Endpoints/Indices/Refresh.php b/src/Endpoints/Indices/Refresh.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Refresh.php rename to src/Endpoints/Indices/Refresh.php diff --git a/src/OpenSearch/Endpoints/Indices/RefreshSearchAnalyzers.php b/src/Endpoints/Indices/RefreshSearchAnalyzers.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/RefreshSearchAnalyzers.php rename to src/Endpoints/Indices/RefreshSearchAnalyzers.php diff --git a/src/OpenSearch/Endpoints/Indices/ResolveIndex.php b/src/Endpoints/Indices/ResolveIndex.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ResolveIndex.php rename to src/Endpoints/Indices/ResolveIndex.php diff --git a/src/OpenSearch/Endpoints/Indices/Rollover.php b/src/Endpoints/Indices/Rollover.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Rollover.php rename to src/Endpoints/Indices/Rollover.php diff --git a/src/OpenSearch/Endpoints/Indices/Segments.php b/src/Endpoints/Indices/Segments.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Segments.php rename to src/Endpoints/Indices/Segments.php diff --git a/src/OpenSearch/Endpoints/Indices/ShardStores.php b/src/Endpoints/Indices/ShardStores.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ShardStores.php rename to src/Endpoints/Indices/ShardStores.php diff --git a/src/OpenSearch/Endpoints/Indices/Shrink.php b/src/Endpoints/Indices/Shrink.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Shrink.php rename to src/Endpoints/Indices/Shrink.php diff --git a/src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php b/src/Endpoints/Indices/SimulateIndexTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/SimulateIndexTemplate.php rename to src/Endpoints/Indices/SimulateIndexTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/SimulateTemplate.php b/src/Endpoints/Indices/SimulateTemplate.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/SimulateTemplate.php rename to src/Endpoints/Indices/SimulateTemplate.php diff --git a/src/OpenSearch/Endpoints/Indices/Split.php b/src/Endpoints/Indices/Split.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Split.php rename to src/Endpoints/Indices/Split.php diff --git a/src/OpenSearch/Endpoints/Indices/Stats.php b/src/Endpoints/Indices/Stats.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Stats.php rename to src/Endpoints/Indices/Stats.php diff --git a/src/OpenSearch/Endpoints/Indices/UpdateAliases.php b/src/Endpoints/Indices/UpdateAliases.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/UpdateAliases.php rename to src/Endpoints/Indices/UpdateAliases.php diff --git a/src/OpenSearch/Endpoints/Indices/Upgrade.php b/src/Endpoints/Indices/Upgrade.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/Upgrade.php rename to src/Endpoints/Indices/Upgrade.php diff --git a/src/OpenSearch/Endpoints/Indices/ValidateQuery.php b/src/Endpoints/Indices/ValidateQuery.php similarity index 100% rename from src/OpenSearch/Endpoints/Indices/ValidateQuery.php rename to src/Endpoints/Indices/ValidateQuery.php diff --git a/src/OpenSearch/Endpoints/Info.php b/src/Endpoints/Info.php similarity index 96% rename from src/OpenSearch/Endpoints/Info.php rename to src/Endpoints/Info.php index 91b529a2f..136011ef6 100644 --- a/src/OpenSearch/Endpoints/Info.php +++ b/src/Endpoints/Info.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Ingest/DeletePipeline.php b/src/Endpoints/Ingest/DeletePipeline.php similarity index 100% rename from src/OpenSearch/Endpoints/Ingest/DeletePipeline.php rename to src/Endpoints/Ingest/DeletePipeline.php diff --git a/src/OpenSearch/Endpoints/Ingest/GetPipeline.php b/src/Endpoints/Ingest/GetPipeline.php similarity index 100% rename from src/OpenSearch/Endpoints/Ingest/GetPipeline.php rename to src/Endpoints/Ingest/GetPipeline.php diff --git a/src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php b/src/Endpoints/Ingest/ProcessorGrok.php similarity index 100% rename from src/OpenSearch/Endpoints/Ingest/ProcessorGrok.php rename to src/Endpoints/Ingest/ProcessorGrok.php diff --git a/src/OpenSearch/Endpoints/Ingest/PutPipeline.php b/src/Endpoints/Ingest/PutPipeline.php similarity index 100% rename from src/OpenSearch/Endpoints/Ingest/PutPipeline.php rename to src/Endpoints/Ingest/PutPipeline.php diff --git a/src/OpenSearch/Endpoints/Ingest/Simulate.php b/src/Endpoints/Ingest/Simulate.php similarity index 100% rename from src/OpenSearch/Endpoints/Ingest/Simulate.php rename to src/Endpoints/Ingest/Simulate.php diff --git a/src/OpenSearch/Endpoints/Knn/DeleteModel.php b/src/Endpoints/Knn/DeleteModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/DeleteModel.php rename to src/Endpoints/Knn/DeleteModel.php diff --git a/src/OpenSearch/Endpoints/Knn/GetModel.php b/src/Endpoints/Knn/GetModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/GetModel.php rename to src/Endpoints/Knn/GetModel.php diff --git a/src/OpenSearch/Endpoints/Knn/SearchModels.php b/src/Endpoints/Knn/SearchModels.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/SearchModels.php rename to src/Endpoints/Knn/SearchModels.php diff --git a/src/OpenSearch/Endpoints/Knn/Stats.php b/src/Endpoints/Knn/Stats.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/Stats.php rename to src/Endpoints/Knn/Stats.php diff --git a/src/OpenSearch/Endpoints/Knn/TrainModel.php b/src/Endpoints/Knn/TrainModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/TrainModel.php rename to src/Endpoints/Knn/TrainModel.php diff --git a/src/OpenSearch/Endpoints/Knn/Warmup.php b/src/Endpoints/Knn/Warmup.php similarity index 100% rename from src/OpenSearch/Endpoints/Knn/Warmup.php rename to src/Endpoints/Knn/Warmup.php diff --git a/src/OpenSearch/Endpoints/MTermVectors.php b/src/Endpoints/MTermVectors.php similarity index 97% rename from src/OpenSearch/Endpoints/MTermVectors.php rename to src/Endpoints/MTermVectors.php index 11afa11e9..195d78b01 100644 --- a/src/OpenSearch/Endpoints/MTermVectors.php +++ b/src/Endpoints/MTermVectors.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Mget.php b/src/Endpoints/Mget.php similarity index 97% rename from src/OpenSearch/Endpoints/Mget.php rename to src/Endpoints/Mget.php index e1a57615b..97c2316c6 100644 --- a/src/OpenSearch/Endpoints/Mget.php +++ b/src/Endpoints/Mget.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Ml/CreateConnector.php b/src/Endpoints/Ml/CreateConnector.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/CreateConnector.php rename to src/Endpoints/Ml/CreateConnector.php diff --git a/src/OpenSearch/Endpoints/Ml/DeleteConnector.php b/src/Endpoints/Ml/DeleteConnector.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/DeleteConnector.php rename to src/Endpoints/Ml/DeleteConnector.php diff --git a/src/OpenSearch/Endpoints/Ml/DeleteModel.php b/src/Endpoints/Ml/DeleteModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/DeleteModel.php rename to src/Endpoints/Ml/DeleteModel.php diff --git a/src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php b/src/Endpoints/Ml/DeleteModelGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/DeleteModelGroup.php rename to src/Endpoints/Ml/DeleteModelGroup.php diff --git a/src/OpenSearch/Endpoints/Ml/DeployModel.php b/src/Endpoints/Ml/DeployModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/DeployModel.php rename to src/Endpoints/Ml/DeployModel.php diff --git a/src/OpenSearch/Endpoints/Ml/GetConnector.php b/src/Endpoints/Ml/GetConnector.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetConnector.php rename to src/Endpoints/Ml/GetConnector.php diff --git a/src/OpenSearch/Endpoints/Ml/GetConnectors.php b/src/Endpoints/Ml/GetConnectors.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetConnectors.php rename to src/Endpoints/Ml/GetConnectors.php diff --git a/src/OpenSearch/Endpoints/Ml/GetModel.php b/src/Endpoints/Ml/GetModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetModel.php rename to src/Endpoints/Ml/GetModel.php diff --git a/src/OpenSearch/Endpoints/Ml/GetModelGroup.php b/src/Endpoints/Ml/GetModelGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetModelGroup.php rename to src/Endpoints/Ml/GetModelGroup.php diff --git a/src/OpenSearch/Endpoints/Ml/GetModelGroups.php b/src/Endpoints/Ml/GetModelGroups.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetModelGroups.php rename to src/Endpoints/Ml/GetModelGroups.php diff --git a/src/OpenSearch/Endpoints/Ml/GetTask.php b/src/Endpoints/Ml/GetTask.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/GetTask.php rename to src/Endpoints/Ml/GetTask.php diff --git a/src/OpenSearch/Endpoints/Ml/Predict.php b/src/Endpoints/Ml/Predict.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/Predict.php rename to src/Endpoints/Ml/Predict.php diff --git a/src/OpenSearch/Endpoints/Ml/RegisterModel.php b/src/Endpoints/Ml/RegisterModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/RegisterModel.php rename to src/Endpoints/Ml/RegisterModel.php diff --git a/src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php b/src/Endpoints/Ml/RegisterModelGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/RegisterModelGroup.php rename to src/Endpoints/Ml/RegisterModelGroup.php diff --git a/src/OpenSearch/Endpoints/Ml/SearchModels.php b/src/Endpoints/Ml/SearchModels.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/SearchModels.php rename to src/Endpoints/Ml/SearchModels.php diff --git a/src/OpenSearch/Endpoints/Ml/UndeployModel.php b/src/Endpoints/Ml/UndeployModel.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/UndeployModel.php rename to src/Endpoints/Ml/UndeployModel.php diff --git a/src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php b/src/Endpoints/Ml/UpdateModelGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Ml/UpdateModelGroup.php rename to src/Endpoints/Ml/UpdateModelGroup.php diff --git a/src/OpenSearch/Endpoints/Monitoring/Bulk.php b/src/Endpoints/Monitoring/Bulk.php similarity index 100% rename from src/OpenSearch/Endpoints/Monitoring/Bulk.php rename to src/Endpoints/Monitoring/Bulk.php diff --git a/src/OpenSearch/Endpoints/Msearch.php b/src/Endpoints/Msearch.php similarity index 98% rename from src/OpenSearch/Endpoints/Msearch.php rename to src/Endpoints/Msearch.php index e2a5fb6e1..ef05b5fae 100644 --- a/src/OpenSearch/Endpoints/Msearch.php +++ b/src/Endpoints/Msearch.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\InvalidArgumentException; -use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Serializers\SerializerInterface; use Traversable; diff --git a/src/OpenSearch/Endpoints/MsearchTemplate.php b/src/Endpoints/MsearchTemplate.php similarity index 98% rename from src/OpenSearch/Endpoints/MsearchTemplate.php rename to src/Endpoints/MsearchTemplate.php index 560c62d8f..0f1edf859 100644 --- a/src/OpenSearch/Endpoints/MsearchTemplate.php +++ b/src/Endpoints/MsearchTemplate.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\InvalidArgumentException; -use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Serializers\SerializerInterface; use Traversable; diff --git a/src/OpenSearch/Endpoints/Nodes/HotThreads.php b/src/Endpoints/Nodes/HotThreads.php similarity index 100% rename from src/OpenSearch/Endpoints/Nodes/HotThreads.php rename to src/Endpoints/Nodes/HotThreads.php diff --git a/src/OpenSearch/Endpoints/Nodes/Info.php b/src/Endpoints/Nodes/Info.php similarity index 100% rename from src/OpenSearch/Endpoints/Nodes/Info.php rename to src/Endpoints/Nodes/Info.php diff --git a/src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php b/src/Endpoints/Nodes/ReloadSecureSettings.php similarity index 100% rename from src/OpenSearch/Endpoints/Nodes/ReloadSecureSettings.php rename to src/Endpoints/Nodes/ReloadSecureSettings.php diff --git a/src/OpenSearch/Endpoints/Nodes/Stats.php b/src/Endpoints/Nodes/Stats.php similarity index 100% rename from src/OpenSearch/Endpoints/Nodes/Stats.php rename to src/Endpoints/Nodes/Stats.php diff --git a/src/OpenSearch/Endpoints/Nodes/Usage.php b/src/Endpoints/Nodes/Usage.php similarity index 100% rename from src/OpenSearch/Endpoints/Nodes/Usage.php rename to src/Endpoints/Nodes/Usage.php diff --git a/src/OpenSearch/Endpoints/Notifications/CreateConfig.php b/src/Endpoints/Notifications/CreateConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/CreateConfig.php rename to src/Endpoints/Notifications/CreateConfig.php diff --git a/src/OpenSearch/Endpoints/Notifications/DeleteConfig.php b/src/Endpoints/Notifications/DeleteConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/DeleteConfig.php rename to src/Endpoints/Notifications/DeleteConfig.php diff --git a/src/OpenSearch/Endpoints/Notifications/DeleteConfigs.php b/src/Endpoints/Notifications/DeleteConfigs.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/DeleteConfigs.php rename to src/Endpoints/Notifications/DeleteConfigs.php diff --git a/src/OpenSearch/Endpoints/Notifications/GetConfig.php b/src/Endpoints/Notifications/GetConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/GetConfig.php rename to src/Endpoints/Notifications/GetConfig.php diff --git a/src/OpenSearch/Endpoints/Notifications/GetConfigs.php b/src/Endpoints/Notifications/GetConfigs.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/GetConfigs.php rename to src/Endpoints/Notifications/GetConfigs.php diff --git a/src/OpenSearch/Endpoints/Notifications/ListChannels.php b/src/Endpoints/Notifications/ListChannels.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/ListChannels.php rename to src/Endpoints/Notifications/ListChannels.php diff --git a/src/OpenSearch/Endpoints/Notifications/ListFeatures.php b/src/Endpoints/Notifications/ListFeatures.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/ListFeatures.php rename to src/Endpoints/Notifications/ListFeatures.php diff --git a/src/OpenSearch/Endpoints/Notifications/SendTest.php b/src/Endpoints/Notifications/SendTest.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/SendTest.php rename to src/Endpoints/Notifications/SendTest.php diff --git a/src/OpenSearch/Endpoints/Notifications/UpdateConfig.php b/src/Endpoints/Notifications/UpdateConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Notifications/UpdateConfig.php rename to src/Endpoints/Notifications/UpdateConfig.php diff --git a/src/OpenSearch/Endpoints/Observability/CreateObject.php b/src/Endpoints/Observability/CreateObject.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/CreateObject.php rename to src/Endpoints/Observability/CreateObject.php diff --git a/src/OpenSearch/Endpoints/Observability/DeleteObject.php b/src/Endpoints/Observability/DeleteObject.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/DeleteObject.php rename to src/Endpoints/Observability/DeleteObject.php diff --git a/src/OpenSearch/Endpoints/Observability/DeleteObjects.php b/src/Endpoints/Observability/DeleteObjects.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/DeleteObjects.php rename to src/Endpoints/Observability/DeleteObjects.php diff --git a/src/OpenSearch/Endpoints/Observability/GetLocalstats.php b/src/Endpoints/Observability/GetLocalstats.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/GetLocalstats.php rename to src/Endpoints/Observability/GetLocalstats.php diff --git a/src/OpenSearch/Endpoints/Observability/GetObject.php b/src/Endpoints/Observability/GetObject.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/GetObject.php rename to src/Endpoints/Observability/GetObject.php diff --git a/src/OpenSearch/Endpoints/Observability/ListObjects.php b/src/Endpoints/Observability/ListObjects.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/ListObjects.php rename to src/Endpoints/Observability/ListObjects.php diff --git a/src/OpenSearch/Endpoints/Observability/UpdateObject.php b/src/Endpoints/Observability/UpdateObject.php similarity index 100% rename from src/OpenSearch/Endpoints/Observability/UpdateObject.php rename to src/Endpoints/Observability/UpdateObject.php diff --git a/src/OpenSearch/Endpoints/Ping.php b/src/Endpoints/Ping.php similarity index 96% rename from src/OpenSearch/Endpoints/Ping.php rename to src/Endpoints/Ping.php index 5f74fdb00..bc55c5698 100644 --- a/src/OpenSearch/Endpoints/Ping.php +++ b/src/Endpoints/Ping.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Ppl/Explain.php b/src/Endpoints/Ppl/Explain.php similarity index 100% rename from src/OpenSearch/Endpoints/Ppl/Explain.php rename to src/Endpoints/Ppl/Explain.php diff --git a/src/OpenSearch/Endpoints/Ppl/GetStats.php b/src/Endpoints/Ppl/GetStats.php similarity index 100% rename from src/OpenSearch/Endpoints/Ppl/GetStats.php rename to src/Endpoints/Ppl/GetStats.php diff --git a/src/OpenSearch/Endpoints/Ppl/PostStats.php b/src/Endpoints/Ppl/PostStats.php similarity index 100% rename from src/OpenSearch/Endpoints/Ppl/PostStats.php rename to src/Endpoints/Ppl/PostStats.php diff --git a/src/OpenSearch/Endpoints/Ppl/Query.php b/src/Endpoints/Ppl/Query.php similarity index 100% rename from src/OpenSearch/Endpoints/Ppl/Query.php rename to src/Endpoints/Ppl/Query.php diff --git a/src/OpenSearch/Endpoints/PutScript.php b/src/Endpoints/PutScript.php similarity index 98% rename from src/OpenSearch/Endpoints/PutScript.php rename to src/Endpoints/PutScript.php index cc779271c..c4f836839 100644 --- a/src/OpenSearch/Endpoints/PutScript.php +++ b/src/Endpoints/PutScript.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Query/DatasourceDelete.php b/src/Endpoints/Query/DatasourceDelete.php similarity index 100% rename from src/OpenSearch/Endpoints/Query/DatasourceDelete.php rename to src/Endpoints/Query/DatasourceDelete.php diff --git a/src/OpenSearch/Endpoints/Query/DatasourceRetrieve.php b/src/Endpoints/Query/DatasourceRetrieve.php similarity index 100% rename from src/OpenSearch/Endpoints/Query/DatasourceRetrieve.php rename to src/Endpoints/Query/DatasourceRetrieve.php diff --git a/src/OpenSearch/Endpoints/Query/DatasourcesCreate.php b/src/Endpoints/Query/DatasourcesCreate.php similarity index 100% rename from src/OpenSearch/Endpoints/Query/DatasourcesCreate.php rename to src/Endpoints/Query/DatasourcesCreate.php diff --git a/src/OpenSearch/Endpoints/Query/DatasourcesList.php b/src/Endpoints/Query/DatasourcesList.php similarity index 100% rename from src/OpenSearch/Endpoints/Query/DatasourcesList.php rename to src/Endpoints/Query/DatasourcesList.php diff --git a/src/OpenSearch/Endpoints/Query/DatasourcesUpdate.php b/src/Endpoints/Query/DatasourcesUpdate.php similarity index 100% rename from src/OpenSearch/Endpoints/Query/DatasourcesUpdate.php rename to src/Endpoints/Query/DatasourcesUpdate.php diff --git a/src/OpenSearch/Endpoints/RankEval.php b/src/Endpoints/RankEval.php similarity index 97% rename from src/OpenSearch/Endpoints/RankEval.php rename to src/Endpoints/RankEval.php index ee92c79f0..f8d49aac1 100644 --- a/src/OpenSearch/Endpoints/RankEval.php +++ b/src/Endpoints/RankEval.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Reindex.php b/src/Endpoints/Reindex.php similarity index 97% rename from src/OpenSearch/Endpoints/Reindex.php rename to src/Endpoints/Reindex.php index 8aacbcda6..512607d8c 100644 --- a/src/OpenSearch/Endpoints/Reindex.php +++ b/src/Endpoints/Reindex.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/ReindexRethrottle.php b/src/Endpoints/ReindexRethrottle.php similarity index 97% rename from src/OpenSearch/Endpoints/ReindexRethrottle.php rename to src/Endpoints/ReindexRethrottle.php index 50d7bc457..4910a942a 100644 --- a/src/OpenSearch/Endpoints/ReindexRethrottle.php +++ b/src/Endpoints/ReindexRethrottle.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/RemoteStore/Restore.php b/src/Endpoints/RemoteStore/Restore.php similarity index 100% rename from src/OpenSearch/Endpoints/RemoteStore/Restore.php rename to src/Endpoints/RemoteStore/Restore.php diff --git a/src/OpenSearch/Endpoints/RenderSearchTemplate.php b/src/Endpoints/RenderSearchTemplate.php similarity index 97% rename from src/OpenSearch/Endpoints/RenderSearchTemplate.php rename to src/Endpoints/RenderSearchTemplate.php index 80bea800e..6fa50298e 100644 --- a/src/OpenSearch/Endpoints/RenderSearchTemplate.php +++ b/src/Endpoints/RenderSearchTemplate.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Rollups/Delete.php b/src/Endpoints/Rollups/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Delete.php rename to src/Endpoints/Rollups/Delete.php diff --git a/src/OpenSearch/Endpoints/Rollups/Explain.php b/src/Endpoints/Rollups/Explain.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Explain.php rename to src/Endpoints/Rollups/Explain.php diff --git a/src/OpenSearch/Endpoints/Rollups/Get.php b/src/Endpoints/Rollups/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Get.php rename to src/Endpoints/Rollups/Get.php diff --git a/src/OpenSearch/Endpoints/Rollups/Put.php b/src/Endpoints/Rollups/Put.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Put.php rename to src/Endpoints/Rollups/Put.php diff --git a/src/OpenSearch/Endpoints/Rollups/Start.php b/src/Endpoints/Rollups/Start.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Start.php rename to src/Endpoints/Rollups/Start.php diff --git a/src/OpenSearch/Endpoints/Rollups/Stop.php b/src/Endpoints/Rollups/Stop.php similarity index 100% rename from src/OpenSearch/Endpoints/Rollups/Stop.php rename to src/Endpoints/Rollups/Stop.php diff --git a/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php b/src/Endpoints/ScriptsPainlessExecute.php similarity index 97% rename from src/OpenSearch/Endpoints/ScriptsPainlessExecute.php rename to src/Endpoints/ScriptsPainlessExecute.php index 5a6b8b71d..ef3095997 100644 --- a/src/OpenSearch/Endpoints/ScriptsPainlessExecute.php +++ b/src/Endpoints/ScriptsPainlessExecute.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Scroll.php b/src/Endpoints/Scroll.php similarity index 97% rename from src/OpenSearch/Endpoints/Scroll.php rename to src/Endpoints/Scroll.php index 907a555dc..4b949e02c 100644 --- a/src/OpenSearch/Endpoints/Scroll.php +++ b/src/Endpoints/Scroll.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/Search.php b/src/Endpoints/Search.php similarity index 98% rename from src/OpenSearch/Endpoints/Search.php rename to src/Endpoints/Search.php index 0bbdf51cf..5ce384a53 100644 --- a/src/OpenSearch/Endpoints/Search.php +++ b/src/Endpoints/Search.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/SearchPipeline/Delete.php b/src/Endpoints/SearchPipeline/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchPipeline/Delete.php rename to src/Endpoints/SearchPipeline/Delete.php diff --git a/src/OpenSearch/Endpoints/SearchPipeline/Get.php b/src/Endpoints/SearchPipeline/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchPipeline/Get.php rename to src/Endpoints/SearchPipeline/Get.php diff --git a/src/OpenSearch/Endpoints/SearchPipeline/Put.php b/src/Endpoints/SearchPipeline/Put.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchPipeline/Put.php rename to src/Endpoints/SearchPipeline/Put.php diff --git a/src/OpenSearch/Endpoints/SearchShards.php b/src/Endpoints/SearchShards.php similarity index 97% rename from src/OpenSearch/Endpoints/SearchShards.php rename to src/Endpoints/SearchShards.php index 4d7d3161b..8511d893b 100644 --- a/src/OpenSearch/Endpoints/SearchShards.php +++ b/src/Endpoints/SearchShards.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/SearchTemplate.php b/src/Endpoints/SearchTemplate.php similarity index 97% rename from src/OpenSearch/Endpoints/SearchTemplate.php rename to src/Endpoints/SearchTemplate.php index f297b183c..1e0cf98b6 100644 --- a/src/OpenSearch/Endpoints/SearchTemplate.php +++ b/src/Endpoints/SearchTemplate.php @@ -21,8 +21,6 @@ namespace OpenSearch\Endpoints; -use OpenSearch\Endpoints\AbstractEndpoint; - /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php */ diff --git a/src/OpenSearch/Endpoints/SearchableSnapshots/ClearCache.php b/src/Endpoints/SearchableSnapshots/ClearCache.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchableSnapshots/ClearCache.php rename to src/Endpoints/SearchableSnapshots/ClearCache.php diff --git a/src/OpenSearch/Endpoints/SearchableSnapshots/Mount.php b/src/Endpoints/SearchableSnapshots/Mount.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchableSnapshots/Mount.php rename to src/Endpoints/SearchableSnapshots/Mount.php diff --git a/src/OpenSearch/Endpoints/SearchableSnapshots/RepositoryStats.php b/src/Endpoints/SearchableSnapshots/RepositoryStats.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchableSnapshots/RepositoryStats.php rename to src/Endpoints/SearchableSnapshots/RepositoryStats.php diff --git a/src/OpenSearch/Endpoints/SearchableSnapshots/Stats.php b/src/Endpoints/SearchableSnapshots/Stats.php similarity index 100% rename from src/OpenSearch/Endpoints/SearchableSnapshots/Stats.php rename to src/Endpoints/SearchableSnapshots/Stats.php diff --git a/src/OpenSearch/Endpoints/Security/Authinfo.php b/src/Endpoints/Security/Authinfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Authinfo.php rename to src/Endpoints/Security/Authinfo.php diff --git a/src/OpenSearch/Endpoints/Security/Authtoken.php b/src/Endpoints/Security/Authtoken.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Authtoken.php rename to src/Endpoints/Security/Authtoken.php diff --git a/src/OpenSearch/Endpoints/Security/Cache.php b/src/Endpoints/Security/Cache.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Cache.php rename to src/Endpoints/Security/Cache.php diff --git a/src/OpenSearch/Endpoints/Security/ChangePassword.php b/src/Endpoints/Security/ChangePassword.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/ChangePassword.php rename to src/Endpoints/Security/ChangePassword.php diff --git a/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php b/src/Endpoints/Security/ConfigUpgradeCheck.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php rename to src/Endpoints/Security/ConfigUpgradeCheck.php diff --git a/src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php b/src/Endpoints/Security/ConfigUpgradePerform.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php rename to src/Endpoints/Security/ConfigUpgradePerform.php diff --git a/src/OpenSearch/Endpoints/Security/CreateActionGroup.php b/src/Endpoints/Security/CreateActionGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateActionGroup.php rename to src/Endpoints/Security/CreateActionGroup.php diff --git a/src/OpenSearch/Endpoints/Security/CreateAllowlist.php b/src/Endpoints/Security/CreateAllowlist.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateAllowlist.php rename to src/Endpoints/Security/CreateAllowlist.php diff --git a/src/OpenSearch/Endpoints/Security/CreateRole.php b/src/Endpoints/Security/CreateRole.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateRole.php rename to src/Endpoints/Security/CreateRole.php diff --git a/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php b/src/Endpoints/Security/CreateRoleMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateRoleMapping.php rename to src/Endpoints/Security/CreateRoleMapping.php diff --git a/src/OpenSearch/Endpoints/Security/CreateTenant.php b/src/Endpoints/Security/CreateTenant.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateTenant.php rename to src/Endpoints/Security/CreateTenant.php diff --git a/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php b/src/Endpoints/Security/CreateUpdateTenancyConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php rename to src/Endpoints/Security/CreateUpdateTenancyConfig.php diff --git a/src/OpenSearch/Endpoints/Security/CreateUser.php b/src/Endpoints/Security/CreateUser.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateUser.php rename to src/Endpoints/Security/CreateUser.php diff --git a/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php b/src/Endpoints/Security/CreateUserLegacy.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/CreateUserLegacy.php rename to src/Endpoints/Security/CreateUserLegacy.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php b/src/Endpoints/Security/DeleteActionGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteActionGroup.php rename to src/Endpoints/Security/DeleteActionGroup.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php b/src/Endpoints/Security/DeleteDistinguishedName.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php rename to src/Endpoints/Security/DeleteDistinguishedName.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteRole.php b/src/Endpoints/Security/DeleteRole.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteRole.php rename to src/Endpoints/Security/DeleteRole.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php b/src/Endpoints/Security/DeleteRoleMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php rename to src/Endpoints/Security/DeleteRoleMapping.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteTenant.php b/src/Endpoints/Security/DeleteTenant.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteTenant.php rename to src/Endpoints/Security/DeleteTenant.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteUser.php b/src/Endpoints/Security/DeleteUser.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteUser.php rename to src/Endpoints/Security/DeleteUser.php diff --git a/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php b/src/Endpoints/Security/DeleteUserLegacy.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php rename to src/Endpoints/Security/DeleteUserLegacy.php diff --git a/src/OpenSearch/Endpoints/Security/FlushCache.php b/src/Endpoints/Security/FlushCache.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/FlushCache.php rename to src/Endpoints/Security/FlushCache.php diff --git a/src/OpenSearch/Endpoints/Security/GenerateOboToken.php b/src/Endpoints/Security/GenerateOboToken.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GenerateOboToken.php rename to src/Endpoints/Security/GenerateOboToken.php diff --git a/src/OpenSearch/Endpoints/Security/GenerateUserToken.php b/src/Endpoints/Security/GenerateUserToken.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GenerateUserToken.php rename to src/Endpoints/Security/GenerateUserToken.php diff --git a/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php b/src/Endpoints/Security/GenerateUserTokenLegacy.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php rename to src/Endpoints/Security/GenerateUserTokenLegacy.php diff --git a/src/OpenSearch/Endpoints/Security/GetAccountDetails.php b/src/Endpoints/Security/GetAccountDetails.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetAccountDetails.php rename to src/Endpoints/Security/GetAccountDetails.php diff --git a/src/OpenSearch/Endpoints/Security/GetActionGroup.php b/src/Endpoints/Security/GetActionGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetActionGroup.php rename to src/Endpoints/Security/GetActionGroup.php diff --git a/src/OpenSearch/Endpoints/Security/GetActionGroups.php b/src/Endpoints/Security/GetActionGroups.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetActionGroups.php rename to src/Endpoints/Security/GetActionGroups.php diff --git a/src/OpenSearch/Endpoints/Security/GetAllowlist.php b/src/Endpoints/Security/GetAllowlist.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetAllowlist.php rename to src/Endpoints/Security/GetAllowlist.php diff --git a/src/OpenSearch/Endpoints/Security/GetAuditConfiguration.php b/src/Endpoints/Security/GetAuditConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetAuditConfiguration.php rename to src/Endpoints/Security/GetAuditConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/GetCertificates.php b/src/Endpoints/Security/GetCertificates.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetCertificates.php rename to src/Endpoints/Security/GetCertificates.php diff --git a/src/OpenSearch/Endpoints/Security/GetConfiguration.php b/src/Endpoints/Security/GetConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetConfiguration.php rename to src/Endpoints/Security/GetConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/GetDashboardsInfo.php b/src/Endpoints/Security/GetDashboardsInfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetDashboardsInfo.php rename to src/Endpoints/Security/GetDashboardsInfo.php diff --git a/src/OpenSearch/Endpoints/Security/GetDistinguishedName.php b/src/Endpoints/Security/GetDistinguishedName.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetDistinguishedName.php rename to src/Endpoints/Security/GetDistinguishedName.php diff --git a/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php b/src/Endpoints/Security/GetDistinguishedNames.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php rename to src/Endpoints/Security/GetDistinguishedNames.php diff --git a/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php b/src/Endpoints/Security/GetPermissionsInfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php rename to src/Endpoints/Security/GetPermissionsInfo.php diff --git a/src/OpenSearch/Endpoints/Security/GetRole.php b/src/Endpoints/Security/GetRole.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetRole.php rename to src/Endpoints/Security/GetRole.php diff --git a/src/OpenSearch/Endpoints/Security/GetRoleMapping.php b/src/Endpoints/Security/GetRoleMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetRoleMapping.php rename to src/Endpoints/Security/GetRoleMapping.php diff --git a/src/OpenSearch/Endpoints/Security/GetRoleMappings.php b/src/Endpoints/Security/GetRoleMappings.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetRoleMappings.php rename to src/Endpoints/Security/GetRoleMappings.php diff --git a/src/OpenSearch/Endpoints/Security/GetRoles.php b/src/Endpoints/Security/GetRoles.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetRoles.php rename to src/Endpoints/Security/GetRoles.php diff --git a/src/OpenSearch/Endpoints/Security/GetSslinfo.php b/src/Endpoints/Security/GetSslinfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetSslinfo.php rename to src/Endpoints/Security/GetSslinfo.php diff --git a/src/OpenSearch/Endpoints/Security/GetTenancyConfig.php b/src/Endpoints/Security/GetTenancyConfig.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetTenancyConfig.php rename to src/Endpoints/Security/GetTenancyConfig.php diff --git a/src/OpenSearch/Endpoints/Security/GetTenant.php b/src/Endpoints/Security/GetTenant.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetTenant.php rename to src/Endpoints/Security/GetTenant.php diff --git a/src/OpenSearch/Endpoints/Security/GetTenants.php b/src/Endpoints/Security/GetTenants.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetTenants.php rename to src/Endpoints/Security/GetTenants.php diff --git a/src/OpenSearch/Endpoints/Security/GetUser.php b/src/Endpoints/Security/GetUser.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetUser.php rename to src/Endpoints/Security/GetUser.php diff --git a/src/OpenSearch/Endpoints/Security/GetUserLegacy.php b/src/Endpoints/Security/GetUserLegacy.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetUserLegacy.php rename to src/Endpoints/Security/GetUserLegacy.php diff --git a/src/OpenSearch/Endpoints/Security/GetUsers.php b/src/Endpoints/Security/GetUsers.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetUsers.php rename to src/Endpoints/Security/GetUsers.php diff --git a/src/OpenSearch/Endpoints/Security/GetUsersLegacy.php b/src/Endpoints/Security/GetUsersLegacy.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/GetUsersLegacy.php rename to src/Endpoints/Security/GetUsersLegacy.php diff --git a/src/OpenSearch/Endpoints/Security/Health.php b/src/Endpoints/Security/Health.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Health.php rename to src/Endpoints/Security/Health.php diff --git a/src/OpenSearch/Endpoints/Security/Migrate.php b/src/Endpoints/Security/Migrate.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Migrate.php rename to src/Endpoints/Security/Migrate.php diff --git a/src/OpenSearch/Endpoints/Security/PatchActionGroup.php b/src/Endpoints/Security/PatchActionGroup.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchActionGroup.php rename to src/Endpoints/Security/PatchActionGroup.php diff --git a/src/OpenSearch/Endpoints/Security/PatchActionGroups.php b/src/Endpoints/Security/PatchActionGroups.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchActionGroups.php rename to src/Endpoints/Security/PatchActionGroups.php diff --git a/src/OpenSearch/Endpoints/Security/PatchAllowlist.php b/src/Endpoints/Security/PatchAllowlist.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchAllowlist.php rename to src/Endpoints/Security/PatchAllowlist.php diff --git a/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php b/src/Endpoints/Security/PatchAuditConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php rename to src/Endpoints/Security/PatchAuditConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/PatchConfiguration.php b/src/Endpoints/Security/PatchConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchConfiguration.php rename to src/Endpoints/Security/PatchConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php b/src/Endpoints/Security/PatchDistinguishedName.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php rename to src/Endpoints/Security/PatchDistinguishedName.php diff --git a/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php b/src/Endpoints/Security/PatchDistinguishedNames.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php rename to src/Endpoints/Security/PatchDistinguishedNames.php diff --git a/src/OpenSearch/Endpoints/Security/PatchRole.php b/src/Endpoints/Security/PatchRole.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchRole.php rename to src/Endpoints/Security/PatchRole.php diff --git a/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php b/src/Endpoints/Security/PatchRoleMapping.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchRoleMapping.php rename to src/Endpoints/Security/PatchRoleMapping.php diff --git a/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php b/src/Endpoints/Security/PatchRoleMappings.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchRoleMappings.php rename to src/Endpoints/Security/PatchRoleMappings.php diff --git a/src/OpenSearch/Endpoints/Security/PatchRoles.php b/src/Endpoints/Security/PatchRoles.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchRoles.php rename to src/Endpoints/Security/PatchRoles.php diff --git a/src/OpenSearch/Endpoints/Security/PatchTenant.php b/src/Endpoints/Security/PatchTenant.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchTenant.php rename to src/Endpoints/Security/PatchTenant.php diff --git a/src/OpenSearch/Endpoints/Security/PatchTenants.php b/src/Endpoints/Security/PatchTenants.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchTenants.php rename to src/Endpoints/Security/PatchTenants.php diff --git a/src/OpenSearch/Endpoints/Security/PatchUser.php b/src/Endpoints/Security/PatchUser.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchUser.php rename to src/Endpoints/Security/PatchUser.php diff --git a/src/OpenSearch/Endpoints/Security/PatchUsers.php b/src/Endpoints/Security/PatchUsers.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PatchUsers.php rename to src/Endpoints/Security/PatchUsers.php diff --git a/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php b/src/Endpoints/Security/PostDashboardsInfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php rename to src/Endpoints/Security/PostDashboardsInfo.php diff --git a/src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php b/src/Endpoints/Security/ReloadHttpCertificates.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php rename to src/Endpoints/Security/ReloadHttpCertificates.php diff --git a/src/OpenSearch/Endpoints/Security/ReloadTransportCertificates.php b/src/Endpoints/Security/ReloadTransportCertificates.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/ReloadTransportCertificates.php rename to src/Endpoints/Security/ReloadTransportCertificates.php diff --git a/src/OpenSearch/Endpoints/Security/TenantInfo.php b/src/Endpoints/Security/TenantInfo.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/TenantInfo.php rename to src/Endpoints/Security/TenantInfo.php diff --git a/src/OpenSearch/Endpoints/Security/UpdateAuditConfiguration.php b/src/Endpoints/Security/UpdateAuditConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/UpdateAuditConfiguration.php rename to src/Endpoints/Security/UpdateAuditConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php b/src/Endpoints/Security/UpdateConfiguration.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/UpdateConfiguration.php rename to src/Endpoints/Security/UpdateConfiguration.php diff --git a/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php b/src/Endpoints/Security/UpdateDistinguishedName.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php rename to src/Endpoints/Security/UpdateDistinguishedName.php diff --git a/src/OpenSearch/Endpoints/Security/Validate.php b/src/Endpoints/Security/Validate.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/Validate.php rename to src/Endpoints/Security/Validate.php diff --git a/src/OpenSearch/Endpoints/Security/WhoAmI.php b/src/Endpoints/Security/WhoAmI.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/WhoAmI.php rename to src/Endpoints/Security/WhoAmI.php diff --git a/src/OpenSearch/Endpoints/Security/WhoAmIProtected.php b/src/Endpoints/Security/WhoAmIProtected.php similarity index 100% rename from src/OpenSearch/Endpoints/Security/WhoAmIProtected.php rename to src/Endpoints/Security/WhoAmIProtected.php diff --git a/src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php b/src/Endpoints/Snapshot/CleanupRepository.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/CleanupRepository.php rename to src/Endpoints/Snapshot/CleanupRepository.php diff --git a/src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php b/src/Endpoints/Snapshot/CloneSnapshot.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/CloneSnapshot.php rename to src/Endpoints/Snapshot/CloneSnapshot.php diff --git a/src/OpenSearch/Endpoints/Snapshot/Create.php b/src/Endpoints/Snapshot/Create.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/Create.php rename to src/Endpoints/Snapshot/Create.php diff --git a/src/OpenSearch/Endpoints/Snapshot/CreateRepository.php b/src/Endpoints/Snapshot/CreateRepository.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/CreateRepository.php rename to src/Endpoints/Snapshot/CreateRepository.php diff --git a/src/OpenSearch/Endpoints/Snapshot/Delete.php b/src/Endpoints/Snapshot/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/Delete.php rename to src/Endpoints/Snapshot/Delete.php diff --git a/src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php b/src/Endpoints/Snapshot/DeleteRepository.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/DeleteRepository.php rename to src/Endpoints/Snapshot/DeleteRepository.php diff --git a/src/OpenSearch/Endpoints/Snapshot/Get.php b/src/Endpoints/Snapshot/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/Get.php rename to src/Endpoints/Snapshot/Get.php diff --git a/src/OpenSearch/Endpoints/Snapshot/GetRepository.php b/src/Endpoints/Snapshot/GetRepository.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/GetRepository.php rename to src/Endpoints/Snapshot/GetRepository.php diff --git a/src/OpenSearch/Endpoints/Snapshot/Restore.php b/src/Endpoints/Snapshot/Restore.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/Restore.php rename to src/Endpoints/Snapshot/Restore.php diff --git a/src/OpenSearch/Endpoints/Snapshot/Status.php b/src/Endpoints/Snapshot/Status.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/Status.php rename to src/Endpoints/Snapshot/Status.php diff --git a/src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php b/src/Endpoints/Snapshot/VerifyRepository.php similarity index 100% rename from src/OpenSearch/Endpoints/Snapshot/VerifyRepository.php rename to src/Endpoints/Snapshot/VerifyRepository.php diff --git a/src/OpenSearch/Endpoints/Sql/Close.php b/src/Endpoints/Sql/Close.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/Close.php rename to src/Endpoints/Sql/Close.php diff --git a/src/OpenSearch/Endpoints/Sql/CursorClose.php b/src/Endpoints/Sql/CursorClose.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/CursorClose.php rename to src/Endpoints/Sql/CursorClose.php diff --git a/src/OpenSearch/Endpoints/Sql/Explain.php b/src/Endpoints/Sql/Explain.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/Explain.php rename to src/Endpoints/Sql/Explain.php diff --git a/src/OpenSearch/Endpoints/Sql/GetStats.php b/src/Endpoints/Sql/GetStats.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/GetStats.php rename to src/Endpoints/Sql/GetStats.php diff --git a/src/OpenSearch/Endpoints/Sql/PostStats.php b/src/Endpoints/Sql/PostStats.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/PostStats.php rename to src/Endpoints/Sql/PostStats.php diff --git a/src/OpenSearch/Endpoints/Sql/Query.php b/src/Endpoints/Sql/Query.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/Query.php rename to src/Endpoints/Sql/Query.php diff --git a/src/OpenSearch/Endpoints/Sql/Settings.php b/src/Endpoints/Sql/Settings.php similarity index 100% rename from src/OpenSearch/Endpoints/Sql/Settings.php rename to src/Endpoints/Sql/Settings.php diff --git a/src/OpenSearch/Endpoints/Ssl/Certificates.php b/src/Endpoints/Ssl/Certificates.php similarity index 100% rename from src/OpenSearch/Endpoints/Ssl/Certificates.php rename to src/Endpoints/Ssl/Certificates.php diff --git a/src/OpenSearch/Endpoints/Tasks/Cancel.php b/src/Endpoints/Tasks/Cancel.php similarity index 100% rename from src/OpenSearch/Endpoints/Tasks/Cancel.php rename to src/Endpoints/Tasks/Cancel.php diff --git a/src/OpenSearch/Endpoints/Tasks/Get.php b/src/Endpoints/Tasks/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/Tasks/Get.php rename to src/Endpoints/Tasks/Get.php diff --git a/src/OpenSearch/Endpoints/Tasks/ListTasks.php b/src/Endpoints/Tasks/ListTasks.php similarity index 100% rename from src/OpenSearch/Endpoints/Tasks/ListTasks.php rename to src/Endpoints/Tasks/ListTasks.php diff --git a/src/OpenSearch/Endpoints/TermVectors.php b/src/Endpoints/TermVectors.php similarity index 98% rename from src/OpenSearch/Endpoints/TermVectors.php rename to src/Endpoints/TermVectors.php index c06aefdbe..1d857cfce 100644 --- a/src/OpenSearch/Endpoints/TermVectors.php +++ b/src/Endpoints/TermVectors.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/Transforms/Delete.php b/src/Endpoints/Transforms/Delete.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Delete.php rename to src/Endpoints/Transforms/Delete.php diff --git a/src/OpenSearch/Endpoints/Transforms/Explain.php b/src/Endpoints/Transforms/Explain.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Explain.php rename to src/Endpoints/Transforms/Explain.php diff --git a/src/OpenSearch/Endpoints/Transforms/Get.php b/src/Endpoints/Transforms/Get.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Get.php rename to src/Endpoints/Transforms/Get.php diff --git a/src/OpenSearch/Endpoints/Transforms/Preview.php b/src/Endpoints/Transforms/Preview.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Preview.php rename to src/Endpoints/Transforms/Preview.php diff --git a/src/OpenSearch/Endpoints/Transforms/Put.php b/src/Endpoints/Transforms/Put.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Put.php rename to src/Endpoints/Transforms/Put.php diff --git a/src/OpenSearch/Endpoints/Transforms/Search.php b/src/Endpoints/Transforms/Search.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Search.php rename to src/Endpoints/Transforms/Search.php diff --git a/src/OpenSearch/Endpoints/Transforms/Start.php b/src/Endpoints/Transforms/Start.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Start.php rename to src/Endpoints/Transforms/Start.php diff --git a/src/OpenSearch/Endpoints/Transforms/Stop.php b/src/Endpoints/Transforms/Stop.php similarity index 100% rename from src/OpenSearch/Endpoints/Transforms/Stop.php rename to src/Endpoints/Transforms/Stop.php diff --git a/src/OpenSearch/Endpoints/Update.php b/src/Endpoints/Update.php similarity index 98% rename from src/OpenSearch/Endpoints/Update.php rename to src/Endpoints/Update.php index eedb30196..929f6eb76 100644 --- a/src/OpenSearch/Endpoints/Update.php +++ b/src/Endpoints/Update.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/UpdateByQuery.php b/src/Endpoints/UpdateByQuery.php similarity index 98% rename from src/OpenSearch/Endpoints/UpdateByQuery.php rename to src/Endpoints/UpdateByQuery.php index f08a450ee..ab73b9bbe 100644 --- a/src/OpenSearch/Endpoints/UpdateByQuery.php +++ b/src/Endpoints/UpdateByQuery.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php b/src/Endpoints/UpdateByQueryRethrottle.php similarity index 97% rename from src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php rename to src/Endpoints/UpdateByQueryRethrottle.php index 37d8f7ff9..df1364942 100644 --- a/src/OpenSearch/Endpoints/UpdateByQueryRethrottle.php +++ b/src/Endpoints/UpdateByQueryRethrottle.php @@ -22,7 +22,6 @@ namespace OpenSearch\Endpoints; use OpenSearch\Common\Exceptions\RuntimeException; -use OpenSearch\Endpoints\AbstractEndpoint; /** * NOTE: This file is autogenerated using util/GenerateEndpoints.php diff --git a/src/OpenSearch/Helper/Iterators/SearchHitIterator.php b/src/Helper/Iterators/SearchHitIterator.php similarity index 100% rename from src/OpenSearch/Helper/Iterators/SearchHitIterator.php rename to src/Helper/Iterators/SearchHitIterator.php diff --git a/src/OpenSearch/Helper/Iterators/SearchResponseIterator.php b/src/Helper/Iterators/SearchResponseIterator.php similarity index 100% rename from src/OpenSearch/Helper/Iterators/SearchResponseIterator.php rename to src/Helper/Iterators/SearchResponseIterator.php index ec6e8e5d8..ce8174883 100644 --- a/src/OpenSearch/Helper/Iterators/SearchResponseIterator.php +++ b/src/Helper/Iterators/SearchResponseIterator.php @@ -21,8 +21,8 @@ namespace OpenSearch\Helper\Iterators; -use OpenSearch\Client; use Iterator; +use OpenSearch\Client; class SearchResponseIterator implements Iterator { diff --git a/src/OpenSearch/Namespaces/AbstractNamespace.php b/src/Namespaces/AbstractNamespace.php similarity index 89% rename from src/OpenSearch/Namespaces/AbstractNamespace.php rename to src/Namespaces/AbstractNamespace.php index 0b5a7a326..eca8cab53 100644 --- a/src/OpenSearch/Namespaces/AbstractNamespace.php +++ b/src/Namespaces/AbstractNamespace.php @@ -26,10 +26,7 @@ abstract class AbstractNamespace { - /** - * @var \OpenSearch\Transport - */ - protected $transport; + protected Transport $transport; /** * @var callable @@ -51,9 +48,9 @@ public function extractArgument(array &$params, string $arg) $val = $params[$arg]; unset($params[$arg]); return $val; - } else { - return null; } + + return null; } protected function performRequest(AbstractEndpoint $endpoint) @@ -66,6 +63,6 @@ protected function performRequest(AbstractEndpoint $endpoint) $endpoint->getOptions() ); - return $this->transport->resultOrFuture($response, $endpoint->getOptions()); + return $this->transport->resultOrFuture($response); } } diff --git a/src/OpenSearch/Namespaces/AsyncSearchNamespace.php b/src/Namespaces/AsyncSearchNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/AsyncSearchNamespace.php rename to src/Namespaces/AsyncSearchNamespace.php index e01e33db2..a39b5c173 100644 --- a/src/OpenSearch/Namespaces/AsyncSearchNamespace.php +++ b/src/Namespaces/AsyncSearchNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class AsyncSearchNamespace * diff --git a/src/OpenSearch/Namespaces/BooleanRequestWrapper.php b/src/Namespaces/BooleanRequestWrapper.php similarity index 67% rename from src/OpenSearch/Namespaces/BooleanRequestWrapper.php rename to src/Namespaces/BooleanRequestWrapper.php index 9c29f656b..39b119db9 100644 --- a/src/OpenSearch/Namespaces/BooleanRequestWrapper.php +++ b/src/Namespaces/BooleanRequestWrapper.php @@ -25,16 +25,9 @@ use OpenSearch\Common\Exceptions\RoutingMissingException; use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Transport; -use GuzzleHttp\Ring\Future\FutureArrayInterface; abstract class BooleanRequestWrapper { - /** - * Perform Request - * - * @throws Missing404Exception - * @throws RoutingMissingException - */ public static function performRequest(AbstractEndpoint $endpoint, Transport $transport) { try { @@ -42,21 +35,11 @@ public static function performRequest(AbstractEndpoint $endpoint, Transport $tra $endpoint->getMethod(), $endpoint->getURI(), $endpoint->getParams(), - $endpoint->getBody(), - $endpoint->getOptions() + $endpoint->getBody() ); - $response = $transport->resultOrFuture($response, $endpoint->getOptions()); - if (!($response instanceof FutureArrayInterface)) { - if ($response['status'] === 200) { - return true; - } else { - return false; - } - } else { - // async mode, can't easily resolve this...punt to user - return $response; - } + $transport->resultOrFuture($response); + return true; } catch (Missing404Exception $exception) { return false; } catch (RoutingMissingException $exception) { diff --git a/src/OpenSearch/Namespaces/CatNamespace.php b/src/Namespaces/CatNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/CatNamespace.php rename to src/Namespaces/CatNamespace.php index d51d8223c..e1c0fe848 100644 --- a/src/OpenSearch/Namespaces/CatNamespace.php +++ b/src/Namespaces/CatNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class CatNamespace * diff --git a/src/OpenSearch/Namespaces/ClusterNamespace.php b/src/Namespaces/ClusterNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/ClusterNamespace.php rename to src/Namespaces/ClusterNamespace.php index dbe85126b..d52a9141d 100644 --- a/src/OpenSearch/Namespaces/ClusterNamespace.php +++ b/src/Namespaces/ClusterNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class ClusterNamespace * diff --git a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php b/src/Namespaces/DanglingIndicesNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/DanglingIndicesNamespace.php rename to src/Namespaces/DanglingIndicesNamespace.php index ff17095b3..8dfa35ed8 100644 --- a/src/OpenSearch/Namespaces/DanglingIndicesNamespace.php +++ b/src/Namespaces/DanglingIndicesNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class DanglingIndicesNamespace * diff --git a/src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php b/src/Namespaces/DataFrameTransformDeprecatedNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php rename to src/Namespaces/DataFrameTransformDeprecatedNamespace.php index 064cd9797..403f4a688 100644 --- a/src/OpenSearch/Namespaces/DataFrameTransformDeprecatedNamespace.php +++ b/src/Namespaces/DataFrameTransformDeprecatedNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class DataFrameTransformDeprecatedNamespace * diff --git a/src/OpenSearch/Namespaces/IndicesNamespace.php b/src/Namespaces/IndicesNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/IndicesNamespace.php rename to src/Namespaces/IndicesNamespace.php index 7d6b5ca56..15c1c3222 100644 --- a/src/OpenSearch/Namespaces/IndicesNamespace.php +++ b/src/Namespaces/IndicesNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class IndicesNamespace * diff --git a/src/OpenSearch/Namespaces/IngestNamespace.php b/src/Namespaces/IngestNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/IngestNamespace.php rename to src/Namespaces/IngestNamespace.php index d217dc47a..25573587e 100644 --- a/src/OpenSearch/Namespaces/IngestNamespace.php +++ b/src/Namespaces/IngestNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class IngestNamespace * diff --git a/src/OpenSearch/Namespaces/KnnNamespace.php b/src/Namespaces/KnnNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/KnnNamespace.php rename to src/Namespaces/KnnNamespace.php index 9406836f1..c73e27a34 100644 --- a/src/OpenSearch/Namespaces/KnnNamespace.php +++ b/src/Namespaces/KnnNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class KnnNamespace * diff --git a/src/OpenSearch/Namespaces/MlNamespace.php b/src/Namespaces/MlNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/MlNamespace.php rename to src/Namespaces/MlNamespace.php index c89c35e88..513b22a8d 100644 --- a/src/OpenSearch/Namespaces/MlNamespace.php +++ b/src/Namespaces/MlNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class MlNamespace * diff --git a/src/OpenSearch/Namespaces/MonitoringNamespace.php b/src/Namespaces/MonitoringNamespace.php similarity index 97% rename from src/OpenSearch/Namespaces/MonitoringNamespace.php rename to src/Namespaces/MonitoringNamespace.php index 02dec4494..9abf48415 100644 --- a/src/OpenSearch/Namespaces/MonitoringNamespace.php +++ b/src/Namespaces/MonitoringNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class MonitoringNamespace * diff --git a/src/OpenSearch/Namespaces/NamespaceBuilderInterface.php b/src/Namespaces/NamespaceBuilderInterface.php similarity index 100% rename from src/OpenSearch/Namespaces/NamespaceBuilderInterface.php rename to src/Namespaces/NamespaceBuilderInterface.php diff --git a/src/OpenSearch/Namespaces/NodesNamespace.php b/src/Namespaces/NodesNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/NodesNamespace.php rename to src/Namespaces/NodesNamespace.php index e9baf762c..9148a6398 100644 --- a/src/OpenSearch/Namespaces/NodesNamespace.php +++ b/src/Namespaces/NodesNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class NodesNamespace * diff --git a/src/OpenSearch/Namespaces/NotificationsNamespace.php b/src/Namespaces/NotificationsNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/NotificationsNamespace.php rename to src/Namespaces/NotificationsNamespace.php index 2022c0247..d655145e8 100644 --- a/src/OpenSearch/Namespaces/NotificationsNamespace.php +++ b/src/Namespaces/NotificationsNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class NotificationsNamespace * diff --git a/src/OpenSearch/Namespaces/ObservabilityNamespace.php b/src/Namespaces/ObservabilityNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/ObservabilityNamespace.php rename to src/Namespaces/ObservabilityNamespace.php index 3c8132ae6..ab3cb381f 100644 --- a/src/OpenSearch/Namespaces/ObservabilityNamespace.php +++ b/src/Namespaces/ObservabilityNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class ObservabilityNamespace * diff --git a/src/OpenSearch/Namespaces/PplNamespace.php b/src/Namespaces/PplNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/PplNamespace.php rename to src/Namespaces/PplNamespace.php index e6220a4dc..85cbbd131 100644 --- a/src/OpenSearch/Namespaces/PplNamespace.php +++ b/src/Namespaces/PplNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class PplNamespace * diff --git a/src/OpenSearch/Namespaces/QueryNamespace.php b/src/Namespaces/QueryNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/QueryNamespace.php rename to src/Namespaces/QueryNamespace.php index 0ee9a0046..7a923988b 100644 --- a/src/OpenSearch/Namespaces/QueryNamespace.php +++ b/src/Namespaces/QueryNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class QueryNamespace * diff --git a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php b/src/Namespaces/RemoteStoreNamespace.php similarity index 97% rename from src/OpenSearch/Namespaces/RemoteStoreNamespace.php rename to src/Namespaces/RemoteStoreNamespace.php index bd1b90803..2d59eaf23 100644 --- a/src/OpenSearch/Namespaces/RemoteStoreNamespace.php +++ b/src/Namespaces/RemoteStoreNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class RemoteStoreNamespace * diff --git a/src/OpenSearch/Namespaces/RollupsNamespace.php b/src/Namespaces/RollupsNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/RollupsNamespace.php rename to src/Namespaces/RollupsNamespace.php index d0deb6022..d7f9fea1a 100644 --- a/src/OpenSearch/Namespaces/RollupsNamespace.php +++ b/src/Namespaces/RollupsNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class RollupsNamespace * diff --git a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php b/src/Namespaces/SearchPipelineNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/SearchPipelineNamespace.php rename to src/Namespaces/SearchPipelineNamespace.php index 0066519de..d06531ded 100644 --- a/src/OpenSearch/Namespaces/SearchPipelineNamespace.php +++ b/src/Namespaces/SearchPipelineNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SearchPipelineNamespace * diff --git a/src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php b/src/Namespaces/SearchableSnapshotsNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php rename to src/Namespaces/SearchableSnapshotsNamespace.php index 9506d0074..26b5b36e1 100644 --- a/src/OpenSearch/Namespaces/SearchableSnapshotsNamespace.php +++ b/src/Namespaces/SearchableSnapshotsNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SearchableSnapshotsNamespace * diff --git a/src/OpenSearch/Namespaces/SecurityNamespace.php b/src/Namespaces/SecurityNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/SecurityNamespace.php rename to src/Namespaces/SecurityNamespace.php index bf7a5937a..b520c253f 100644 --- a/src/OpenSearch/Namespaces/SecurityNamespace.php +++ b/src/Namespaces/SecurityNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SecurityNamespace * diff --git a/src/OpenSearch/Namespaces/SnapshotNamespace.php b/src/Namespaces/SnapshotNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/SnapshotNamespace.php rename to src/Namespaces/SnapshotNamespace.php index db1dc9785..05c04e256 100644 --- a/src/OpenSearch/Namespaces/SnapshotNamespace.php +++ b/src/Namespaces/SnapshotNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SnapshotNamespace * diff --git a/src/OpenSearch/Namespaces/SqlNamespace.php b/src/Namespaces/SqlNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/SqlNamespace.php rename to src/Namespaces/SqlNamespace.php index 83340f784..56a8d8b0f 100644 --- a/src/OpenSearch/Namespaces/SqlNamespace.php +++ b/src/Namespaces/SqlNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SqlNamespace * diff --git a/src/OpenSearch/Namespaces/SslNamespace.php b/src/Namespaces/SslNamespace.php similarity index 96% rename from src/OpenSearch/Namespaces/SslNamespace.php rename to src/Namespaces/SslNamespace.php index 9e7967330..ea2aea0ad 100644 --- a/src/OpenSearch/Namespaces/SslNamespace.php +++ b/src/Namespaces/SslNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class SslNamespace * diff --git a/src/OpenSearch/Namespaces/TasksNamespace.php b/src/Namespaces/TasksNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/TasksNamespace.php rename to src/Namespaces/TasksNamespace.php index 6bdb239b6..e8666dcca 100644 --- a/src/OpenSearch/Namespaces/TasksNamespace.php +++ b/src/Namespaces/TasksNamespace.php @@ -21,8 +21,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class TasksNamespace * diff --git a/src/OpenSearch/Namespaces/TransformsNamespace.php b/src/Namespaces/TransformsNamespace.php similarity index 99% rename from src/OpenSearch/Namespaces/TransformsNamespace.php rename to src/Namespaces/TransformsNamespace.php index 55f744df8..43c6577af 100644 --- a/src/OpenSearch/Namespaces/TransformsNamespace.php +++ b/src/Namespaces/TransformsNamespace.php @@ -15,8 +15,6 @@ namespace OpenSearch\Namespaces; -use OpenSearch\Namespaces\AbstractNamespace; - /** * Class TransformsNamespace * diff --git a/src/OpenSearch/ClientBuilder.php b/src/OpenSearch/ClientBuilder.php deleted file mode 100644 index 1865bc3dd..000000000 --- a/src/OpenSearch/ClientBuilder.php +++ /dev/null @@ -1,859 +0,0 @@ - true - ]; - - /** - * @var array|null - */ - private $hosts; - - /** - * @var array - */ - private $connectionParams; - - /** - * @var int|null - */ - private $retries; - - /** - * @var null|callable - */ - private $sigV4CredentialProvider; - - /** - * @var null|string - */ - private $sigV4Region; - - /** - * @var null|string - */ - private $sigV4Service; - - /** - * @var bool - */ - private $sniffOnStart = false; - - /** - * @var null|array - */ - private $sslCert; - - /** - * @var null|array - */ - private $sslKey; - - /** - * @var null|bool|string - */ - private $sslVerification; - - /** - * @var bool - */ - private $includePortInHostHeader = false; - - /** - * @var string|null - */ - private $basicAuthentication = null; - - /** - * Create an instance of ClientBuilder - */ - public static function create(): ClientBuilder - { - return new self(); - } - - /** - * Can supply first param to Client::__construct() when invoking manually or with dependency injection - */ - public function getTransport(): Transport - { - return $this->transport; - } - - /** - * Can supply second param to Client::__construct() when invoking manually or with dependency injection - */ - public function getEndpoint(): callable - { - return $this->endpoint; - } - - /** - * Can supply third param to Client::__construct() when invoking manually or with dependency injection - * - * @return NamespaceBuilderInterface[] - */ - public function getRegisteredNamespacesBuilders(): array - { - return $this->registeredNamespacesBuilders; - } - - /** - * Build a new client from the provided config. Hash keys - * should correspond to the method name e.g. ['connectionPool'] - * corresponds to setConnectionPool(). - * - * Missing keys will use the default for that setting if applicable - * - * Unknown keys will throw an exception by default, but this can be silenced - * by setting `quiet` to true - * - * @param array $config - * @param bool $quiet False if unknown settings throw exception, true to silently - * ignore unknown settings - * @throws Common\Exceptions\RuntimeException - */ - public static function fromConfig(array $config, bool $quiet = false): Client - { - $builder = new self(); - foreach ($config as $key => $value) { - $method = in_array($key, self::ALLOWED_METHODS_FROM_CONFIG, true) ? $key : "set$key"; - $reflection = new ReflectionClass($builder); - if ($reflection->hasMethod($method)) { - $func = $reflection->getMethod($method); - if ($func->getNumberOfParameters() > 1) { - $builder->$method(...$value); - } else { - $builder->$method($value); - } - unset($config[$key]); - } - } - - if ($quiet === false && count($config) > 0) { - $unknown = implode(array_keys($config)); - throw new RuntimeException("Unknown parameters provided: $unknown"); - } - return $builder->build(); - } - - /** - * Get the default handler - * - * @param array $multiParams - * @param array $singleParams - * @throws \RuntimeException - */ - public static function defaultHandler(array $multiParams = [], array $singleParams = []): callable - { - $future = null; - if (extension_loaded('curl')) { - $config = array_merge([ 'mh' => curl_multi_init() ], $multiParams); - if (function_exists('curl_reset')) { - $default = new CurlHandler($singleParams); - $future = new CurlMultiHandler($config); - } else { - $default = new CurlMultiHandler($config); - } - } else { - throw new \RuntimeException('OpenSearch-PHP requires cURL, or a custom HTTP handler.'); - } - - return $future ? Middleware::wrapFuture($default, $future) : $default; - } - - /** - * Get the multi handler for async (CurlMultiHandler) - * - * @throws \RuntimeException - */ - public static function multiHandler(array $params = []): CurlMultiHandler - { - if (function_exists('curl_multi_init')) { - return new CurlMultiHandler(array_merge([ 'mh' => curl_multi_init() ], $params)); - } - - throw new \RuntimeException('CurlMulti handler requires cURL.'); - } - - /** - * Get the handler instance (CurlHandler) - * - * @throws \RuntimeException - */ - public static function singleHandler(): CurlHandler - { - if (function_exists('curl_reset')) { - return new CurlHandler(); - } - - throw new \RuntimeException('CurlSingle handler requires cURL.'); - } - - /** - * Set connection Factory - * - * @param ConnectionFactoryInterface $connectionFactory - */ - public function setConnectionFactory(ConnectionFactoryInterface $connectionFactory): ClientBuilder - { - $this->connectionFactory = $connectionFactory; - - return $this; - } - - /** - * Set the connection pool (default is StaticNoPingConnectionPool) - * - * @param AbstractConnectionPool|string $connectionPool - * @param array $args - * @throws \InvalidArgumentException - */ - public function setConnectionPool($connectionPool, array $args = []): ClientBuilder - { - if (is_string($connectionPool)) { - $this->connectionPool = $connectionPool; - $this->connectionPoolArgs = $args; - } elseif (is_object($connectionPool)) { - $this->connectionPool = $connectionPool; - } else { - throw new InvalidArgumentException("Serializer must be a class path or instantiated object extending AbstractConnectionPool"); - } - - return $this; - } - - /** - * Set the endpoint - * - * @param callable $endpoint - */ - public function setEndpoint(callable $endpoint): ClientBuilder - { - $this->endpoint = $endpoint; - - return $this; - } - - /** - * Register namespace - * - * @param NamespaceBuilderInterface $namespaceBuilder - */ - public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder): ClientBuilder - { - $this->registeredNamespacesBuilders[] = $namespaceBuilder; - - return $this; - } - - /** - * Set the transport - * - * @param Transport $transport - */ - public function setTransport(Transport $transport): ClientBuilder - { - $this->transport = $transport; - - return $this; - } - - /** - * Set the HTTP handler (cURL is default) - * - * @param mixed $handler - */ - public function setHandler($handler): ClientBuilder - { - $this->handler = $handler; - - return $this; - } - - /** - * Set the PSR-3 Logger - * - * @param LoggerInterface $logger - */ - public function setLogger(LoggerInterface $logger): ClientBuilder - { - $this->logger = $logger; - - return $this; - } - - /** - * Set the PSR-3 tracer - * - * @param LoggerInterface $tracer - */ - public function setTracer(LoggerInterface $tracer): ClientBuilder - { - $this->tracer = $tracer; - - return $this; - } - - /** - * Set the serializer - * - * @param \OpenSearch\Serializers\SerializerInterface|string $serializer - */ - public function setSerializer($serializer): ClientBuilder - { - $this->parseStringOrObject($serializer, $this->serializer, 'SerializerInterface'); - - return $this; - } - - /** - * Set the hosts (nodes) - * - * @param array $hosts - */ - public function setHosts(array $hosts): ClientBuilder - { - $this->hosts = $hosts; - - return $this; - } - - /** - * Set Basic access authentication - * - * @see https://en.wikipedia.org/wiki/Basic_access_authentication - * @param string $username - * @param string $password - * - * @throws AuthenticationConfigException - */ - public function setBasicAuthentication(string $username, string $password): ClientBuilder - { - $this->basicAuthentication = $username.':'.$password; - - return $this; - } - - /** - * Set connection parameters - * - * @param array $params - */ - public function setConnectionParams(array $params): ClientBuilder - { - $this->connectionParams = $params; - - return $this; - } - - /** - * Set number or retries (default is equal to number of nodes) - * - * @param int $retries - */ - public function setRetries(int $retries): ClientBuilder - { - $this->retries = $retries; - - return $this; - } - - /** - * Set the selector algorithm - * - * @param \OpenSearch\ConnectionPool\Selectors\SelectorInterface|string $selector - */ - public function setSelector($selector): ClientBuilder - { - $this->parseStringOrObject($selector, $this->selector, 'SelectorInterface'); - - return $this; - } - - /** - * Set the credential provider for SigV4 request signing. The value provider should be a - * callable object that will return - * - * @param callable|bool|array|CredentialsInterface|null $credentialProvider - */ - public function setSigV4CredentialProvider($credentialProvider): ClientBuilder - { - if ($credentialProvider !== null && $credentialProvider !== false) { - $this->sigV4CredentialProvider = $this->normalizeCredentialProvider($credentialProvider); - } - - return $this; - } - - /** - * Set the region for SigV4 signing. - * - * @param string|null $region - */ - public function setSigV4Region($region): ClientBuilder - { - $this->sigV4Region = $region; - - return $this; - } - - /** - * Set the service for SigV4 signing. - * - * @param string|null $service - */ - public function setSigV4Service($service): ClientBuilder - { - $this->sigV4Service = $service; - - return $this; - } - - /** - * Set sniff on start - * - * @param bool $sniffOnStart enable or disable sniff on start - */ - - public function setSniffOnStart(bool $sniffOnStart): ClientBuilder - { - $this->sniffOnStart = $sniffOnStart; - - return $this; - } - - /** - * Set SSL certificate - * - * @param string $cert The name of a file containing a PEM formatted certificate. - * @param string $password if the certificate requires a password - */ - public function setSSLCert(string $cert, ?string $password = null): ClientBuilder - { - $this->sslCert = [$cert, $password]; - - return $this; - } - - /** - * Set SSL key - * - * @param string $key The name of a file containing a private SSL key - * @param string $password if the private key requires a password - */ - public function setSSLKey(string $key, ?string $password = null): ClientBuilder - { - $this->sslKey = [$key, $password]; - - return $this; - } - - /** - * Set SSL verification - * - * @param bool|string $value - */ - public function setSSLVerification($value = true): ClientBuilder - { - $this->sslVerification = $value; - - return $this; - } - - /** - * Include the port in Host header - * - * @see https://github.com/elastic/elasticsearch-php/issues/993 - */ - public function includePortInHostHeader(bool $enable): ClientBuilder - { - $this->includePortInHostHeader = $enable; - - return $this; - } - - /** - * Build and returns the Client object - */ - public function build(): Client - { - $this->buildLoggers(); - - if (is_null($this->handler)) { - $this->handler = ClientBuilder::defaultHandler(); - } - - if (!is_null($this->sigV4CredentialProvider)) { - if (is_null($this->sigV4Region)) { - throw new RuntimeException("A region must be supplied for SigV4 request signing."); - } - - if (is_null($this->sigV4Service)) { - $this->setSigV4Service("es"); - } - - $this->handler = new SigV4Handler($this->sigV4Region, $this->sigV4Service, $this->sigV4CredentialProvider, $this->handler); - } - - $sslOptions = null; - if (isset($this->sslKey)) { - $sslOptions['ssl_key'] = $this->sslKey; - } - if (isset($this->sslCert)) { - $sslOptions['cert'] = $this->sslCert; - } - if (isset($this->sslVerification)) { - $sslOptions['verify'] = $this->sslVerification; - } - - if (!is_null($sslOptions)) { - $sslHandler = function (callable $handler, array $sslOptions) { - return function (array $request) use ($handler, $sslOptions) { - // Add our custom headers - foreach ($sslOptions as $key => $value) { - $request['client'][$key] = $value; - } - - // Send the request using the handler and return the response. - return $handler($request); - }; - }; - $this->handler = $sslHandler($this->handler, $sslOptions); - } - - if (is_null($this->serializer)) { - $this->serializer = new SmartSerializer(); - } elseif (is_string($this->serializer)) { - $this->serializer = new $this->serializer(); - } - - $this->connectionParams['client']['port_in_header'] = $this->includePortInHostHeader; - - if (! is_null($this->basicAuthentication)) { - if (isset($this->connectionParams['client']['curl']) === false) { - $this->connectionParams['client']['curl'] = []; - } - - $this->connectionParams['client']['curl'] += [ - CURLOPT_HTTPAUTH => CURLAUTH_BASIC, - CURLOPT_USERPWD => $this->basicAuthentication - ]; - } - - if (is_null($this->connectionFactory)) { - // Make sure we are setting Content-Type and Accept (unless the user has explicitly - // overridden it - if (! isset($this->connectionParams['client']['headers'])) { - $this->connectionParams['client']['headers'] = []; - } - if (! isset($this->connectionParams['client']['headers']['Content-Type'])) { - $this->connectionParams['client']['headers']['Content-Type'] = ['application/json']; - } - if (! isset($this->connectionParams['client']['headers']['Accept'])) { - $this->connectionParams['client']['headers']['Accept'] = ['application/json']; - } - - $this->connectionFactory = new ConnectionFactory($this->handler, $this->connectionParams, $this->serializer, $this->logger, $this->tracer); - } - - if (is_null($this->hosts)) { - $this->hosts = $this->getDefaultHost(); - } - - if (is_null($this->selector)) { - $this->selector = new RoundRobinSelector(); - } elseif (is_string($this->selector)) { - $this->selector = new $this->selector(); - } - - $this->buildTransport(); - - if (is_null($this->endpoint)) { - $serializer = $this->serializer; - - $this->endpoint = function ($class) use ($serializer) { - $fullPath = '\\OpenSearch\\Endpoints\\' . $class; - - $reflection = new ReflectionClass($fullPath); - $constructor = $reflection->getConstructor(); - - if ($constructor && $constructor->getParameters()) { - return new $fullPath($serializer); - } else { - return new $fullPath(); - } - }; - } - - $registeredNamespaces = []; - foreach ($this->registeredNamespacesBuilders as $builder) { - /** - * @var NamespaceBuilderInterface $builder - */ - $registeredNamespaces[$builder->getName()] = $builder->getObject($this->transport, $this->serializer); - } - - return $this->instantiate($this->transport, $this->endpoint, $registeredNamespaces); - } - - protected function instantiate(Transport $transport, callable $endpoint, array $registeredNamespaces): Client - { - return new Client($transport, $endpoint, $registeredNamespaces); - } - - private function buildLoggers(): void - { - if (is_null($this->logger)) { - $this->logger = new NullLogger(); - } - - if (is_null($this->tracer)) { - $this->tracer = new NullLogger(); - } - } - - private function buildTransport(): void - { - $connections = $this->buildConnectionsFromHosts($this->hosts); - - if (is_string($this->connectionPool)) { - $this->connectionPool = new $this->connectionPool( - $connections, - $this->selector, - $this->connectionFactory, - $this->connectionPoolArgs - ); - } - - if (is_null($this->retries)) { - $this->retries = count($connections); - } - - if (is_null($this->transport)) { - $this->transport = new Transport($this->retries, $this->connectionPool, $this->logger, $this->sniffOnStart); - } - } - - private function parseStringOrObject($arg, &$destination, $interface): void - { - if (is_string($arg)) { - $destination = new $arg(); - } elseif (is_object($arg)) { - $destination = $arg; - } else { - throw new InvalidArgumentException("Serializer must be a class path or instantiated object implementing $interface"); - } - } - - private function getDefaultHost(): array - { - return ['localhost:9200']; - } - - /** - * @return ConnectionInterface[] - * @throws RuntimeException - */ - private function buildConnectionsFromHosts(array $hosts): array - { - $connections = []; - foreach ($hosts as $host) { - if (is_string($host)) { - $host = $this->prependMissingScheme($host); - $host = $this->extractURIParts($host); - } elseif (is_array($host)) { - $host = $this->normalizeExtendedHost($host); - } else { - $this->logger->error("Could not parse host: ".print_r($host, true)); - throw new RuntimeException("Could not parse host: ".print_r($host, true)); - } - - $connections[] = $this->connectionFactory->create($host); - } - - return $connections; - } - - /** - * @throws RuntimeException - */ - private function normalizeExtendedHost(array $host): array - { - if (isset($host['host']) === false) { - $this->logger->error("Required 'host' was not defined in extended format: ".print_r($host, true)); - throw new RuntimeException("Required 'host' was not defined in extended format: ".print_r($host, true)); - } - - if (isset($host['scheme']) === false) { - $host['scheme'] = 'http'; - } - if (isset($host['port']) === false) { - $host['port'] = 9200; - } - return $host; - } - - /** - * @throws InvalidArgumentException - */ - private function extractURIParts(string $host): array - { - $parts = parse_url($host); - - if ($parts === false) { - throw new InvalidArgumentException(sprintf('Could not parse URI: "%s"', $host)); - } - - if (isset($parts['port']) !== true) { - $parts['port'] = 9200; - } - - return $parts; - } - - private function prependMissingScheme(string $host): string - { - if (!preg_match("/^https?:\/\//", $host)) { - $host = 'http://' . $host; - } - - return $host; - } - - private function normalizeCredentialProvider($provider): ?callable - { - if ($provider === null || $provider === false) { - return null; - } - - if (is_callable($provider)) { - return $provider; - } - - SigV4Handler::assertDependenciesInstalled(); - - if ($provider === true) { - return CredentialProvider::defaultProvider(); - } - - if ($provider instanceof CredentialsInterface) { - return CredentialProvider::fromCredentials($provider); - } elseif (is_array($provider) && isset($provider['key']) && isset($provider['secret'])) { - return CredentialProvider::fromCredentials( - new Credentials( - $provider['key'], - $provider['secret'], - isset($provider['token']) ? $provider['token'] : null, - isset($provider['expires']) ? $provider['expires'] : null - ) - ); - } - - throw new InvalidArgumentException('Credentials must be an instance of Aws\Credentials\CredentialsInterface, an' - . ' associative array that contains "key", "secret", and an optional "token" key-value pairs, a credentials' - . ' provider function, or true.'); - } -} diff --git a/src/OpenSearch/ConnectionPool/AbstractConnectionPool.php b/src/OpenSearch/ConnectionPool/AbstractConnectionPool.php deleted file mode 100644 index 7d0ea6a6d..000000000 --- a/src/OpenSearch/ConnectionPool/AbstractConnectionPool.php +++ /dev/null @@ -1,95 +0,0 @@ - - */ - protected $connectionPoolParams; - - /** - * @var ConnectionFactoryInterface - */ - protected $connectionFactory; - - /** - * Constructor - * - * @param ConnectionInterface[] $connections The Connections to choose from - * @param SelectorInterface $selector A Selector instance to perform the selection logic for the available connections - * @param ConnectionFactoryInterface $factory ConnectionFactory instance - * @param array $connectionPoolParams - */ - public function __construct(array $connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, array $connectionPoolParams) - { - $paramList = array('connections', 'selector', 'connectionPoolParams'); - foreach ($paramList as $param) { - if (isset($$param) === false) { - throw new InvalidArgumentException('`' . $param . '` parameter must not be null'); - } - } - - if (isset($connectionPoolParams['randomizeHosts']) === true - && $connectionPoolParams['randomizeHosts'] === true - ) { - shuffle($connections); - } - - $this->connections = $connections; - $this->seedConnections = $connections; - $this->selector = $selector; - $this->connectionPoolParams = $connectionPoolParams; - $this->connectionFactory = $factory; - } - - abstract public function nextConnection(bool $force = false): ConnectionInterface; - - abstract public function scheduleCheck(): void; -} diff --git a/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php b/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php deleted file mode 100644 index 42917d51b..000000000 --- a/src/OpenSearch/ConnectionPool/ConnectionPoolInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -current % count($connections)]; - - $this->current += 1; - - return $returnConnection; - } -} diff --git a/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php b/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php deleted file mode 100644 index eeb290863..000000000 --- a/src/OpenSearch/ConnectionPool/Selectors/SelectorInterface.php +++ /dev/null @@ -1,34 +0,0 @@ -current]->isAlive()) { - return $connections[$this->current]; - } - - $this->currentCounter += 1; - $this->current = $this->currentCounter % count($connections); - - return $connections[$this->current]; - } -} diff --git a/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php b/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php deleted file mode 100644 index 29c14d267..000000000 --- a/src/OpenSearch/ConnectionPool/SimpleConnectionPool.php +++ /dev/null @@ -1,48 +0,0 @@ - $connectionPoolParams - */ - public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) - { - parent::__construct($connections, $selector, $factory, $connectionPoolParams); - } - - public function nextConnection(bool $force = false): ConnectionInterface - { - return $this->selector->select($this->connections); - } - - public function scheduleCheck(): void - { - } -} diff --git a/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php b/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php deleted file mode 100644 index 2c6d6b833..000000000 --- a/src/OpenSearch/ConnectionPool/SniffingConnectionPool.php +++ /dev/null @@ -1,181 +0,0 @@ - $connectionPoolParams - */ - public function __construct( - $connections, - SelectorInterface $selector, - ConnectionFactoryInterface $factory, - $connectionPoolParams - ) { - parent::__construct($connections, $selector, $factory, $connectionPoolParams); - - $this->setConnectionPoolParams($connectionPoolParams); - $this->nextSniff = time() + $this->sniffingInterval; - } - - public function nextConnection(bool $force = false): ConnectionInterface - { - $this->sniff($force); - - $size = count($this->connections); - while ($size--) { - /** - * @var Connection $connection - */ - $connection = $this->selector->select($this->connections); - if ($connection->isAlive() === true || $connection->ping() === true) { - return $connection; - } - } - - if ($force === true) { - throw new NoNodesAvailableException("No alive nodes found in your cluster"); - } - - return $this->nextConnection(true); - } - - public function scheduleCheck(): void - { - $this->nextSniff = -1; - } - - private function sniff(bool $force = false): void - { - if ($force === false && $this->nextSniff > time()) { - return; - } - - $total = count($this->connections); - - while ($total--) { - /** - * @var Connection $connection - */ - $connection = $this->selector->select($this->connections); - - if ($connection->isAlive() xor $force) { - continue; - } - - if ($this->sniffConnection($connection) === true) { - return; - } - } - - if ($force === true) { - return; - } - - foreach ($this->seedConnections as $connection) { - /** - * @var Connection $connection - */ - if ($this->sniffConnection($connection) === true) { - return; - } - } - } - - private function sniffConnection(Connection $connection): bool - { - try { - $response = $connection->sniff(); - } catch (OperationTimeoutException $exception) { - return false; - } - - $nodes = $this->parseClusterState($response); - - if (count($nodes) === 0) { - return false; - } - - $this->connections = []; - - foreach ($nodes as $node) { - $nodeDetails = [ - 'host' => $node['host'], - 'port' => $node['port'], - ]; - $this->connections[] = $this->connectionFactory->create($nodeDetails); - } - - $this->nextSniff = time() + $this->sniffingInterval; - - return true; - } - - /** - * @return list - */ - private function parseClusterState($nodeInfo): array - { - $pattern = '/([^:]*):(\d+)/'; - $hosts = []; - - foreach ($nodeInfo['nodes'] as $node) { - if (isset($node['http']) === true && isset($node['http']['publish_address']) === true) { - if (preg_match($pattern, $node['http']['publish_address'], $match) === 1) { - $hosts[] = [ - 'host' => $match[1], - 'port' => (int)$match[2], - ]; - } - } - } - - return $hosts; - } - - /** - * @param array $connectionPoolParams - */ - private function setConnectionPoolParams(array $connectionPoolParams): void - { - $this->sniffingInterval = (int)($connectionPoolParams['sniffingInterval'] ?? 300); - } -} diff --git a/src/OpenSearch/ConnectionPool/StaticConnectionPool.php b/src/OpenSearch/ConnectionPool/StaticConnectionPool.php deleted file mode 100644 index c074e8c8c..000000000 --- a/src/OpenSearch/ConnectionPool/StaticConnectionPool.php +++ /dev/null @@ -1,105 +0,0 @@ - $connectionPoolParams - */ - public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) - { - parent::__construct($connections, $selector, $factory, $connectionPoolParams); - $this->scheduleCheck(); - } - - public function nextConnection(bool $force = false): ConnectionInterface - { - $skipped = []; - - $total = count($this->connections); - while ($total--) { - /** - * @var Connection $connection - */ - $connection = $this->selector->select($this->connections); - if ($connection->isAlive() === true) { - return $connection; - } - - if ($this->readyToRevive($connection) === true) { - if ($connection->ping() === true) { - return $connection; - } - } else { - $skipped[] = $connection; - } - } - - // All "alive" nodes failed, force pings on "dead" nodes - foreach ($skipped as $connection) { - if ($connection->ping() === true) { - return $connection; - } - } - - throw new NoNodesAvailableException("No alive nodes found in your cluster"); - } - - public function scheduleCheck(): void - { - foreach ($this->connections as $connection) { - $connection->markDead(); - } - } - - private function readyToRevive(Connection $connection): bool - { - $timeout = min( - $this->pingTimeout * pow(2, $connection->getPingFailures()), - $this->maxPingTimeout - ); - - if ($connection->getLastPing() + $timeout < time()) { - return true; - } else { - return false; - } - } -} diff --git a/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php b/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php deleted file mode 100644 index a4a85e325..000000000 --- a/src/OpenSearch/ConnectionPool/StaticNoPingConnectionPool.php +++ /dev/null @@ -1,88 +0,0 @@ - $connectionPoolParams - */ - public function __construct($connections, SelectorInterface $selector, ConnectionFactoryInterface $factory, $connectionPoolParams) - { - parent::__construct($connections, $selector, $factory, $connectionPoolParams); - } - - public function nextConnection(bool $force = false): ConnectionInterface - { - $total = count($this->connections); - while ($total--) { - /** - * @var Connection $connection -*/ - $connection = $this->selector->select($this->connections); - if ($connection->isAlive() === true) { - return $connection; - } - - if ($this->readyToRevive($connection) === true) { - return $connection; - } - } - - throw new NoNodesAvailableException("No alive nodes found in your cluster"); - } - - public function scheduleCheck(): void - { - } - - private function readyToRevive(Connection $connection): bool - { - $timeout = min( - $this->pingTimeout * pow(2, $connection->getPingFailures()), - $this->maxPingTimeout - ); - - if ($connection->getLastPing() + $timeout < time()) { - return true; - } else { - return false; - } - } -} diff --git a/src/OpenSearch/Connections/Connection.php b/src/OpenSearch/Connections/Connection.php deleted file mode 100644 index 7279f56cf..000000000 --- a/src/OpenSearch/Connections/Connection.php +++ /dev/null @@ -1,789 +0,0 @@ -> - */ - protected $headers = []; - - /** - * @var bool - */ - protected $isAlive = false; - - /** - * @var float - */ - private $pingTimeout = 1; //TODO expose this - - /** - * @var int - */ - private $lastPing = 0; - - /** - * @var int - */ - private $failedPings = 0; - - /** - * @var mixed[] - */ - private $lastRequest = array(); - - /** - * @var string - */ - private $OSVersion = null; - - /** - * @param array{host: string, port?: int, scheme?: string, user?: string, pass?: string, path?: string} $hostDetails - * @param array{client?: array{headers?: array>, curl?: array}} $connectionParams - */ - public function __construct( - callable $handler, - array $hostDetails, - array $connectionParams, - SerializerInterface $serializer, - LoggerInterface $log, - LoggerInterface $trace - ) { - if (isset($hostDetails['port']) !== true) { - $hostDetails['port'] = 9200; - } - - if (isset($hostDetails['scheme'])) { - $this->transportSchema = $hostDetails['scheme']; - } - - // Only Set the Basic if API Key is not set and setBasicAuthentication was not called prior - if (isset($connectionParams['client']['headers']['Authorization']) === false - && isset($connectionParams['client']['curl'][CURLOPT_HTTPAUTH]) === false - && isset($hostDetails['user']) - && isset($hostDetails['pass']) - ) { - $connectionParams['client']['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_BASIC; - $connectionParams['client']['curl'][CURLOPT_USERPWD] = $hostDetails['user'].':'.$hostDetails['pass']; - } - - $connectionParams['client']['curl'][CURLOPT_PORT] = $hostDetails['port']; - - if (isset($connectionParams['client']['headers'])) { - $this->headers = $connectionParams['client']['headers']; - unset($connectionParams['client']['headers']); - } - - // Add the User-Agent using the format: / (metadata-values) - $this->headers['User-Agent'] = [sprintf( - 'opensearch-php/%s (%s %s; PHP %s)', - Client::VERSION, - PHP_OS, - $this->getOSVersion(), - PHP_VERSION - )]; - - $host = $hostDetails['host']; - $path = null; - if (isset($hostDetails['path']) === true) { - $path = $hostDetails['path']; - } - $port = $hostDetails['port']; - - $this->host = $host; - $this->path = $path; - $this->port = $port; - $this->log = $log; - $this->trace = $trace; - $this->connectionParams = $connectionParams; - $this->serializer = $serializer; - - $this->handler = $this->wrapHandler($handler); - } - - /** - * @param string $method - * @param string $uri - * @param null|array $params - * @param mixed $body - * @param array $options - * @param Transport|null $transport - * @return mixed - */ - public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null) - { - if ($body !== null) { - $body = $this->serializer->serialize($body); - } - - $headers = $this->headers; - if (isset($options['client']['headers']) && is_array($options['client']['headers'])) { - $headers = array_merge($this->headers, $options['client']['headers']); - } - - $host = $this->host; - if (isset($this->connectionParams['client']['port_in_header']) && $this->connectionParams['client']['port_in_header']) { - $host .= ':' . $this->port; - } - - $request = [ - 'http_method' => $method, - 'scheme' => $this->transportSchema, - 'uri' => $this->getURI($uri, $params), - 'body' => $body, - 'headers' => array_merge( - [ - 'Host' => [$host] - ], - $headers - ) - ]; - - $request = array_replace_recursive($request, $this->connectionParams, $options); - - // RingPHP does not like if client is empty - if (empty($request['client'])) { - unset($request['client']); - } - - $handler = $this->handler; - $future = $handler($request, $this, $transport, $options); - - return $future; - } - - public function getTransportSchema(): string - { - return $this->transportSchema; - } - - public function getLastRequestInfo(): array - { - return $this->lastRequest; - } - - private function wrapHandler(callable $handler): callable - { - return function (array $request, Connection $connection, ?Transport $transport, $options) use ($handler) { - $this->lastRequest = []; - $this->lastRequest['request'] = $request; - - // Send the request using the wrapped handler. - $response = Core::proxy( - $handler($request), - function ($response) use ($connection, $transport, $request, $options) { - $this->lastRequest['response'] = $response; - - if (isset($response['error']) === true) { - if ($response['error'] instanceof ConnectException || $response['error'] instanceof RingException) { - $this->log->warning("Curl exception encountered."); - - $exception = $this->getCurlRetryException($request, $response); - - $this->logRequestFail($request, $response, $exception); - - $node = $connection->getHost(); - $this->log->warning("Marking node $node dead."); - $connection->markDead(); - - // If the transport has not been set, we are inside a Ping or Sniff, - // so we don't want to retrigger retries anyway. - // - // TODO this could be handled better, but we are limited because connectionpools do not - // have access to Transport. Architecturally, all of this needs to be refactored - if (isset($transport) === true) { - $transport->connectionPool->scheduleCheck(); - - $neverRetry = isset($request['client']['never_retry']) ? $request['client']['never_retry'] : false; - $shouldRetry = $transport->shouldRetry($request); - $shouldRetryText = ($shouldRetry) ? 'true' : 'false'; - - $this->log->warning("Retries left? $shouldRetryText"); - if ($shouldRetry && !$neverRetry) { - return $transport->performRequest( - $request['http_method'], - $request['uri'], - [], - $request['body'], - $options - ); - } - } - - $this->log->warning("Out of retries, throwing exception from $node"); - // Only throw if we run out of retries - throw $exception; - } else { - // Something went seriously wrong, bail - $exception = new TransportException($response['error']->getMessage()); - $this->logRequestFail($request, $response, $exception); - throw $exception; - } - } else { - $connection->markAlive(); - - if (isset($response['headers']['Warning'])) { - $this->logWarning($request, $response); - } - if (isset($response['body']) === true) { - $response['body'] = stream_get_contents($response['body']); - $this->lastRequest['response']['body'] = $response['body']; - } - - if ($response['status'] >= 400 && $response['status'] < 500) { - $ignore = $request['client']['ignore'] ?? []; - // Skip 404 if succeeded true in the body (e.g. clear_scroll) - $body = $response['body'] ?? ''; - if (strpos($body, '"succeeded":true') !== false) { - $ignore[] = 404; - } - $this->process4xxError($request, $response, $ignore); - } elseif ($response['status'] >= 500) { - $ignore = $request['client']['ignore'] ?? []; - $this->process5xxError($request, $response, $ignore); - } - - // No error, deserialize - $response['body'] = $this->serializer->deserialize($response['body'], $response['transfer_stats']); - } - $this->logRequestSuccess($request, $response); - - return isset($request['client']['verbose']) && $request['client']['verbose'] === true ? $response : $response['body']; - } - ); - - return $response; - }; - } - - /** - * @param array|null $params - */ - private function getURI(string $uri, ?array $params): string - { - if (isset($params) === true && !empty($params)) { - $params = array_map( - function ($value) { - if ($value === true) { - return 'true'; - } elseif ($value === false) { - return 'false'; - } - - return $value; - }, - $params - ); - - $uri .= '?' . http_build_query($params); - } - - if ($this->path !== null) { - $uri = $this->path . $uri; - } - - return $uri; - } - - /** - * @return array> - */ - public function getHeaders(): array - { - return $this->headers; - } - - public function logWarning(array $request, array $response): void - { - $this->log->warning('Deprecation', $response['headers']['Warning']); - } - - /** - * Log a successful request - * - * @param array $request - * @param array $response - * @return void - */ - public function logRequestSuccess(array $request, array $response): void - { - $port = $request['client']['curl'][CURLOPT_PORT] ?? $response['transfer_stats']['primary_port'] ?? ''; - $uri = $this->addPortInUrl($response['effective_url'], (int) $port); - - $this->log->debug('Request Body', array($request['body'])); - $this->log->info( - 'Request Success:', - array( - 'method' => $request['http_method'], - 'uri' => $uri, - 'port' => $port, - 'headers' => $request['headers'], - 'HTTP code' => $response['status'], - 'duration' => $response['transfer_stats']['total_time'], - ) - ); - $this->log->debug('Response', array($response['body'])); - - // Build the curl command for Trace. - $curlCommand = $this->buildCurlCommand($request['http_method'], $uri, $request['body']); - $this->trace->info($curlCommand); - $this->trace->debug( - 'Response:', - array( - 'response' => $response['body'], - 'method' => $request['http_method'], - 'uri' => $uri, - 'port' => $port, - 'HTTP code' => $response['status'], - 'duration' => $response['transfer_stats']['total_time'], - ) - ); - } - - /** - * Log a failed request - * - * @param array $request - * @param array $response - * @param \Throwable $exception - * - * @return void - */ - public function logRequestFail(array $request, array $response, \Throwable $exception): void - { - $port = $request['client']['curl'][CURLOPT_PORT] ?? $response['transfer_stats']['primary_port'] ?? ''; - $uri = $this->addPortInUrl($response['effective_url'], (int) $port); - - $this->log->debug('Request Body', array($request['body'])); - $this->log->warning( - 'Request Failure:', - array( - 'method' => $request['http_method'], - 'uri' => $uri, - 'port' => $port, - 'headers' => $request['headers'], - 'HTTP code' => $response['status'], - 'duration' => $response['transfer_stats']['total_time'], - 'error' => $exception->getMessage(), - ) - ); - $this->log->warning('Response', array($response['body'])); - - // Build the curl command for Trace. - $curlCommand = $this->buildCurlCommand($request['http_method'], $uri, $request['body']); - $this->trace->info($curlCommand); - $this->trace->debug( - 'Response:', - array( - 'response' => $response, - 'method' => $request['http_method'], - 'uri' => $uri, - 'port' => $port, - 'HTTP code' => $response['status'], - 'duration' => $response['transfer_stats']['total_time'], - ) - ); - } - - public function ping(): bool - { - $options = [ - 'client' => [ - 'timeout' => $this->pingTimeout, - 'never_retry' => true, - 'verbose' => true - ] - ]; - try { - $response = $this->performRequest('HEAD', '/', null, null, $options); - $response = $response->wait(); - } catch (TransportException $exception) { - $this->markDead(); - - return false; - } - - if ($response['status'] === 200) { - $this->markAlive(); - - return true; - } else { - $this->markDead(); - - return false; - } - } - - /** - * @return array|\GuzzleHttp\Ring\Future\FutureArray - */ - public function sniff() - { - $options = [ - 'client' => [ - 'timeout' => $this->pingTimeout, - 'never_retry' => true - ] - ]; - - return $this->performRequest('GET', '/_nodes/', null, null, $options); - } - - public function isAlive(): bool - { - return $this->isAlive; - } - - public function markAlive(): void - { - $this->failedPings = 0; - $this->isAlive = true; - $this->lastPing = time(); - } - - public function markDead(): void - { - $this->isAlive = false; - $this->failedPings += 1; - $this->lastPing = time(); - } - - public function getLastPing(): int - { - return $this->lastPing; - } - - public function getPingFailures(): int - { - return $this->failedPings; - } - - public function getHost(): string - { - return $this->host; - } - - public function getUserPass(): ?string - { - return $this->connectionParams['client']['curl'][CURLOPT_USERPWD] ?? null; - } - - public function getPath(): ?string - { - return $this->path; - } - - /** - * @return int - */ - public function getPort() - { - return $this->port; - } - - protected function getCurlRetryException(array $request, array $response): OpenSearchException - { - $exception = null; - $message = $response['error']->getMessage(); - $exception = new MaxRetriesException($message); - switch ($response['curl']['errno']) { - case 6: - $exception = new CouldNotResolveHostException($message, 0, $exception); - break; - case 7: - $exception = new CouldNotConnectToHost($message, 0, $exception); - break; - case 28: - $exception = new OperationTimeoutException($message, 0, $exception); - break; - } - - return $exception; - } - - /** - * Get the OS version using php_uname if available - * otherwise it returns an empty string - * - * @see https://github.com/elastic/elasticsearch-php/issues/922 - */ - private function getOSVersion(): string - { - if ($this->OSVersion === null) { - $this->OSVersion = strpos(strtolower(ini_get('disable_functions')), 'php_uname') !== false - ? '' - : php_uname("r"); - } - return $this->OSVersion; - } - - /** - * Add the port value in the URL if not present - */ - private function addPortInUrl(string $uri, int $port): string - { - if (strpos($uri, ':', 7) !== false) { - return $uri; - } - return preg_replace('#([^/])/([^/])#', sprintf("$1:%s/$2", $port), $uri, 1); - } - - /** - * Construct a string cURL command - */ - private function buildCurlCommand(string $method, string $url, ?string $body): string - { - if (strpos($url, '?') === false) { - $url .= '?pretty=true'; - } else { - str_replace('?', '?pretty=true', $url); - } - - $curlCommand = 'curl -X' . strtoupper($method); - $curlCommand .= " '" . $url . "'"; - - if (isset($body) === true && $body !== '') { - $curlCommand .= " -d '" . $body . "'"; - } - - return $curlCommand; - } - - /** - * @throws OpenSearchException - */ - private function process4xxError(array $request, array $response, array $ignore): void - { - $statusCode = $response['status']; - - /** - * @var \Exception $exception - */ - $exception = $this->tryDeserialize400Error($response); - - if (array_search($response['status'], $ignore) !== false) { - return; - } - - $responseBody = $this->convertBodyToString($response['body'], $statusCode, $exception); - if ($statusCode === 401) { - $exception = new Unauthorized401Exception($responseBody, $statusCode); - } elseif ($statusCode === 403) { - $exception = new Forbidden403Exception($responseBody, $statusCode); - } elseif ($statusCode === 404) { - $exception = new Missing404Exception($responseBody, $statusCode); - } elseif ($statusCode === 409) { - $exception = new Conflict409Exception($responseBody, $statusCode); - } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { - $exception = new ScriptLangNotSupportedException($responseBody. $statusCode); - } elseif ($statusCode === 408) { - $exception = new RequestTimeout408Exception($responseBody, $statusCode); - } else { - $exception = new BadRequest400Exception($responseBody, $statusCode); - } - - $this->logRequestFail($request, $response, $exception); - - throw $exception; - } - - /** - * @throws OpenSearchException - */ - private function process5xxError(array $request, array $response, array $ignore): void - { - $statusCode = (int) $response['status']; - $responseBody = $response['body']; - - /** - * @var \Exception $exception - */ - $exception = $this->tryDeserialize500Error($response); - - $exceptionText = "[$statusCode Server Exception] ".$exception->getMessage(); - $this->log->error($exceptionText); - $this->log->error($exception->getTraceAsString()); - - if (array_search($statusCode, $ignore) !== false) { - return; - } - - if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { - $exception = new RoutingMissingException($exception->getMessage(), $statusCode, $exception); - } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/', $responseBody) === 1) { - $exception = new NoDocumentsToGetException($exception->getMessage(), $statusCode, $exception); - } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { - $exception = new NoShardAvailableException($exception->getMessage(), $statusCode, $exception); - } else { - $exception = new ServerErrorResponseException( - $this->convertBodyToString($responseBody, $statusCode, $exception), - $statusCode - ); - } - - $this->logRequestFail($request, $response, $exception); - - throw $exception; - } - - private function convertBodyToString($body, int $statusCode, Exception $exception): string - { - if (empty($body)) { - return sprintf( - "Unknown %d error from OpenSearch %s", - $statusCode, - $exception->getMessage() - ); - } - // if body is not string, we convert it so it can be used as Exception message - if (!is_string($body)) { - return json_encode($body); - } - return $body; - } - - private function tryDeserialize400Error(array $response): OpenSearchException - { - return $this->tryDeserializeError($response, BadRequest400Exception::class); - } - - private function tryDeserialize500Error(array $response): OpenSearchException - { - return $this->tryDeserializeError($response, ServerErrorResponseException::class); - } - - private function tryDeserializeError(array $response, string $errorClass): OpenSearchException - { - $error = $this->serializer->deserialize($response['body'], $response['transfer_stats']); - if (is_array($error) === true) { - if (isset($error['error']) === false) { - // <2.0 "i just blew up" nonstructured exception - // $error is an array but we don't know the format, reuse the response body instead - // added json_encode to convert into a string - return new $errorClass(json_encode($response['body']), (int) $response['status']); - } - - // 2.0 structured exceptions - if (is_array($error['error']) && array_key_exists('reason', $error['error']) === true) { - // Try to use root cause first (only grabs the first root cause) - $info = $error['error']['root_cause'][0] ?? $error['error']; - $cause = $info['reason']; - $type = $info['type']; - // added json_encode to convert into a string - $original = new $errorClass(json_encode($response['body']), $response['status']); - - return new $errorClass("$type: $cause", (int) $response['status'], $original); - } - // <2.0 semi-structured exceptions - // added json_encode to convert into a string - $original = new $errorClass(json_encode($response['body']), $response['status']); - - $errorEncoded = $error['error']; - if (is_array($errorEncoded)) { - $errorEncoded = json_encode($errorEncoded); - } - return new $errorClass($errorEncoded, (int) $response['status'], $original); - } - - // if responseBody is not string, we convert it so it can be used as Exception message - $responseBody = $response['body']; - if (!is_string($responseBody)) { - $responseBody = json_encode($responseBody); - } - - // <2.0 "i just blew up" nonstructured exception - return new $errorClass($responseBody); - } -} diff --git a/src/OpenSearch/Connections/ConnectionFactory.php b/src/OpenSearch/Connections/ConnectionFactory.php deleted file mode 100644 index f95c2f29f..000000000 --- a/src/OpenSearch/Connections/ConnectionFactory.php +++ /dev/null @@ -1,81 +0,0 @@ ->, curl?: array}} $connectionParams - */ - public function __construct(callable $handler, array $connectionParams, SerializerInterface $serializer, LoggerInterface $logger, LoggerInterface $tracer) - { - $this->handler = $handler; - $this->connectionParams = $connectionParams; - $this->logger = $logger; - $this->tracer = $tracer; - $this->serializer = $serializer; - } - - public function create(array $hostDetails): ConnectionInterface - { - if (isset($hostDetails['path'])) { - $hostDetails['path'] = rtrim($hostDetails['path'], '/'); - } - - return new Connection( - $this->handler, - $hostDetails, - $this->connectionParams, - $this->serializer, - $this->logger, - $this->tracer - ); - } -} diff --git a/src/OpenSearch/Connections/ConnectionFactoryInterface.php b/src/OpenSearch/Connections/ConnectionFactoryInterface.php deleted file mode 100644 index da209abd9..000000000 --- a/src/OpenSearch/Connections/ConnectionFactoryInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -|null $params - * @param mixed $body - * @return mixed - */ - public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], ?Transport $transport = null); -} diff --git a/src/OpenSearch/Handlers/SigV4Handler.php b/src/OpenSearch/Handlers/SigV4Handler.php deleted file mode 100644 index e45639c75..000000000 --- a/src/OpenSearch/Handlers/SigV4Handler.php +++ /dev/null @@ -1,151 +0,0 @@ ->, body: string|resource|null, client?: array} - */ -class SigV4Handler -{ - /** - * @var SignatureV4 - */ - private $signer; - /** - * @var callable - */ - private $credentialProvider; - /** - * @var callable - */ - private $wrappedHandler; - - /** - * A handler that applies an AWS V4 signature before dispatching requests. - * - * @param string $region The region of your Amazon - * OpenSearch Service domain - * @param string $service The Service of your Amazon - * OpenSearch Service domain - * @param callable|null $credentialProvider A callable that returns a - * promise that is fulfilled - * with an instance of - * Aws\Credentials\Credentials - * @param callable|null $wrappedHandler A RingPHP handler - */ - public function __construct( - string $region, - string $service, - ?callable $credentialProvider = null, - ?callable $wrappedHandler = null - ) { - self::assertDependenciesInstalled(); - $this->signer = new SignatureV4($service, $region); - $this->wrappedHandler = $wrappedHandler - ?: ClientBuilder::defaultHandler(); - $this->credentialProvider = $credentialProvider - ?: CredentialProvider::defaultProvider(); - } - - /** - * @phpstan-param RingPhpRequest $request - */ - public function __invoke(array $request) - { - $creds = call_user_func($this->credentialProvider)->wait(); - - $psr7Request = $this->createPsr7Request($request); - $psr7Request = $psr7Request->withHeader('x-amz-content-sha256', Utils::hash($psr7Request->getBody(), 'sha256')); - $signedRequest = $this->signer - ->signRequest($psr7Request, $creds); - return call_user_func($this->wrappedHandler, $this->createRingRequest($signedRequest, $request)); - } - - public static function assertDependenciesInstalled(): void - { - if (!class_exists(SignatureV4::class)) { - throw new RuntimeException( - 'The AWS SDK for PHP must be installed in order to use the SigV4 signing handler' - ); - } - } - - /** - * @phpstan-param RingPhpRequest $ringPhpRequest - */ - private function createPsr7Request(array $ringPhpRequest): Request - { - // fix for uppercase 'Host' array key in elasticsearch-php 5.3.1 and backward compatible - // https://github.com/aws/aws-sdk-php/issues/1225 - $hostKey = isset($ringPhpRequest['headers']['Host']) ? 'Host' : 'host'; - - // Amazon ES/OS listens on standard ports (443 for HTTPS, 80 for HTTP). - // Consequently, the port should be stripped from the host header. - $parsedUrl = parse_url($ringPhpRequest['headers'][$hostKey][0]); - if (isset($parsedUrl['host'])) { - $ringPhpRequest['headers'][$hostKey][0] = $parsedUrl['host']; - } - - // Create a PSR-7 URI from the array passed to the handler - $uri = (new Uri($ringPhpRequest['uri'])) - ->withScheme($ringPhpRequest['scheme']) - ->withHost($ringPhpRequest['headers'][$hostKey][0]); - if (isset($ringPhpRequest['query_string'])) { - $uri = $uri->withQuery($ringPhpRequest['query_string']); - } - - // Create a PSR-7 request from the array passed to the handler - return new Request( - $ringPhpRequest['http_method'], - $uri, - $ringPhpRequest['headers'], - $ringPhpRequest['body'] - ); - } - - /** - * @phpstan-param RingPhpRequest $originalRequest - * - * @phpstan-return RingPhpRequest - */ - private function createRingRequest(RequestInterface $request, array $originalRequest): array - { - $uri = $request->getUri(); - $body = (string) $request->getBody(); - - // RingPHP currently expects empty message bodies to be null: - // https://github.com/guzzle/RingPHP/blob/4c8fe4c48a0fb7cc5e41ef529e43fecd6da4d539/src/Client/CurlFactory.php#L202 - if (empty($body)) { - $body = null; - } - - // Reset the explicit port in the URL - $client = $originalRequest['client']; - unset($client['curl'][CURLOPT_PORT]); - - $ringRequest = [ - 'http_method' => $request->getMethod(), - 'scheme' => $uri->getScheme(), - 'uri' => $uri->getPath(), - 'body' => $body, - 'headers' => $request->getHeaders(), - 'client' => $client - ]; - if ($uri->getQuery()) { - $ringRequest['query_string'] = $uri->getQuery(); - } - - return $ringRequest; - } -} diff --git a/src/OpenSearch/Transport.php b/src/OpenSearch/Transport.php deleted file mode 100644 index df6b5b983..000000000 --- a/src/OpenSearch/Transport.php +++ /dev/null @@ -1,178 +0,0 @@ -log = $log; - $this->connectionPool = $connectionPool; - $this->retries = $retries; - - if ($sniffOnStart === true) { - $this->log->notice('Sniff on Start.'); - $this->connectionPool->scheduleCheck(); - } - } - - /** - * Returns a single connection from the connection pool - * Potentially performs a sniffing step before returning - */ - public function getConnection(): ConnectionInterface - { - return $this->connectionPool->nextConnection(); - } - - /** - * Perform a request to the Cluster - * - * @param string $method HTTP method to use - * @param string $uri HTTP URI to send request to - * @param array $params Optional query parameters - * @param mixed|null $body Optional query body - * @param array $options - * - * @throws Common\Exceptions\NoNodesAvailableException|\Exception - */ - public function performRequest(string $method, string $uri, array $params = [], $body = null, array $options = []): FutureArrayInterface - { - try { - $connection = $this->getConnection(); - } catch (Exceptions\NoNodesAvailableException $exception) { - $this->log->critical('No alive nodes found in cluster'); - throw $exception; - } - - $response = []; - $caughtException = null; - $this->lastConnection = $connection; - - $future = $connection->performRequest( - $method, - $uri, - $params, - $body, - $options, - $this - ); - - $future->promise()->then( - //onSuccess - function ($response) { - $this->retryAttempts = 0; - // Note, this could be a 4xx or 5xx error - }, - //onFailure - function ($response) { - $code = $response->getCode(); - // Ignore 400 level errors, as that means the server responded just fine - if ($code < 400 || $code >= 500) { - // Otherwise schedule a check - $this->connectionPool->scheduleCheck(); - } - } - ); - - return $future; - } - - /** - * @param FutureArrayInterface $result Response of a request (promise) - * @param array $options Options for transport - * - * @return callable|array - */ - public function resultOrFuture(FutureArrayInterface $result, array $options = []) - { - $response = null; - $async = isset($options['client']['future']) ? $options['client']['future'] : null; - if (is_null($async) || $async === false) { - do { - $result = $result->wait(); - } while ($result instanceof FutureArrayInterface); - } - return $result; - } - - public function shouldRetry(array $request): bool - { - if ($this->retryAttempts < $this->retries) { - $this->retryAttempts += 1; - - return true; - } - - return false; - } - - /** - * Returns the last used connection so that it may be inspected. Mainly - * for debugging/testing purposes. - */ - public function getLastConnection(): ConnectionInterface - { - return $this->lastConnection; - } -} diff --git a/src/OpenSearch/Serializers/ArrayToJSONSerializer.php b/src/Serializers/ArrayToJSONSerializer.php similarity index 100% rename from src/OpenSearch/Serializers/ArrayToJSONSerializer.php rename to src/Serializers/ArrayToJSONSerializer.php diff --git a/src/OpenSearch/Serializers/EverythingToJSONSerializer.php b/src/Serializers/EverythingToJSONSerializer.php similarity index 90% rename from src/OpenSearch/Serializers/EverythingToJSONSerializer.php rename to src/Serializers/EverythingToJSONSerializer.php index fc1c40515..2b4b963b8 100644 --- a/src/OpenSearch/Serializers/EverythingToJSONSerializer.php +++ b/src/Serializers/EverythingToJSONSerializer.php @@ -23,11 +23,6 @@ use OpenSearch\Common\Exceptions\RuntimeException; -if (!defined('JSON_INVALID_UTF8_SUBSTITUTE')) { - //PHP < 7.2 Define it as 0 so it does nothing - define('JSON_INVALID_UTF8_SUBSTITUTE', 0); -} - class EverythingToJSONSerializer implements SerializerInterface { /** diff --git a/src/OpenSearch/Serializers/SerializerInterface.php b/src/Serializers/SerializerInterface.php similarity index 100% rename from src/OpenSearch/Serializers/SerializerInterface.php rename to src/Serializers/SerializerInterface.php diff --git a/src/OpenSearch/Serializers/SmartSerializer.php b/src/Serializers/SmartSerializer.php similarity index 100% rename from src/OpenSearch/Serializers/SmartSerializer.php rename to src/Serializers/SmartSerializer.php diff --git a/src/Transport.php b/src/Transport.php new file mode 100644 index 000000000..18fd7b8ff --- /dev/null +++ b/src/Transport.php @@ -0,0 +1,165 @@ +transport = $transport; + } + + + /** + * Perform a request to the Cluster + * + * @param string $method HTTP method to use + * @param string $uri HTTP URI to send request to + * @param array $params Optional query parameters + * @param mixed|null $body Optional query body + * @param array $options + * + * @throws \OpenSearch\Common\Exceptions\NoNodesAvailableException|\Exception + */ + public function performRequest( + string $method, + string $uri, + array $params = [], + mixed $body = null, + array $options = [] + ): ResponseInterface { + if (! empty($params)) { + $uri .= '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986); + } + + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + + $request = $requestFactory->createRequest( + $method, + $uri + ); + + if ($body) { + $request + ->withHeader('Content-Type', 'application/json') + ->withBody($requestFactory->createStream(json_encode($body, JSON_THROW_ON_ERROR))); + } + + return $this->transport->sendRequest($request->withHeader('Accept', 'application/json')); + } + + public function resultOrFuture(ResponseInterface $response) + { + if ( + $response->getStatusCode() >= StatusCodeInterface::STATUS_BAD_REQUEST && + $response->getStatusCode() < StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR + ) { + $this->handleClientErrorResponse($response); + } + + if ($response->getStatusCode() >= StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR) { + $this->handleServerErrorResponse($response); + } + + if (str_starts_with($response->getHeader('Content-Type')[0], 'application/json')) { + return json_decode($response->getBody()->getContents(), true); + } + + throw new Exceptions\ClientErrorResponseException( + $response->getBody()->getContents(), + $response->getStatusCode(), + ); + } + + private function handleClientErrorResponse(ResponseInterface $response): void + { + $body = $response->getBody()->getContents(); + + switch ($response->getStatusCode()) { + case StatusCodeInterface::STATUS_UNAUTHORIZED: + throw new Exceptions\Unauthorized401Exception($body, $response->getStatusCode()); + case StatusCodeInterface::STATUS_FORBIDDEN: + throw new Exceptions\Forbidden403Exception($body, $response->getStatusCode()); + case StatusCodeInterface::STATUS_NOT_FOUND: + throw new Exceptions\Missing404Exception($body, $response->getStatusCode()); + case StatusCodeInterface::STATUS_CONFLICT: + throw new Exceptions\Conflict409Exception($body, $response->getStatusCode()); + case StatusCodeInterface::STATUS_REQUEST_TIMEOUT: + throw new Exceptions\RequestTimeout408Exception($body, $response->getStatusCode()); + default: + if ( + $response->getStatusCode() === StatusCodeInterface::STATUS_BAD_REQUEST && + str_contains($body, 'script_lang not supported') + ) { + throw new Exceptions\ScriptLangNotSupportedException($body, $response->getStatusCode()); + } + + throw new Exceptions\BadRequest400Exception($body, $response->getStatusCode()); + } + } + + private function handleServerErrorResponse(ResponseInterface $response): void + { + $responseBody = $response->getBody()->getContents(); + $statusCode = $response->getStatusCode(); + + if ( + $statusCode === StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR && + str_contains($responseBody, "RoutingMissingException") + ) { + throw new Exceptions\RoutingMissingException($responseBody, $statusCode); + } elseif ( + $statusCode === StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR && + preg_match('/ActionRequestValidationException.+ no documents to get/', $responseBody) === 1 + ) { + throw new Exceptions\NoDocumentsToGetException($responseBody, $statusCode); + } elseif ( + $statusCode === StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR && + str_contains($responseBody, 'NoShardAvailableActionException') + ) { + throw new Exceptions\NoShardAvailableException($responseBody, $statusCode); + } else { + throw new Exceptions\ServerErrorResponseException( + $responseBody, + $statusCode + ); + } + } + + public function getLastResponse(): ResponseInterface + { + return $this->transport->getLastResponse(); + } + + public function getLastRequest(): RequestInterface + { + return $this->transport->getLastRequest(); + } +} diff --git a/tests/ClientBuilderTest.php b/tests/ClientBuilderTest.php index 751e3895d..28fef4c43 100644 --- a/tests/ClientBuilderTest.php +++ b/tests/ClientBuilderTest.php @@ -29,92 +29,6 @@ class ClientBuilderTest extends TestCase { - /** - * @see https://github.com/elastic/elasticsearch-php/issues/993 - */ - public function testIncludePortInHostHeader() - { - $host = "localhost"; - $url = "$host:1234"; - $params = [ - 'client' => [ - 'verbose' => true - ] - ]; - $client = ClientBuilder::create() - ->setConnectionParams($params) - ->setHosts([$url]) - ->includePortInHostHeader(true) - ->build(); - - $this->assertInstanceOf(Client::class, $client); - - try { - $result = $client->info(); - } catch (OpenSearchException $e) { - $request = $client->transport->getLastConnection()->getLastRequestInfo(); - $this->assertTrue(isset($request['request']['headers']['Host'][0])); - $this->assertEquals($url, $request['request']['headers']['Host'][0]); - } - } - - /** - * @see https://github.com/elastic/elasticsearch-php/issues/993 - */ - public function testNotIncludePortInHostHeaderAsDefault() - { - $host = "localhost"; - $url = "$host:1234"; - $params = [ - 'client' => [ - 'verbose' => true - ] - ]; - $client = ClientBuilder::create() - ->setConnectionParams($params) - ->setHosts([$url]) - ->build(); - - $this->assertInstanceOf(Client::class, $client); - - try { - $result = $client->info(); - } catch (OpenSearchException $e) { - $request = $client->transport->getLastConnection()->getLastRequestInfo(); - $this->assertTrue(isset($request['request']['headers']['Host'][0])); - $this->assertEquals($host, $request['request']['headers']['Host'][0]); - } - } - - /** - * @see https://github.com/elastic/elasticsearch-php/issues/993 - */ - public function testNotIncludePortInHostHeader() - { - $host = "localhost"; - $url = "$host:1234"; - $params = [ - 'client' => [ - 'verbose' => true - ] - ]; - $client = ClientBuilder::create() - ->setConnectionParams($params) - ->setHosts([$url]) - ->includePortInHostHeader(false) - ->build(); - - $this->assertInstanceOf(Client::class, $client); - - try { - $result = $client->info(); - } catch (OpenSearchException $e) { - $request = $client->transport->getLastConnection()->getLastRequestInfo(); - $this->assertTrue(isset($request['request']['headers']['Host'][0])); - $this->assertEquals($host, $request['request']['headers']['Host'][0]); - } - } - public function getConfig() { return [ @@ -161,16 +75,6 @@ public function testFromConfigQuiteFalseWithUnknownKey() ); } - public function testFromConfigUsingBasicAuthentication() - { - $config = [ - 'basicAuthentication' => ["foo", "bar"], - 'connectionParams' => [], - ]; - $client = ClientBuilder::fromConfig($config); - - $this->assertEquals('foo:bar', $client->transport->getConnection()->getUserPass()); - } public function testCompatibilityHeaderDefaultIsOff() { @@ -180,36 +84,9 @@ public function testCompatibilityHeaderDefaultIsOff() try { $client->info(); } catch (OpenSearchException $e) { - $request = $client->transport->getLastConnection()->getLastRequestInfo(); - $this->assertSame(['application/json'], $request['request']['headers']['Content-Type']); - $this->assertSame(['application/json'], $request['request']['headers']['Accept']); - } - } - - public function testFromConfigWithIncludePortInHostHeader() - { - $url = 'localhost:1234'; - $config = [ - 'hosts' => [$url], - 'includePortInHostHeader' => true, - 'connectionParams' => [ - 'client' => [ - 'verbose' => true - ] - ], - ]; - - $client = ClientBuilder::fromConfig($config); - - $this->assertInstanceOf(Client::class, $client); - - try { - $client->info(); - $this->assertTrue(false, 'Exception was not thrown!'); - } catch (OpenSearchException $e) { - $request = $client->transport->getLastConnection()->getLastRequestInfo(); - $this->assertTrue(isset($request['request']['headers']['Host'][0])); - $this->assertEquals($url, $request['request']['headers']['Host'][0]); + $request = $client->transport->getLastRequest(); + $this->assertSame(['application/json'], $request->getHeader('Content-Type')); + $this->assertSame(['application/json'], $request->getHeader('Accept')); } } } diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 434706078..1b6f7c180 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -21,8 +21,6 @@ namespace OpenSearch\Tests; -use GuzzleHttp\Ring\Client\MockHandler; -use GuzzleHttp\Ring\Future\FutureArray; use Mockery as m; use OpenSearch; use OpenSearch\Client; @@ -41,14 +39,6 @@ public function tearDown(): void m::close(); } - public function testConstructorIllegalPort() - { - $this->expectException(\OpenSearch\Common\Exceptions\InvalidArgumentException::class); - $this->expectExceptionMessage('Could not parse URI'); - - $client = OpenSearch\ClientBuilder::create()->setHosts(['localhost:abc'])->build(); - } - public function testFromConfig() { $params = [ @@ -56,7 +46,6 @@ public function testFromConfig() 'localhost:9200' ], 'retries' => 2, - 'handler' => ClientBuilder::multiHandler() ]; $client = ClientBuilder::fromConfig($params); @@ -102,8 +91,8 @@ public function testIndexCannotBeNullForDelete() $client->delete( [ - 'index' => null, - 'id' => 'test' + 'index' => null, + 'id' => 'test' ] ); } @@ -117,8 +106,8 @@ public function testIdCannotBeNullForDelete() $client->delete( [ - 'index' => 'test', - 'id' => null + 'index' => 'test', + 'id' => null ] ); } @@ -173,231 +162,6 @@ public function testMaxRetriesException() } } - public function testInlineHosts() - { - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'localhost:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("localhost", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'http://localhost:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("localhost", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'http://foo.com:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'https://foo.com:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("https", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'https://user:pass@foo.com:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("https", $host->getTransportSchema()); - $this->assertSame("user:pass", $host->getUserPass()); - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - 'https://user:pass@the_foo.com:9200' - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("the_foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("https", $host->getTransportSchema()); - $this->assertSame("user:pass", $host->getUserPass()); - } - - public function testExtendedHosts() - { - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'localhost', - 'port' => 9200, - 'scheme' => 'http' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("localhost", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com', - 'port' => 9200, - 'scheme' => 'http' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com', - 'port' => 9200, - 'scheme' => 'https' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("https", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com', - 'scheme' => 'http' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com', - 'port' => 9500, - 'scheme' => 'https' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9500, $host->getPort()); - $this->assertSame("https", $host->getTransportSchema()); - - - try { - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'port' => 9200, - 'scheme' => 'http' - ] - ] - )->build(); - $this->fail("Expected RuntimeException from missing host, none thrown"); - } catch (OpenSearch\Common\Exceptions\RuntimeException $e) { - // good - } - - // Underscore host, questionably legal - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'the_foo.com' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("the_foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - - - // Special characters in user/pass, would break inline - $client = OpenSearch\ClientBuilder::create()->setHosts( - [ - [ - 'host' => 'foo.com', - 'user' => 'user', - 'pass' => 'abc#$@?%!abc' - ] - ] - )->build(); - $host = $client->transport->getConnection(); - $this->assertSame("foo.com", $host->getHost()); - $this->assertSame(9200, $host->getPort()); - $this->assertSame("http", $host->getTransportSchema()); - $this->assertSame("user:abc#$@?%!abc", $host->getUserPass()); - } - - public function testClientLazy() - { - $handler = new MockHandler([ - 'status' => 200, - 'transfer_stats' => [ - 'total_time' => 100 - ], - 'body' => '{test}', - 'effective_url' => 'localhost' - ]); - $builder = ClientBuilder::create(); - $builder->setHosts(['somehost']); - $builder->setHandler($handler); - $client = $builder->build(); - - $params = [ - 'client' => [ - 'future' => 'lazy', - ] - ]; - $result = $client->info($params); - $this->assertInstanceOf(FutureArray::class, $result); - } - public function testExtractArgumentIterable() { $client = OpenSearch\ClientBuilder::create()->build(); diff --git a/tests/ConnectionPool/ConnectionFactoryTest.php b/tests/ConnectionPool/ConnectionFactoryTest.php deleted file mode 100644 index 98e1e1121..000000000 --- a/tests/ConnectionPool/ConnectionFactoryTest.php +++ /dev/null @@ -1,66 +0,0 @@ -create(['host' => 'localhost']); - static::assertNull($connection->getPath()); - } - - /** - * @dataProvider pathDataProvider - */ - public function testConnectionWithPath(string $path, string $expectedPath): void - { - $factory = new ConnectionFactory( - function () { - }, - [], - new ArrayToJSONSerializer(), - new NullLogger(), - new NullLogger() - ); - - $connection = $factory->create(['host' => 'localhost', 'path' => $path]); - static::assertSame($expectedPath, $connection->getPath()); - } - - public function pathDataProvider(): array - { - return [ - ['/', ''], - ['/foo', '/foo'], - ['/foo/', '/foo'], - ]; - } -} diff --git a/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php b/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php deleted file mode 100644 index b3c8c3e10..000000000 --- a/tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php +++ /dev/null @@ -1,114 +0,0 @@ -getMockBuilder(ConnectionInterface::class) - ->disableOriginalConstructor() - ->getMock(); - } - - // select ten - $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[7], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[8], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[9], $roundRobin->select($mockConnections)); - - // select five - should start from the first one (index: 0) - $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); - } - - /** - * Add Ten connections, select five, remove three, test another 10 to check - * that the round-robining works after removing connections - * - * @covers \OpenSearch\ConnectionPool\Selectors\RoundRobinSelector::select - * - * @return void - */ - public function testAddTenConnectionsTestFiveRemoveThreeTestTen() - { - $roundRobin = new OpenSearch\ConnectionPool\Selectors\RoundRobinSelector(); - - $mockConnections = []; - foreach (range(0, 9) as $index) { - $mockConnections[$index] = $this->getMockBuilder(ConnectionInterface::class) - ->disableOriginalConstructor() - ->getMock(); - } - - // select five - $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); - - // remove three - unset($mockConnections[8]); - unset($mockConnections[9]); - - // select ten after removal - $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[7], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); - $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); - } -} diff --git a/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php b/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php deleted file mode 100644 index af6fae3b3..000000000 --- a/tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php +++ /dev/null @@ -1,80 +0,0 @@ -expects('isAlive')->times(16)->andReturns(true); - - $mockConnections[] = $mockConnection; - - foreach (range(0, 9) as $index) { - $mockConnections[] = m::mock(ConnectionInterface::class); - } - - foreach (range(0, 15) as $index) { - $retConnection = $roundRobin->select($mockConnections); - - $this->assertSame($mockConnections[0], $retConnection); - } - } - - public function testTenConnectionsFirstDies() - { - $roundRobin = new OpenSearch\ConnectionPool\Selectors\StickyRoundRobinSelector(); - - $mockConnections = []; - $mockConnectionNotAlive = m::mock(ConnectionInterface::class); - $mockConnectionNotAlive->expects('isAlive')->andReturns(false); - - $mockConnections[] = $mockConnectionNotAlive; - - $mockConnectionAlive = m::mock(ConnectionInterface::class); - $mockConnectionAlive->expects('isAlive')->times(15)->andReturns(true); - - $mockConnections[] = $mockConnectionAlive; - - foreach (range(0, 8) as $index) { - $mockConnections[] = m::mock(ConnectionInterface::class); - } - - foreach (range(0, 15) as $index) { - $retConnection = $roundRobin->select($mockConnections); - - $this->assertSame($mockConnections[1], $retConnection); - } - } -} diff --git a/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php b/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php deleted file mode 100644 index e73b17948..000000000 --- a/tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php +++ /dev/null @@ -1,50 +0,0 @@ -setHosts([Utility::getHost()]) - ->setConnectionPool(SniffingConnectionPool::class, ['sniffingInterval' => 10]) - ->setSSLVerification(false) - ->build(); - - $pinged = $client->ping(); - $this->assertTrue($pinged); - } -} diff --git a/tests/ConnectionPool/SniffingConnectionPoolTest.php b/tests/ConnectionPool/SniffingConnectionPoolTest.php deleted file mode 100644 index 5935b14eb..000000000 --- a/tests/ConnectionPool/SniffingConnectionPoolTest.php +++ /dev/null @@ -1,293 +0,0 @@ -clusterState(1); - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(true); - $connection->method('sniff')->willReturn($clusterState); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturn($connection); - - $connectionPool = new SniffingConnectionPool( - [$connection], - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->assertSame($connection, $connectionPool->nextConnection()); - } - - /** @test */ - public function itShouldSniffNewConnectionsWhenPossible(): void - { - $clusterState = $this->clusterState(2); - $originalConnection = $this->createMock(Connection::class); - $originalConnection->method('isAlive')->willReturn(false); - $originalConnection->method('sniff')->willReturn($clusterState); - $discoveredConnection = $this->createMock(Connection::class); - $discoveredConnection->method('isAlive')->willReturn(true); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls($originalConnection, $discoveredConnection); - - $connectionPool = new SniffingConnectionPool( - [$originalConnection], - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $actualConnection = $connectionPool->nextConnection(); - - $this->assertSame($discoveredConnection, $actualConnection); - } - - /** @test */ - public function forceNextConnection(): void - { - $clusterState = $this->clusterState(2); - $firstConnection = $this->createMock(Connection::class); - $firstConnection->method('isAlive')->willReturn(true); - $firstConnection->method('sniff')->willReturn($clusterState); - $secondConnection = $this->createMock(Connection::class); - $secondConnection->method('isAlive')->willReturn(true); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls($firstConnection, $secondConnection); - - $connectionPool = new SniffingConnectionPool( - [$firstConnection, $secondConnection], - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->assertSame($secondConnection, $connectionPool->nextConnection(true)); - } - - - /** @test */ - public function itShouldReturnFirstSeededConnectionIfAlive(): void - { - $clusterState = $this->clusterState(10); - $connections = []; - for ($i = 1; $i <= 10; $i++) { - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(true); - $connection->method('sniff')->willReturn($clusterState); - $connections[] = $connection; - } - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls(...$connections); - - $connectionPool = new SniffingConnectionPool( - $connections, - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->assertSame($connections[0], $connectionPool->nextConnection()); - } - - /** @test */ - public function itShouldReturnTheFirstAvailableConnection(): void - { - $clusterState = $this->clusterState(10); - $connections = []; - for ($i = 1; $i <= 10; $i++) { - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(false); - $connection->method('sniff')->willReturn($clusterState); - $connections[] = $connection; - } - $randomLiveConnectionIndex = random_int(0, 9); - $connections[$randomLiveConnectionIndex] = $this->createMock(Connection::class); - $connections[$randomLiveConnectionIndex]->method('isAlive')->willReturn(true); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls(...$connections); - - $connectionPool = new SniffingConnectionPool( - $connections, - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->assertSame($connections[$randomLiveConnectionIndex], $connectionPool->nextConnection()); - } - - /** @test */ - public function itShouldFailIfAllNodesAreDown(): void - { - $clusterState = $this->clusterState(10); - $connections = []; - for ($i = 1; $i <= 10; $i++) { - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(false); - $connection->method('sniff')->willReturn($clusterState); - $connections[] = $connection; - } - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls(...$connections); - - $connectionPool = new SniffingConnectionPool( - $connections, - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->expectException(NoNodesAvailableException::class); - - $connectionPool->nextConnection(); - } - - /** @test */ - public function sniffShouldStopIfAllSniffRequestsFail(): void - { - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(false); - $connection->method('sniff')->willThrowException(new OperationTimeoutException()); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - - $connectionPool = new SniffingConnectionPool( - [$connection], - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->expectException(NoNodesAvailableException::class); - $connectionFactory->expects($this->never())->method('create'); - - $connectionPool->nextConnection(); - } - - /** @test */ - public function sniffShouldStopIfNodesAreEmpty(): void - { - $clusterState = $this->clusterState(0); - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(false); - $connection->method('sniff')->willReturn($clusterState); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - - $connectionPool = new SniffingConnectionPool( - [$connection], - $selector, - $connectionFactory, - ['sniffingInterval' => 0] - ); - - $this->expectException(NoNodesAvailableException::class); - $connectionFactory->expects($this->never())->method('create'); - - $connectionPool->nextConnection(); - } - - /** @test */ - public function itShouldNotSniffBeforeScheduledSniffTime(): void - { - $connection = $this->createMock(Connection::class); - $connection->method('isAlive')->willReturn(false); - $connection->method('sniff')->willReturn($this->clusterState(2)); - $selector = new RoundRobinSelector(); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - - $connectionPool = new SniffingConnectionPool( - [$connection], - $selector, - $connectionFactory, - ['sniffingInterval' => 300] - ); - - $connectionFactory->expects($this->never())->method('create'); - $this->expectException(NoNodesAvailableException::class); - - $connectionPool->nextConnection(); - } - - /** @test */ - public function scheduleCheck(): void - { - $clusterState = $this->clusterState(2); - $firstConnection = $this->createMock(Connection::class); - $firstConnection->method('isAlive')->willReturn(true); - $firstConnection->method('sniff')->willReturn($clusterState); - $secondConnection = $this->createMock(Connection::class); - $secondConnection->method('isAlive')->willReturn(true); - $selector = $this->createMock(RoundRobinSelector::class); - $selector->expects($this->exactly(2))->method('select')->willReturnOnConsecutiveCalls( - $firstConnection, - $secondConnection - ); - $connectionFactory = $this->createMock(ConnectionFactoryInterface::class); - $connectionFactory->method('create')->willReturnOnConsecutiveCalls($firstConnection, $secondConnection); - - $connectionPool = new SniffingConnectionPool( - [$firstConnection], - $selector, - $connectionFactory, - ['sniffingInterval' => 300] - ); - - $connectionPool->scheduleCheck(); - - $this->assertSame($secondConnection, $connectionPool->nextConnection()); - } - - private function clusterState(int $numberOfNodes): array - { - $clusterState = ['nodes' => []]; - - for ($i = 1; $i <= $numberOfNodes; $i++) { - $clusterState['nodes']["node-$i"] = [ - 'http' => [ - 'publish_address' => "172.17.0.2:920$i", - ], - ]; - } - - return $clusterState; - } -} diff --git a/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php b/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php deleted file mode 100644 index 0f3462c34..000000000 --- a/tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php +++ /dev/null @@ -1,66 +0,0 @@ -host = Utility::getHost(); - } - - // Issue #636 - public function test404Liveness() - { - $client = \OpenSearch\ClientBuilder::create() - ->setHosts([$this->host]) - ->setConnectionPool(\OpenSearch\ConnectionPool\StaticConnectionPool::class) - ->setSSLVerification(false) - ->build(); - - $connection = $client->transport->getConnection(); - - // Ensure connection is dead - $connection->markDead(); - - // The index doesn't exist, but the server is up so this will return a 404 - $this->assertFalse($client->indices()->exists(['index' => 'not_existing_index'])); - - // But the node should be marked as alive since the server responded - $this->assertTrue($connection->isAlive()); - } -} diff --git a/tests/ConnectionPool/StaticConnectionPoolTest.php b/tests/ConnectionPool/StaticConnectionPoolTest.php deleted file mode 100644 index c355253f1..000000000 --- a/tests/ConnectionPool/StaticConnectionPoolTest.php +++ /dev/null @@ -1,225 +0,0 @@ -expects('isAlive')->andReturns(true); - $mockConnection->expects('markDead'); - - /** - * @var \OpenSearch\Connections\ConnectionInterface[]&\Mockery\MockInterface[] $connections - */ - $connections = [$mockConnection]; - - $selector = m::mock(SelectorInterface::class); - $selector->allows('select') - ->andReturns($connections[0]) - ->getMock(); - - $connectionFactory = m::mock(ConnectionFactory::class); - - $connectionPoolParams = [ - 'randomizeHosts' => false, - ]; - $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); - - $retConnection = $connectionPool->nextConnection(); - - $this->assertSame($mockConnection, $retConnection); - } - - public function testAddMultipleHostsThenGetFirst() - { - $connections = []; - - foreach (range(1, 10) as $index) { - $mockConnection = m::mock(Connection::class); - $mockConnection->expects('isAlive')->between(0, 1)->andReturns(true); - $mockConnection->expects('markDead')->once(); - - $connections[] = $mockConnection; - } - - $selector = m::mock(SelectorInterface::class); - $selector->allows('select') - ->andReturns($connections[0]); - - $connectionFactory = m::mock(ConnectionFactory::class); - - $connectionPoolParams = [ - 'randomizeHosts' => false, - ]; - $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); - - $retConnection = $connectionPool->nextConnection(); - - $this->assertSame($connections[0], $retConnection); - } - - public function testAllHostsFailPing() - { - $connections = []; - - foreach (range(1, 10) as $index) { - $mockConnection = m::mock(Connection::class); - $mockConnection->expects('ping')->andReturns(false); - $mockConnection->expects('isAlive')->andReturns(false); - $mockConnection->expects('markDead'); - $mockConnection->expects('getPingFailures')->andReturns(0); - $mockConnection->expects('getLastPing')->andReturns(time()); - - $connections[] = $mockConnection; - } - - $selector = m::mock(SelectorInterface::class); - $selector->allows('select')->andReturnValues($connections); - - $connectionFactory = m::mock(ConnectionFactory::class); - - $connectionPoolParams = [ - 'randomizeHosts' => false, - ]; - $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); - - $this->expectException(NoNodesAvailableException::class); - $this->expectExceptionMessage('No alive nodes found in your cluster'); - - $connectionPool->nextConnection(); - } - - public function testAllExceptLastHostFailPingRevivesInSkip() - { - $connections = []; - - foreach (range(1, 9) as $index) { - $mockConnection = m::mock(Connection::class); - $mockConnection->expects('ping')->andReturns(false); - $mockConnection->expects('isAlive')->andReturns(false); - $mockConnection->expects('markDead'); - $mockConnection->expects('getPingFailures')->andReturns(0); - $mockConnection->expects('getLastPing')->andReturns(time()); - - $connections[] = $mockConnection; - } - - $goodConnection = m::mock(Connection::class); - $goodConnection->expects('ping')->andReturns(true); - $goodConnection->expects('isAlive')->andReturns(false); - $goodConnection->expects('markDead'); - $goodConnection->expects('getPingFailures')->andReturns(0); - $goodConnection->expects('getLastPing')->andReturns(time()); - - $connections[] = $goodConnection; - - $selector = m::mock(SelectorInterface::class); - $selector->allows('select')->andReturnValues($connections); - - $connectionFactory = m::mock(ConnectionFactory::class); - - $connectionPoolParams = [ - 'randomizeHosts' => false, - ]; - $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); - - $ret = $connectionPool->nextConnection(); - $this->assertSame($goodConnection, $ret); - } - - public function testAllExceptLastHostFailPingRevivesPreSkip() - { - $connections = []; - - foreach (range(1, 9) as $index) { - $mockConnection = m::mock(Connection::class); - $mockConnection->expects('ping')->between(0, 1)->andReturns(false); - $mockConnection->expects('isAlive')->andReturns(false); - $mockConnection->expects('markDead'); - $mockConnection->expects('getPingFailures')->andReturns(0); - $mockConnection->expects('getLastPing')->andReturns(time()); - - $connections[] = $mockConnection; - } - - $goodConnection = m::mock(Connection::class); - $goodConnection->expects('ping')->andReturns(true); - $goodConnection->expects('isAlive')->andReturns(false); - $goodConnection->expects('markDead'); - $goodConnection->expects('getPingFailures')->andReturns(0); - $goodConnection->expects('getLastPing')->andReturns(time() - 10000); - - $connections[] = $goodConnection; - - $selector = m::mock(SelectorInterface::class); - $selector->allows('select')->andReturnValues($connections); - - $connectionFactory = m::mock(ConnectionFactory::class); - - $connectionPoolParams = [ - 'randomizeHosts' => false, - ]; - $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); - - $ret = $connectionPool->nextConnection(); - $this->assertSame($goodConnection, $ret); - } - - public function testCustomConnectionPoolIT() - { - $clientBuilder = ClientBuilder::create(); - $clientBuilder->setHosts(['localhost:1']); - $client = $clientBuilder - ->setRetries(0) - ->setConnectionPool(StaticConnectionPool::class, []) - ->build(); - - $this->expectException(NoNodesAvailableException::class); - $this->expectExceptionMessage('No alive nodes found in your cluster'); - - $client->search([]); - } -} diff --git a/tests/Connections/ConnectionTest.php b/tests/Connections/ConnectionTest.php deleted file mode 100644 index ee04491ab..000000000 --- a/tests/Connections/ConnectionTest.php +++ /dev/null @@ -1,504 +0,0 @@ -logger = $this->createMock(LoggerInterface::class); - $this->trace = $this->createMock(LoggerInterface::class); - $this->serializer = $this->createMock(SerializerInterface::class); - } - - public function testConstructor() - { - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - function () { - }, - $host, - [], - $this->serializer, - $this->logger, - $this->trace - ); - - $this->assertInstanceOf(Connection::class, $connection); - } - - /** - * @depends testConstructor - */ - public function testGetHeadersContainUserAgent() - { - $params = []; - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - function () { - }, - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - - $headers = $connection->getHeaders(); - - $this->assertArrayHasKey('User-Agent', $headers); - $this->assertStringContainsString('opensearch-php/'. Client::VERSION, $headers['User-Agent'][0]); - } - - /** - * @depends testGetHeadersContainUserAgent - */ - public function testUserAgentHeaderIsSent() - { - $params = []; - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - $result = $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey('User-Agent', $request['headers']); - $this->assertStringContainsString('opensearch-php/'. Client::VERSION, $request['headers']['User-Agent'][0]); - } - - /** - * @depends testConstructor - */ - public function testGetHeadersContainsHostArrayConfig() - { - $host = [ - 'host' => 'localhost', - 'user' => 'foo', - 'pass' => 'bar', - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - [], - $this->serializer, - $this->logger, - $this->trace - ); - $result = $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey(CURLOPT_HTTPAUTH, $request['client']['curl']); - $this->assertArrayHasKey(CURLOPT_USERPWD, $request['client']['curl']); - $this->assertArrayNotHasKey('Authorization', $request['headers']); - $this->assertStringContainsString('foo:bar', $request['client']['curl'][CURLOPT_USERPWD]); - } - - /** - * @depends testGetHeadersContainsHostArrayConfig - */ - public function testGetHeadersContainApiKeyAuth() - { - $params = ['client' => ['headers' => [ - 'Authorization' => [ - 'ApiKey ' . base64_encode(random_bytes(10)) - ] - ] ] ]; - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - $result = $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey('Authorization', $request['headers']); - $this->assertArrayNotHasKey(CURLOPT_HTTPAUTH, $request['headers']); - $this->assertStringContainsString($params['client']['headers']['Authorization'][0], $request['headers']['Authorization'][0]); - } - - /** - * @depends testGetHeadersContainApiKeyAuth - */ - public function testGetHeadersContainApiKeyAuthOverHostArrayConfig() - { - $params = ['client' => ['headers' => [ - 'Authorization' => [ - 'ApiKey ' . base64_encode(random_bytes(10)) - ] - ] ] ]; - $host = [ - 'host' => 'localhost', - 'user' => 'foo', - 'pass' => 'bar', - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - $result = $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey('Authorization', $request['headers']); - $this->assertArrayNotHasKey(CURLOPT_HTTPAUTH, $request['headers']); - $this->assertStringContainsString($params['client']['headers']['Authorization'][0], $request['headers']['Authorization'][0]); - } - - /** - * @depends testGetHeadersContainsHostArrayConfig - */ - public function testGetHeadersContainBasicAuth() - { - $params = ['client' => ['curl' => [ - CURLOPT_HTTPAUTH => CURLAUTH_BASIC, - CURLOPT_USERPWD => 'username:password', - ] ] ]; - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - $result = $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey(CURLOPT_HTTPAUTH, $request['client']['curl']); - $this->assertArrayHasKey(CURLOPT_USERPWD, $request['client']['curl']); - $this->assertArrayNotHasKey('Authorization', $request['headers']); - $this->assertStringContainsString($params['client']['curl'][CURLOPT_USERPWD], $request['client']['curl'][CURLOPT_USERPWD]); - } - - /** - * @depends testGetHeadersContainBasicAuth - */ - public function testGetHeadersContainBasicAuthOverHostArrayConfig() - { - $params = ['client' => ['curl' => [ - CURLOPT_HTTPAUTH => CURLAUTH_BASIC, - CURLOPT_USERPWD => 'username:password', - ] ] ]; - $host = [ - 'host' => 'localhost', - 'user' => 'foo', - 'pass' => 'bar', - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $params, - $this->serializer, - $this->logger, - $this->trace - ); - $connection->performRequest('GET', '/'); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertArrayHasKey(CURLOPT_HTTPAUTH, $request['client']['curl']); - $this->assertArrayHasKey(CURLOPT_USERPWD, $request['client']['curl']); - $this->assertArrayNotHasKey('Authorization', $request['headers']); - $this->assertStringContainsString('username:password', $request['client']['curl'][CURLOPT_USERPWD]); - } - - /** - * @see https://github.com/elastic/elasticsearch-php/issues/977 - */ - public function testTryDeserializeErrorWithMasterNotDiscoveredException() - { - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - function () { - }, - $host, - [], - new SmartSerializer(), - $this->logger, - $this->trace - ); - - $reflection = new ReflectionClass(Connection::class); - $tryDeserializeError = $reflection->getMethod('tryDeserializeError'); - $tryDeserializeError->setAccessible(true); - - $body = '{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503}'; - $response = [ - 'transfer_stats' => [], - 'status' => 503, - 'body' => $body - ]; - - $result = $tryDeserializeError->invoke($connection, $response, ServerErrorResponseException::class); - $this->assertInstanceOf(ServerErrorResponseException::class, $result); - $this->assertStringContainsString('master_not_discovered_exception', $result->getMessage()); - } - - /** - * @see https://github.com/opensearch-project/opensearch-php/issues/167 - */ - public function testTryDeserializeErrorWith403Error() - { - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - function () { - }, - $host, - [], - new SmartSerializer(), - $this->logger, - $this->trace - ); - - $reflection = new ReflectionClass(Connection::class); - $tryDeserializeError = $reflection->getMethod('tryDeserializeError'); - $tryDeserializeError->setAccessible(true); - - $body = '{"status":403,"error":{"reason":"403 Forbidden","type":"Forbidden"}}'; - $response = [ - 'transfer_stats' => [], - 'status' => 403, - 'body' => $body - ]; - - $result = $tryDeserializeError->invoke($connection, $response, ServerErrorResponseException::class); - $this->assertInstanceOf(ServerErrorResponseException::class, $result); - $this->assertStringContainsString('403 Forbidden', $result->getMessage()); - } - - public function testHeaderClientParamIsResetAfterSent() - { - $host = [ - 'host' => 'localhost' - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - [], - new SmartSerializer(), - $this->logger, - $this->trace - ); - - $options = [ - 'client' => [ - 'headers' => [ - 'Foo' => [ 'Bar' ] - ] - ] - ]; - - $headersBefore = $connection->getHeaders(); - $connection->performRequest('GET', '/', null, null, $options); - $headersAfter = $connection->getHeaders(); - $this->assertEquals($headersBefore, $headersAfter); - } - - public function testParametersAreSent() - { - $connectionParams = []; - $host = [ - 'host' => 'localhost' - ]; - $requestParams = [ - 'foo' => true, - 'baz' => false, - 'bar' => 'baz' - ]; - - $connection = new Connection( - ClientBuilder::defaultHandler(), - $host, - $connectionParams, - $this->serializer, - $this->logger, - $this->trace - ); - $connection->performRequest('GET', '/', $requestParams); - $request = $connection->getLastRequestInfo()['request']; - - $this->assertEquals('/?foo=true&baz=false&bar=baz', $request['uri']); - } - - public function testPortInUrlWhenLogRequestSuccess() - { - $logger = new ArrayLogger(); - $trace = new ArrayLogger(); - - $connection = new Connection( - ClientBuilder::defaultHandler(), - [ - 'host' => 'localhost', - 'port' => 9200, - 'scheme' => 'http', - 'path' => '/info' - ], - [], - $this->serializer, - $logger, - $trace - ); - $request = [ - 'body' => '{}', - 'http_method' => 'GET', - 'headers' => [ - 'User-Agent: Testing' - ] - ]; - $response = [ - 'effective_url' => 'http://localhost/info', - 'status' => 200, - 'transfer_stats' => [ - 'primary_port' => 9200, - 'total_time' => 1 - ], - 'body' => '{}' - ]; - $connection->logRequestSuccess($request, $response); - // Check for localhost:9200 in trace - foreach ($trace->output as $row) { - $this->assertStringContainsString('localhost:9200', $row); - } - // Check for localhost:9200 in logger - foreach ($logger->output as $row) { - if (false !== strpos('info: Request Success', $row)) { - $this->assertStringContainsString('localhost:9200', $row); - } - } - } - - public function testPortInLogUrlWhenLogRequestFail() - { - $logger = new ArrayLogger(); - $trace = new ArrayLogger(); - - $connection = new Connection( - ClientBuilder::defaultHandler(), - [ - 'host' => 'localhost', - 'port' => 9200, - 'scheme' => 'http', - 'path' => '/info' - ], - [], - $this->serializer, - $logger, - $trace - ); - $request = [ - 'body' => '{}', - 'http_method' => 'GET', - 'headers' => [ - 'User-Agent: Testing' - ] - ]; - $response = [ - 'effective_url' => 'http://localhost/info', - 'status' => 400, - 'transfer_stats' => [ - 'primary_port' => 9200, - 'total_time' => 1 - ], - 'body' => '{}' - ]; - $connection->logRequestFail($request, $response, new Exception()); - - // Check for localhost:9200 in trace - foreach ($trace->output as $row) { - $this->assertStringContainsString('localhost:9200', $row); - } - // Check for localhost:9200 in logger - foreach ($logger->output as $row) { - if (false !== strpos('warning: Request Failure:', $row)) { - $this->assertStringContainsString('localhost:9200', $row); - } - } - } -} diff --git a/tests/Endpoints/MlNamespaceIntegrationTest.php b/tests/Endpoints/MlNamespaceIntegrationTest.php index 6c10335aa..33370c449 100644 --- a/tests/Endpoints/MlNamespaceIntegrationTest.php +++ b/tests/Endpoints/MlNamespaceIntegrationTest.php @@ -15,7 +15,6 @@ namespace OpenSearch\Tests\Endpoints; -use OpenSearch\Client; use OpenSearch\Tests\Utility; /** diff --git a/tests/Endpoints/StatusEndpointTest.php b/tests/Endpoints/StatusEndpointTest.php index 7d73bb7ba..ab470eb8d 100644 --- a/tests/Endpoints/StatusEndpointTest.php +++ b/tests/Endpoints/StatusEndpointTest.php @@ -22,7 +22,6 @@ namespace OpenSearch\Tests\Endpoints; use OpenSearch\Endpoints\Snapshot\Status; -use OpenSearch\Common\Exceptions; class StatusEndpointTest extends \PHPUnit\Framework\TestCase { diff --git a/tests/Handlers/SigV4HandlerTest.php b/tests/Handlers/SigV4HandlerTest.php deleted file mode 100644 index 1b255e65f..000000000 --- a/tests/Handlers/SigV4HandlerTest.php +++ /dev/null @@ -1,241 +0,0 @@ - - */ - private $envTemp = []; - - protected function setUp(): void - { - $this->envTemp = array_combine(self::ENV_KEYS_USED, array_map( - function ($envVarName) { - $current = getenv($envVarName); - putenv($envVarName); - return $current; - }, - self::ENV_KEYS_USED - )); - } - - protected function tearDown(): void - { - foreach ($this->envTemp as $key => $value) { - putenv("$key=$value"); - } - $this->envTemp = []; - } - - public function testSignsRequestsTheSdkDefaultCredentialProviderChain() - { - $key = 'foo'; - $toWrap = function (array $ringRequest) use ($key) { - $this->assertArrayHasKey('X-Amz-Date', $ringRequest['headers']); - $this->assertArrayHasKey('Authorization', $ringRequest['headers']); - $this->assertArrayHasKey('x-amz-content-sha256', $ringRequest['headers']); - $this->assertMatchesRegularExpression( - "~^AWS4-HMAC-SHA256 Credential=$key/\\d{8}/us-west-2/es/aws4_request~", - $ringRequest['headers']['Authorization'][0] - ); - - return $this->getGenericResponse(); - }; - putenv(CredentialProvider::ENV_KEY . "=$key"); - putenv(CredentialProvider::ENV_SECRET . '=bar'); - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(true) - ->build(); - - $client->search([ - 'index' => 'index', - 'body' => [ - 'query' => [ 'match_all' => (object)[] ], - ], - ]); - } - - public function testSignsWithProvidedCredentials() - { - $toWrap = function (array $ringRequest) { - $this->assertArrayHasKey('X-Amz-Security-Token', $ringRequest['headers']); - $this->assertSame('baz', $ringRequest['headers']['X-Amz-Security-Token'][0]); - $this->assertArrayHasKey('x-amz-content-sha256', $ringRequest['headers']); - $this->assertMatchesRegularExpression( - '~^AWS4-HMAC-SHA256 Credential=foo/\d{8}/us-west-2/es/aws4_request~', - $ringRequest['headers']['Authorization'][0] - ); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->search([ - 'index' => 'index', - 'body' => [ - 'query' => [ 'match_all' => (object)[] ], - ], - ]); - } - - public function testSignsWithProvidedCredentialsAndService() - { - $toWrap = function (array $ringRequest) { - $this->assertArrayHasKey('X-Amz-Security-Token', $ringRequest['headers']); - $this->assertSame('baz', $ringRequest['headers']['X-Amz-Security-Token'][0]); - $this->assertArrayHasKey('x-amz-content-sha256', $ringRequest['headers']); - $this->assertMatchesRegularExpression( - '~^AWS4-HMAC-SHA256 Credential=foo/\d{8}/us-west-2/aoss/aws4_request~', - $ringRequest['headers']['Authorization'][0] - ); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4Service('aoss') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->search([ - 'index' => 'index', - 'body' => [ - 'query' => ['match_all' => (object)[]], - ], - ]); - } - - public function testEmptyBodyProducesCorrectSha256() - { - $toWrap = function (array $ringRequest) { - $this->assertArrayHasKey('X-Amz-Security-Token', $ringRequest['headers']); - $this->assertSame('baz', $ringRequest['headers']['X-Amz-Security-Token'][0]); - $this->assertArrayHasKey('x-amz-content-sha256', $ringRequest['headers']); - $this->assertSame($ringRequest['headers']['x-amz-content-sha256'][0], 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'); - $this->assertMatchesRegularExpression( - '~^AWS4-HMAC-SHA256 Credential=foo/\d{8}/us-west-2/aoss/aws4_request~', - $ringRequest['headers']['Authorization'][0] - ); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4Service('aoss') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->indices()->exists(['index' => 'index']); - } - - public function testEmptyRequestBodiesShouldBeNull() - { - $toWrap = function (array $ringRequest) { - $this->assertNull($ringRequest['body']); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->indices()->exists(['index' => 'index']); - } - - public function testNonEmptyRequestBodiesShouldNotBeNull() - { - $toWrap = function (array $ringRequest) { - $this->assertNotNull($ringRequest['body']); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->search([ - 'index' => 'index', - 'body' => [ - 'query' => [ 'match_all' => (object)[] ], - ], - ]); - } - - public function testClientParametersShouldBePassedToHandler() - { - $toWrap = function (array $ringRequest) { - $this->assertArrayHasKey('client', $ringRequest); - $this->assertArrayHasKey('timeout', $ringRequest['client']); - $this->assertArrayHasKey('connect_timeout', $ringRequest['client']); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->setConnectionParams(['client' => ['timeout' => 5, 'connect_timeout' => 5]]) - ->build(); - - $client->indices()->exists(['index' => 'index']); - } - - public function testClientPortDeterminedByURL() - { - $toWrap = function (array $ringRequest) { - $this->assertArrayNotHasKey(CURLOPT_PORT, $ringRequest['client']['curl']); - - return $this->getGenericResponse(); - }; - - $client = ClientBuilder::create() - ->setHandler($toWrap) - ->setHosts(['https://search--hgkaewb2ytci3t3y6yghh5m5vje.eu-central-1.es.amazonaws.com']) - ->setSigV4Region('us-west-2') - ->setSigV4CredentialProvider(new Credentials('foo', 'bar', 'baz')) - ->build(); - - $client->indices()->exists(['index' => 'index']); - } - - private function getGenericResponse(): CompletedFutureArray - { - return new CompletedFutureArray([ - 'status' => 200, - 'body' => fopen('php://memory', 'r'), - 'transfer_stats' => ['total_time' => 0], - 'effective_url' => 'https://www.example.com', - ]); - } -} diff --git a/tests/Helper/Iterators/SearchHitIteratorTest.php b/tests/Helper/Iterators/SearchHitIteratorTest.php index 080e5d1fa..e517848b7 100644 --- a/tests/Helper/Iterators/SearchHitIteratorTest.php +++ b/tests/Helper/Iterators/SearchHitIteratorTest.php @@ -21,9 +21,9 @@ namespace OpenSearch\Tests\Helper\Iterators; +use Mockery; use OpenSearch\Helper\Iterators\SearchHitIterator; use OpenSearch\Helper\Iterators\SearchResponseIterator; -use Mockery; /** * Class SearchResponseIteratorTest diff --git a/tests/Helper/Iterators/SearchResponseIteratorTest.php b/tests/Helper/Iterators/SearchResponseIteratorTest.php index e971278cb..2cfdf2203 100644 --- a/tests/Helper/Iterators/SearchResponseIteratorTest.php +++ b/tests/Helper/Iterators/SearchResponseIteratorTest.php @@ -21,9 +21,9 @@ namespace OpenSearch\Tests\Helper\Iterators; +use Mockery as m; use OpenSearch\Client; use OpenSearch\Helper\Iterators\SearchResponseIterator; -use Mockery as m; /** * Class SearchResponseIteratorTest diff --git a/tests/Namespaces/MachineLearningNamespaceTest.php b/tests/Namespaces/MachineLearningNamespaceTest.php index 5101983c6..d96200062 100644 --- a/tests/Namespaces/MachineLearningNamespaceTest.php +++ b/tests/Namespaces/MachineLearningNamespaceTest.php @@ -4,23 +4,21 @@ use OpenSearch\Endpoints\Ml\CreateConnector; use OpenSearch\Endpoints\Ml\DeleteConnector; -use OpenSearch\Endpoints\Ml\GetConnector; -use OpenSearch\Endpoints\Ml\GetConnectors; -use OpenSearch\Endpoints\Ml\DeleteModelGroup; -use OpenSearch\Endpoints\Ml\GetModelGroups; -use OpenSearch\Endpoints\Ml\RegisterModelGroup; -use OpenSearch\Endpoints\Ml\UpdateModelGroup; use OpenSearch\Endpoints\Ml\DeleteModel; +use OpenSearch\Endpoints\Ml\DeleteModelGroup; use OpenSearch\Endpoints\Ml\DeployModel; +use OpenSearch\Endpoints\Ml\GetConnector; +use OpenSearch\Endpoints\Ml\GetConnectors; use OpenSearch\Endpoints\Ml\GetModel; -use OpenSearch\Endpoints\Ml\SearchModels; +use OpenSearch\Endpoints\Ml\GetModelGroups; +use OpenSearch\Endpoints\Ml\GetTask; use OpenSearch\Endpoints\Ml\Predict; use OpenSearch\Endpoints\Ml\RegisterModel; +use OpenSearch\Endpoints\Ml\RegisterModelGroup; +use OpenSearch\Endpoints\Ml\SearchModels; use OpenSearch\Endpoints\Ml\UndeployModel; -use OpenSearch\Endpoints\Ml\GetTask; -use OpenSearch\Endpoints\Sql\Query; +use OpenSearch\Endpoints\Ml\UpdateModelGroup; use OpenSearch\Namespaces\MlNamespace; -use OpenSearch\Namespaces\SqlNamespace; use OpenSearch\Transport; use PHPUnit\Framework\TestCase; diff --git a/tests/Namespaces/SecurityNamespaceTest.php b/tests/Namespaces/SecurityNamespaceTest.php index 9c4a6e2e5..cbc41997c 100644 --- a/tests/Namespaces/SecurityNamespaceTest.php +++ b/tests/Namespaces/SecurityNamespaceTest.php @@ -41,7 +41,6 @@ protected function setUp(): void { $this->transport = $this->createMock(Transport::class); $this->client = ClientBuilder::create() - ->setTransport($this->transport) ->setSSLVerification(false) ->build(); } diff --git a/tests/RegisteredNamespaceTest.php b/tests/RegisteredNamespaceTest.php index 117b550fb..4d14723ae 100644 --- a/tests/RegisteredNamespaceTest.php +++ b/tests/RegisteredNamespaceTest.php @@ -21,12 +21,11 @@ namespace OpenSearch\Tests; +use Mockery as m; use OpenSearch; use OpenSearch\ClientBuilder; -use OpenSearch\Endpoints\AbstractEndpoint; use OpenSearch\Serializers\SerializerInterface; use OpenSearch\Transport; -use Mockery as m; /** * Class RegisteredNamespaceTest @@ -53,7 +52,7 @@ public function testNonExistingNamespace() $builder = new FooNamespaceBuilder(); $client = ClientBuilder::create()->registerNamespace($builder)->build(); - $this->expectException(\OpenSearch\Common\Exceptions\BadMethodCallException::class); + $this->expectException(OpenSearch\Common\Exceptions\BadMethodCallException::class); $this->expectExceptionMessage('Namespace [bar] not found'); $client->bar()->fooMethod(); diff --git a/tests/Serializers/ArrayToJSONSerializerTest.php b/tests/Serializers/ArrayToJSONSerializerTest.php index 1b2b0630b..1bca27019 100644 --- a/tests/Serializers/ArrayToJSONSerializerTest.php +++ b/tests/Serializers/ArrayToJSONSerializerTest.php @@ -21,8 +21,8 @@ namespace OpenSearch\Tests\Serializers; -use OpenSearch\Serializers\ArrayToJSONSerializer; use Mockery as m; +use OpenSearch\Serializers\ArrayToJSONSerializer; /** * Class ArrayToJSONSerializerTest diff --git a/tests/Serializers/EverythingToJSONSerializerTest.php b/tests/Serializers/EverythingToJSONSerializerTest.php index 93b7c5d5f..a062b236c 100644 --- a/tests/Serializers/EverythingToJSONSerializerTest.php +++ b/tests/Serializers/EverythingToJSONSerializerTest.php @@ -21,8 +21,8 @@ namespace OpenSearch\Tests\Serializers; -use OpenSearch\Serializers\EverythingToJSONSerializer; use Mockery as m; +use OpenSearch\Serializers\EverythingToJSONSerializer; /** * Class EverythingToJSONSerializerTest diff --git a/tests/Serializers/SmartSerializerTest.php b/tests/Serializers/SmartSerializerTest.php index 9b7696629..e9513fd7b 100644 --- a/tests/Serializers/SmartSerializerTest.php +++ b/tests/Serializers/SmartSerializerTest.php @@ -23,7 +23,6 @@ use OpenSearch\Common\Exceptions\Serializer\JsonErrorException; use OpenSearch\Serializers\SmartSerializer; -use Mockery as m; use PHPUnit\Framework\TestCase; /** diff --git a/tests/TransportTest.php b/tests/TransportTest.php deleted file mode 100644 index 96469261b..000000000 --- a/tests/TransportTest.php +++ /dev/null @@ -1,99 +0,0 @@ -logger = $this->createMock(LoggerInterface::class); - $this->connectionPool = $this->createMock(AbstractConnectionPool::class); - $this->connection = $this->createMock(Connection::class); - } - - public function testPerformRequestWithServerErrorResponseException404Result() - { - $deferred = new Deferred(); - $deferred->reject(new ServerErrorResponseException('foo', 404)); - $future = new FutureArray($deferred->promise()); - - $this->connection->method('performRequest') - ->willReturn($future); - - $this->connectionPool->method('nextConnection') - ->willReturn($this->connection); - - $this->connectionPool->expects($this->never()) - ->method('scheduleCheck'); - - $transport = new Transport(1, $this->connectionPool, $this->logger); - - $result = $transport->performRequest('GET', '/'); - $this->assertInstanceOf(FutureArrayInterface::class, $result); - } - - public function testPerformRequestWithServerErrorResponseException500Result() - { - $deferred = new Deferred(); - $deferred->reject(new ServerErrorResponseException('foo', 500)); - $future = new FutureArray($deferred->promise()); - - $this->connection->method('performRequest') - ->willReturn($future); - - $this->connectionPool->method('nextConnection') - ->willReturn($this->connection); - - $this->connectionPool->expects($this->once()) - ->method('scheduleCheck'); - - $transport = new Transport(1, $this->connectionPool, $this->logger); - - $result = $transport->performRequest('GET', '/'); - $this->assertInstanceOf(FutureArrayInterface::class, $result); - } -} diff --git a/tests/Utility.php b/tests/Utility.php index bf0046605..30001071f 100644 --- a/tests/Utility.php +++ b/tests/Utility.php @@ -56,14 +56,6 @@ public static function getClient(): Client $clientBuilder = ClientBuilder::create() ->setHosts([self::getHost()]); - $clientBuilder->setConnectionParams([ - 'client' => [ - 'headers' => [ - 'Accept' => [] - ] - ] - ]); - $clientBuilder->setSSLVerification(false); return $clientBuilder->build(); } diff --git a/util/ActionTest.php b/util/ActionTest.php index 8284f3112..fd2c57076 100644 --- a/util/ActionTest.php +++ b/util/ActionTest.php @@ -24,12 +24,11 @@ use OpenSearch\Common\Exceptions\BadRequest400Exception; use OpenSearch\Common\Exceptions\Conflict409Exception; -use OpenSearch\Common\Exceptions\OpenSearchException; use OpenSearch\Common\Exceptions\Forbidden403Exception; use OpenSearch\Common\Exceptions\Missing404Exception; +use OpenSearch\Common\Exceptions\OpenSearchException; use OpenSearch\Common\Exceptions\RequestTimeout408Exception; use OpenSearch\Common\Exceptions\Unauthorized401Exception; -use OpenSearch\Util\YamlTests; use PHPUnit\Runner\Version as PHPUnitVersion; use stdClass; diff --git a/util/GenerateEndpoints.php b/util/GenerateEndpoints.php index 4d41fe3b2..3c02fbf6f 100644 --- a/util/GenerateEndpoints.php +++ b/util/GenerateEndpoints.php @@ -19,13 +19,10 @@ * the GNU Lesser General Public License, Version 2.1, at your option. * See the LICENSE file in the project root for more information. */ -use OpenSearch\Client; -use OpenSearch\Common\Exceptions\NoNodesAvailableException; -use OpenSearch\Common\Exceptions\RuntimeException; + use OpenSearch\Util\ClientEndpoint; use OpenSearch\Util\Endpoint; use OpenSearch\Util\NamespaceEndpoint; -use OpenSearch\Tests\Utility; use Symfony\Component\Yaml\Yaml; require_once dirname(__DIR__) . '/vendor/autoload.php'; diff --git a/util/build_tests.php b/util/build_tests.php index d698e407c..7912c40cf 100644 --- a/util/build_tests.php +++ b/util/build_tests.php @@ -20,8 +20,8 @@ */ use OpenSearch\Common\Exceptions\NoNodesAvailableException; -use OpenSearch\Util\YamlTests; use OpenSearch\Tests\Utility; +use OpenSearch\Util\YamlTests; require dirname(__DIR__) . '/vendor/autoload.php';