From 9f9ea7c8ef8e8209ec1368fcff2955cedbd1b595 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 23 Dec 2024 12:53:40 +1300 Subject: [PATCH] Generate majority of indices operations (#1360) * Generate indices.clone Signed-off-by: Thomas Farr * Generate indices.close Signed-off-by: Thomas Farr * Generate indices.flush Signed-off-by: Thomas Farr * Generate indices.forcemerge Signed-off-by: Thomas Farr * Generate indices.get_upgrade Signed-off-by: Thomas Farr * Generate indices.open Signed-off-by: Thomas Farr * Generate indices.recovery Signed-off-by: Thomas Farr * Generate indices.refresh Signed-off-by: Thomas Farr * Generate indices.resolve_index Signed-off-by: Thomas Farr * Generate indices.rollover Signed-off-by: Thomas Farr * Generate indices.segments Signed-off-by: Thomas Farr * Generate indices.shard_stores Signed-off-by: Thomas Farr * Generate indices.shrink Signed-off-by: Thomas Farr * Generate indices.split Signed-off-by: Thomas Farr * Generate indices.stats Signed-off-by: Thomas Farr * Remove deserializing of path params Signed-off-by: Thomas Farr * Generate indices.upgrade Signed-off-by: Thomas Farr * Generate indices.validate_query Signed-off-by: Thomas Farr * Simplify operation filtering Signed-off-by: Thomas Farr * RemoteStoreUploadStats.pressure as optional Signed-off-by: Thomas Farr * Handle segment replication stats returning strings in some versions Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- UPGRADING.md | 83 +- .../opensearch/_types/CompletionStats.java | 166 +- .../client/opensearch/_types/DocStats.java | 119 +- .../client/opensearch/_types/DocStatus.java | 322 ++++ .../opensearch/_types/FieldMemoryUsage.java | 77 +- .../opensearch/_types/FieldSizeUsage.java | 77 +- .../opensearch/_types/FielddataStats.java | 170 ++- .../client/opensearch/_types/FlushStats.java | 110 +- .../client/opensearch/_types/GetStats.java | 196 ++- .../opensearch/_types/IndexingStats.java | 419 ++++-- .../client/opensearch/_types/Level.java | 12 +- .../client/opensearch/_types/MergesStats.java | 263 +++- .../opensearch/_types/NodeAttributes.java | 244 ++- .../opensearch/_types/QueryCacheStats.java | 184 ++- .../opensearch/_types/RecoveryStats.java | 110 +- .../opensearch/_types/RefreshStats.java | 163 +- .../_types/RemoteStoreDownloadStats.java | 294 ++++ .../opensearch/_types/RemoteStoreStats.java | 231 +++ .../_types/RemoteStoreTranslogStats.java | 194 +++ .../RemoteStoreTranslogUploadStats.java | 240 +++ ...oreTranslogUploadTotalUploadSizeStats.java | 386 +++++ ...eStoreTranslogUploadTotalUploadsStats.java | 263 ++++ .../RemoteStoreUploadDownloadStats.java | 382 +++++ .../RemoteStoreUploadPressureStats.java | 195 +++ .../RemoteStoreUploadRefreshSizeLagStats.java | 311 ++++ .../_types/RemoteStoreUploadStats.java | 450 ++++++ .../opensearch/_types/RequestCacheStats.java | 96 +- .../opensearch/_types/RequestStats.java | 294 ++++ .../client/opensearch/_types/SearchStats.java | 1339 +++++++++++++++++ .../_types/SegmentReplicationStats.java | 247 +++ .../opensearch/_types/SegmentsStats.java | 1128 ++++++++++++++ .../client/opensearch/_types/StoreStats.java | 221 ++- .../opensearch/_types/TranslogStats.java | 161 +- .../client/opensearch/_types/WarmerStats.java | 110 +- .../opensearch/indices/CloneIndexRequest.java | 427 ++++-- .../indices/CloneIndexResponse.java | 96 +- .../opensearch/indices/CloseIndexRequest.java | 340 +++-- .../indices/CloseIndexResponse.java | 125 +- .../opensearch/indices/FlushRequest.java | 439 ++++++ .../opensearch/indices/FlushResponse.java | 68 +- .../opensearch/indices/ForcemergeRequest.java | 287 +++- .../indices/ForcemergeResponse.java | 202 +++ .../indices/GetUpgradeRequest.java} | 257 ++-- .../indices/GetUpgradeResponse.java | 322 ++++ .../indices/IndicesStatsRequest.java | 405 +++-- .../indices/IndicesStatsResponse.java | 160 +- .../opensearch/indices/OpenRequest.java | 640 ++++++++ .../opensearch/indices/OpenResponse.java | 306 ++++ .../OpenSearchIndicesAsyncClientBase.java | 402 +++++ .../indices/OpenSearchIndicesClientBase.java | 398 +++++ .../opensearch/indices/RecoveryRequest.java | 138 +- .../opensearch/indices/RecoveryResponse.java | 19 +- .../opensearch/indices/RefreshRequest.java | 178 ++- .../opensearch/indices/RefreshResponse.java | 68 +- .../indices/ResolveIndexRequest.java | 148 +- .../indices/ResolveIndexResponse.java | 246 ++- .../opensearch/indices/RolloverRequest.java | 386 +++-- .../opensearch/indices/RolloverResponse.java | 147 +- .../opensearch/indices/SegmentsRequest.java | 188 ++- .../opensearch/indices/SegmentsResponse.java | 110 +- .../indices/ShardStoresRequest.java | 186 ++- .../indices/ShardStoresResponse.java | 99 +- .../opensearch/indices/ShrinkRequest.java | 457 ++++-- .../opensearch/indices/ShrinkResponse.java | 120 +- .../opensearch/indices/SplitRequest.java | 460 ++++-- .../opensearch/indices/SplitResponse.java | 120 +- .../opensearch/indices/UpgradeRequest.java | 224 ++- .../opensearch/indices/UpgradeResponse.java | 228 +++ .../opensearch/indices/UpgradeStatus.java | 253 ++++ .../indices/UpgradeVersionStatus.java | 220 +++ .../indices/ValidateQueryRequest.java | 346 +++-- .../indices/ValidateQueryResponse.java | 160 +- .../indices/close/CloseIndexResult.java | 91 +- .../indices/close/CloseShardResult.java | 93 +- .../indices/recovery/FileDetails.java | 81 +- .../indices/recovery/RecoveryBytes.java | 202 ++- .../indices/recovery/RecoveryFiles.java | 109 +- .../indices/recovery/RecoveryIndexStatus.java | 211 ++- .../indices/recovery/RecoveryOrigin.java | 423 ++++-- .../indices/recovery/RecoveryStartStatus.java | 294 ++++ .../indices/recovery/RecoveryStatus.java | 93 +- .../indices/recovery/ShardRecovery.java | 274 +++- .../indices/recovery/TranslogStatus.java | 163 +- .../indices/recovery/VerifyIndex.java | 116 +- .../resolve_index/ResolveIndexAliasItem.java | 130 +- .../ResolveIndexDataStreamsItem.java | 270 ++++ .../resolve_index/ResolveIndexItem.java | 159 +- .../indices/rollover/RolloverConditions.java | 666 ++++++++ .../indices/segments/IndexSegment.java | 101 +- .../opensearch/indices/segments/Segment.java | 294 +++- .../indices/segments/ShardSegmentRouting.java | 83 +- .../indices/segments/ShardsSegment.java | 162 +- .../shard_stores/IndicesShardStores.java | 99 +- .../indices/shard_stores/ShardStore.java | 278 ++-- .../shard_stores/ShardStoreAllocation.java | 12 +- .../shard_stores/ShardStoreException.java | 78 +- .../shard_stores/ShardStoreStatus.java | 22 +- .../shard_stores/ShardStoreWrapper.java | 93 +- .../indices/stats/AllIndicesStats.java | 228 +++ .../indices/stats/IndexShardStats.java | 361 +++++ .../opensearch/indices/stats/IndexStats.java | 149 ++ .../indices/stats/IndexStatsBase.java | 778 ++++++++++ .../indices/stats/IndicesStats.java | 145 +- .../indices/stats/IndicesStatsMetric.java | 95 ++ .../opensearch/indices/stats/ShardCommit.java | 114 +- .../indices/stats/ShardFileSizeInfo.java | 256 +++- .../opensearch/indices/stats/ShardLease.java | 127 +- .../opensearch/indices/stats/ShardPath.java | 85 +- .../indices/stats/ShardRetentionLeases.java | 149 +- .../indices/stats/ShardRouting.java | 94 +- .../indices/stats/ShardRoutingState.java | 16 +- .../indices/stats/ShardSequenceNumber.java | 81 +- .../IndicesValidationExplanation.java | 99 +- .../client/opensearch/_types/BulkStats.java | 347 ----- .../client/opensearch/_types/SearchStats.java | 484 ------ .../opensearch/_types/SegmentsStats.java | 773 ---------- .../indices/ForcemergeResponse.java | 98 -- .../opensearch/indices/GetUpgradeRequest.java | 159 -- .../indices/GetUpgradeResponse.java | 219 --- .../opensearch/indices/OpenRequest.java | 443 ------ .../opensearch/indices/OpenResponse.java | 131 -- .../indices/OpenSearchIndicesAsyncClient.java | 671 --------- .../indices/OpenSearchIndicesClient.java | 655 -------- .../indices/OverlappingIndexTemplate.java | 181 --- .../opensearch/indices/UpgradeResponse.java | 98 -- .../indices/recovery/RecoveryStartStatus.java | 158 -- .../rollover/IndexRolloverMapping.java | 182 --- .../IndexRolloverMappingBuilders.java | 55 - .../indices/rollover/RolloverConditions.java | 235 --- .../opensearch/indices/stats/IndexStats.java | 884 ----------- .../indices/stats/ShardQueryCache.java | 278 ---- .../opensearch/indices/stats/ShardStats.java | 848 ----------- .../indices/stats/ShardsTotalStats.java | 134 -- .../opensearch/model/ShardStatsTest.java | 15 +- java-codegen/opensearch-openapi.yaml | 520 ++++--- .../client/codegen/CodeGenerator.java | 17 +- .../client/codegen/model/Deprecation.java | 11 +- .../client/codegen/model/RequestShape.java | 21 + .../client/codegen/model/SpecTransformer.java | 26 +- .../codegen/model/overrides/Overrides.java | 4 + .../codegen/openapi/OpenApiOperation.java | 2 +- .../codegen/openapi/OpenApiParameter.java | 2 +- .../client/codegen/utils/NameSanitizer.java | 3 + .../client/codegen/templates/Client.mustache | 12 + 144 files changed, 22773 insertions(+), 10899 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/CompletionStats.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/DocStats.java (52%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStatus.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/FielddataStats.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/FlushStats.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GetStats.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/IndexingStats.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/Level.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/MergesStats.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/NodeAttributes.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java (57%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/RecoveryStats.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/RefreshStats.java (59%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreDownloadStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadSizeStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadsStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadDownloadStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadPressureStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadRefreshSizeLagStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadStats.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java (71%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/SearchStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentReplicationStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentsStats.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/StoreStats.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/TranslogStats.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/WarmerStats.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java (53%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java (54%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushRequest.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/FlushResponse.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java (56%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java rename java-client/src/{main/java/org/opensearch/client/opensearch/indices/FlushRequest.java => generated/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java} (59%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java (67%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenResponse.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RefreshRequest.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RefreshResponse.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java (54%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RolloverRequest.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/RolloverResponse.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java (50%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/SplitRequest.java (51%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/SplitResponse.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java (57%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeStatus.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeVersionStatus.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java (73%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java (73%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java (53%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java (57%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java (68%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexDataStreamsItem.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java (71%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/segments/Segment.java (55%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java (50%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java (68%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/AllIndicesStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexShardStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStatsBase.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java (64%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStatsMetric.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java (70%) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/SearchStats.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/SegmentsStats.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/OverlappingIndexTemplate.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMapping.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMappingBuilders.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardQueryCache.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardsTotalStats.java diff --git a/UPGRADING.md b/UPGRADING.md index 1809c8c5af..cd7e6bb2b5 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -198,4 +198,85 @@ After: ### ExplainAnalyzeToken - The `endOffset`, `position`, `positionLength`, `startOffset` and `termFrequency` properties have been corrected to be of type `int` instead of `long`. -- The `positionlength` and `termfrequency` properties have had their casing corrected to `positionLength` and `termFrequency` respectively. \ No newline at end of file +- The `positionlength` and `termfrequency` properties have had their casing corrected to `positionLength` and `termFrequency` respectively. + +### RecoveryBytes +- The `recoveredFromSnapshotInBytes`, `recoveredInBytes`, `reusedInBytes` and `totalInBytes` properties have been corrected to be of type `long` instead of `String`. + +### RecoveryIndexStatus +- The `sourceThrottleTimeInMillis`, `targetThrottleTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`. + +### RecoveryOrigin +- The `restoreuuid` property has had its casing corrected to `restoreUuid`. + +### RecoveryStartStatus +- The `checkIndexTime` property has been corrected to be of type `Time` instead of `long`. +- The `totalTimeInMillis` property has been corrected to be of type `long` instead of `String`. + +### ShardRecovery +- The `id` property has been corrected to be of type `int` instead of `long`. +- The `startTimeInMillis`, `stopTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`. +- The `totalTime` property has been corrected to be of type `Time` instead of `String`. + +### indices.recovery.TranslogStatus +- The `recovered`, `total` and `totalOnStart` properties have been corrected to be of type `int` instead of `long`. +- The `totalTime` property has been corrected to be of type `Time` instead of `String`. +- The `totalTimeInMillis` property has been corrected to be of type `long` instead of `String`. + +### indices.recovery.VerifyIndex +- The `checkIndexTimeInMillis` and `totalTimeInMillis` properties have been corrected to be of type `long` instead of `String`. + +### RolloverRequest +- The `mappings` property is now of type `TypeMapping` instead of `IndexRolloverMapping`. + +### IndexRolloverMapping +- The `IndexRolloverMapping` class has been removed. + +### Segment +- The `deletedDocs` and `numDocs` properties have been corrected to be of type `int` instead of `long`. +- The `memoryInBytes` and `sizeInBytes` properties have been corrected to be of type `long` instead of `double`. + +### ShardStore +- The `attributes`, `id`, `legacyVersion`, `name` and `transportAddress` properties have been removed and are now correctly nested within the `NodeAttributes` under the `nodes` property map. + +### FlushStats +- The `totalTime` property has been corrected to be of type `Time` instead of `String`. + +### GetStats +- The `existsTime`, `missingTime` and `time` properties have been corrected to be of type `Time` instead of `String`. + +### IndexingStats +- The `deleteTime`, `indexTime` and `throttleTime` properties have been corrected to be of type `Time` instead of `String`. +- The `types` property has been removed as it is no longer supported by OpenSearch as of version 2.0.0. + +### MergesStats +- The `totalStoppedTime`, `totalThrottledTime` and `totalTime` properties have been corrected to be of type `Time` instead of `String`. + +### RecoveryStats +- The `throttleTime` property has been corrected to be of type `Time` instead of `String`. + +### RefreshStats +- The `totalTime` property has been corrected to be of type `Time` instead of `String`. + +### SegmentsStats +- The `storedMemory` property has been renamed to `storedFieldsMemory` to match the OpenSearch response. + +### StoreStats +- The `totalDataSetSize` and `totalDataSetSizeInBytes` properties have been removed as they are not returned by OpenSearch. + +### TranslogStats +- The `operations` property has been corrected to be of type `int` instead of `long`. + +### WarmerStats +- The `totalTime` property has been corrected to be of type `Time` instead of `String`. + +### IndicesStatsRequest +- The `metric` property is now of type `List` instead of `List`. +- The `types` property has been removed as it is no longer supported by OpenSearch as of version 2.0.0. + +### IndicesStatsResponse +- The `all` property is now of type `AllIndicesStats` instead of `IndicesStats`. + +### ShardStats renamed to IndexShardStats +- The `ShardStats` class has been renamed to `IndexShardStats`, this affects: + - `IndicesStats`'s `shards` field. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/CompletionStats.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/CompletionStats.java index 1bc935b886..0d3c6c5150 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/CompletionStats.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,39 +50,43 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.CompletionStats @JsonpDeserializable -public class CompletionStats implements PlainJsonSerializable { - private final long sizeInBytes; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompletionStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map fields; @Nullable private final String size; - private final Map fields; + private final long sizeInBytes; // --------------------------------------------------------------------------------------------- private CompletionStats(Builder builder) { - - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - this.size = builder.size; this.fields = ApiTypeHelper.unmodifiable(builder.fields); - + this.size = builder.size; + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); } - public static CompletionStats of(Function> fn) { + public static CompletionStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code size_in_bytes} + * API name: {@code fields} */ - public final long sizeInBytes() { - return this.sizeInBytes; + @Nonnull + public final Map fields() { + return this.fields; } /** @@ -87,15 +98,19 @@ public final String size() { } /** - * API name: {@code fields} + * Required - The total amount, in bytes, of memory used for completion across all shards assigned to the selected nodes. + *

+ * API name: {@code size_in_bytes} + *

*/ - public final Map fields() { - return this.fields; + public final long sizeInBytes() { + return this.sizeInBytes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -103,65 +118,76 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartObject(); for (Map.Entry item0 : this.fields.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); } + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CompletionStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long sizeInBytes; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map fields; @Nullable private String size; + private Long sizeInBytes; - @Nullable - private Map fields; + public Builder() {} - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; + private Builder(CompletionStats o) { + this.fields = _mapCopy(o.fields); + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; } - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; + private Builder(Builder o) { + this.fields = _mapCopy(o.fields); + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code fields} + * *

- * Adds all entries of map to fields. + * Adds all elements of map to fields. + *

*/ + @Nonnull public final Builder fields(Map map) { this.fields = _mapPutAll(this.fields, map); return this; @@ -169,9 +195,12 @@ public final Builder fields(Map map) { /** * API name: {@code fields} + * *

* Adds an entry to fields. + *

*/ + @Nonnull public final Builder fields(String key, FieldSizeUsage value) { this.fields = _mapPut(this.fields, key, value); return this; @@ -179,19 +208,44 @@ public final Builder fields(String key, FieldSizeUsage value) { /** * API name: {@code fields} + * *

- * Adds an entry to fields using a builder lambda. + * Adds a value to fields using a builder lambda. + *

*/ + @Nonnull public final Builder fields(String key, Function> fn) { return fields(key, fn.apply(new FieldSizeUsage.Builder()).build()); } + /** + * API name: {@code size} + */ + @Nonnull + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for completion across all shards assigned to the selected nodes. + *

+ * API name: {@code size_in_bytes} + *

+ */ + @Nonnull + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + /** * Builds a {@link CompletionStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CompletionStats build() { _checkSingleUse(); @@ -210,11 +264,25 @@ public CompletionStats build() { ); protected static void setupCompletionStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompletionStats other = (CompletionStats) o; + return Objects.equals(this.fields, other.fields) && Objects.equals(this.size, other.size) && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStats.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStats.java index eb9fd22006..78771bd21c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStats.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,47 +49,61 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.DocStats @JsonpDeserializable -public class DocStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DocStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long count; - private final long deleted; + @Nullable + private final Long deleted; // --------------------------------------------------------------------------------------------- private DocStats(Builder builder) { - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); - + this.deleted = builder.deleted; } - public static DocStats of(Function> fn) { + public static DocStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code count} + * Required - The total number of non-deleted documents across all primary shards assigned to the selected nodes. This number is based + * on documents in Lucene segments and may include documents from nested fields. + *

+ * API name: {@code count} + *

*/ public final long count() { return this.count; } /** - * Required - API name: {@code deleted} + * The total number of deleted documents across all primary shards assigned to the selected nodes. This number is based on the number of + * documents stored in Lucene segments. OpenSearch reclaims the disk space previously occupied by the deleted Lucene documents when a + * segment is merged. + *

+ * API name: {@code deleted} + *

*/ - public final long deleted() { + @Nullable + public final Long deleted() { return this.deleted; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,38 +111,77 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("count"); generator.write(this.count); - generator.writeKey("deleted"); - generator.write(this.deleted); - + if (this.deleted != null) { + generator.writeKey("deleted"); + generator.write(this.deleted); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DocStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long count; - + @Nullable private Long deleted; + public Builder() {} + + private Builder(DocStats o) { + this.count = o.count; + this.deleted = o.deleted; + } + + private Builder(Builder o) { + this.count = o.count; + this.deleted = o.deleted; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code count} + * Required - The total number of non-deleted documents across all primary shards assigned to the selected nodes. This number is + * based on documents in Lucene segments and may include documents from nested fields. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(long value) { this.count = value; return this; } /** - * Required - API name: {@code deleted} + * The total number of deleted documents across all primary shards assigned to the selected nodes. This number is based on the + * number of documents stored in Lucene segments. OpenSearch reclaims the disk space previously occupied by the deleted Lucene + * documents when a segment is merged. + *

+ * API name: {@code deleted} + *

*/ - public final Builder deleted(long value) { + @Nonnull + public final Builder deleted(@Nullable Long value) { this.deleted = value; return this; } @@ -128,9 +189,10 @@ public final Builder deleted(long value) { /** * Builds a {@link DocStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DocStats build() { _checkSingleUse(); @@ -149,10 +211,23 @@ public DocStats build() { ); protected static void setupDocStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.deleted); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DocStats other = (DocStats) o; + return this.count == other.count && Objects.equals(this.deleted, other.deleted); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStatus.java new file mode 100644 index 0000000000..1808f713fd --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DocStatus.java @@ -0,0 +1,322 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.DocStatus + +/** + * The item level REST category class codes during indexing. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DocStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Integer _1xx; + + @Nullable + private final Integer _2xx; + + @Nullable + private final Integer _3xx; + + @Nullable + private final Integer _4xx; + + @Nullable + private final Integer _5xx; + + // --------------------------------------------------------------------------------------------- + + private DocStatus(Builder builder) { + this._1xx = builder._1xx; + this._2xx = builder._2xx; + this._3xx = builder._3xx; + this._4xx = builder._4xx; + this._5xx = builder._5xx; + } + + public static DocStatus of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code 1xx} + */ + @Nullable + public final Integer _1xx() { + return this._1xx; + } + + /** + * API name: {@code 2xx} + */ + @Nullable + public final Integer _2xx() { + return this._2xx; + } + + /** + * API name: {@code 3xx} + */ + @Nullable + public final Integer _3xx() { + return this._3xx; + } + + /** + * API name: {@code 4xx} + */ + @Nullable + public final Integer _4xx() { + return this._4xx; + } + + /** + * API name: {@code 5xx} + */ + @Nullable + public final Integer _5xx() { + return this._5xx; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this._1xx != null) { + generator.writeKey("1xx"); + generator.write(this._1xx); + } + + if (this._2xx != null) { + generator.writeKey("2xx"); + generator.write(this._2xx); + } + + if (this._3xx != null) { + generator.writeKey("3xx"); + generator.write(this._3xx); + } + + if (this._4xx != null) { + generator.writeKey("4xx"); + generator.write(this._4xx); + } + + if (this._5xx != null) { + generator.writeKey("5xx"); + generator.write(this._5xx); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DocStatus}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer _1xx; + @Nullable + private Integer _2xx; + @Nullable + private Integer _3xx; + @Nullable + private Integer _4xx; + @Nullable + private Integer _5xx; + + public Builder() {} + + private Builder(DocStatus o) { + this._1xx = o._1xx; + this._2xx = o._2xx; + this._3xx = o._3xx; + this._4xx = o._4xx; + this._5xx = o._5xx; + } + + private Builder(Builder o) { + this._1xx = o._1xx; + this._2xx = o._2xx; + this._3xx = o._3xx; + this._4xx = o._4xx; + this._5xx = o._5xx; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code 1xx} + */ + @Nonnull + public final Builder _1xx(@Nullable Integer value) { + this._1xx = value; + return this; + } + + /** + * API name: {@code 2xx} + */ + @Nonnull + public final Builder _2xx(@Nullable Integer value) { + this._2xx = value; + return this; + } + + /** + * API name: {@code 3xx} + */ + @Nonnull + public final Builder _3xx(@Nullable Integer value) { + this._3xx = value; + return this; + } + + /** + * API name: {@code 4xx} + */ + @Nonnull + public final Builder _4xx(@Nullable Integer value) { + this._4xx = value; + return this; + } + + /** + * API name: {@code 5xx} + */ + @Nonnull + public final Builder _5xx(@Nullable Integer value) { + this._5xx = value; + return this; + } + + /** + * Builds a {@link DocStatus}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DocStatus build() { + _checkSingleUse(); + + return new DocStatus(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DocStatus} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DocStatus::setupDocStatusDeserializer + ); + + protected static void setupDocStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::_1xx, JsonpDeserializer.integerDeserializer(), "1xx"); + op.add(Builder::_2xx, JsonpDeserializer.integerDeserializer(), "2xx"); + op.add(Builder::_3xx, JsonpDeserializer.integerDeserializer(), "3xx"); + op.add(Builder::_4xx, JsonpDeserializer.integerDeserializer(), "4xx"); + op.add(Builder::_5xx, JsonpDeserializer.integerDeserializer(), "5xx"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._1xx); + result = 31 * result + Objects.hashCode(this._2xx); + result = 31 * result + Objects.hashCode(this._3xx); + result = 31 * result + Objects.hashCode(this._4xx); + result = 31 * result + Objects.hashCode(this._5xx); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DocStatus other = (DocStatus) o; + return Objects.equals(this._1xx, other._1xx) + && Objects.equals(this._2xx, other._2xx) + && Objects.equals(this._3xx, other._3xx) + && Objects.equals(this._4xx, other._4xx) + && Objects.equals(this._5xx, other._5xx); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java index 316cfbeef6..ebd0481565 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.FieldMemoryUsage @JsonpDeserializable -public class FieldMemoryUsage implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FieldMemoryUsage implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final String memorySize; @@ -57,13 +68,11 @@ public class FieldMemoryUsage implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private FieldMemoryUsage(Builder builder) { - this.memorySize = builder.memorySize; this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - } - public static FieldMemoryUsage of(Function> fn) { + public static FieldMemoryUsage of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -85,6 +94,7 @@ public final long memorySizeInBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -92,32 +102,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.memorySize != null) { generator.writeKey("memory_size"); generator.write(this.memorySize); - } + generator.writeKey("memory_size_in_bytes"); generator.write(this.memorySizeInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FieldMemoryUsage}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String memorySize; - private Long memorySizeInBytes; + public Builder() {} + + private Builder(FieldMemoryUsage o) { + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + } + + private Builder(Builder o) { + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code memory_size} */ + @Nonnull public final Builder memorySize(@Nullable String value) { this.memorySize = value; return this; @@ -126,6 +162,7 @@ public final Builder memorySize(@Nullable String value) { /** * Required - API name: {@code memory_size_in_bytes} */ + @Nonnull public final Builder memorySizeInBytes(long value) { this.memorySizeInBytes = value; return this; @@ -134,9 +171,10 @@ public final Builder memorySizeInBytes(long value) { /** * Builds a {@link FieldMemoryUsage}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FieldMemoryUsage build() { _checkSingleUse(); @@ -155,10 +193,23 @@ public FieldMemoryUsage build() { ); protected static void setupFieldMemoryUsageDeserializer(ObjectDeserializer op) { - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.memorySize); + result = 31 * result + Long.hashCode(this.memorySizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldMemoryUsage other = (FieldMemoryUsage) o; + return Objects.equals(this.memorySize, other.memorySize) && this.memorySizeInBytes == other.memorySizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java index 3df85fe477..549dd88215 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.FieldSizeUsage @JsonpDeserializable -public class FieldSizeUsage implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FieldSizeUsage implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final String size; @@ -57,13 +68,11 @@ public class FieldSizeUsage implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private FieldSizeUsage(Builder builder) { - this.size = builder.size; this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - } - public static FieldSizeUsage of(Function> fn) { + public static FieldSizeUsage of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -85,6 +94,7 @@ public final long sizeInBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -92,32 +102,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + generator.writeKey("size_in_bytes"); generator.write(this.sizeInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FieldSizeUsage}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String size; - private Long sizeInBytes; + public Builder() {} + + private Builder(FieldSizeUsage o) { + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + private Builder(Builder o) { + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code size} */ + @Nonnull public final Builder size(@Nullable String value) { this.size = value; return this; @@ -126,6 +162,7 @@ public final Builder size(@Nullable String value) { /** * Required - API name: {@code size_in_bytes} */ + @Nonnull public final Builder sizeInBytes(long value) { this.sizeInBytes = value; return this; @@ -134,9 +171,10 @@ public final Builder sizeInBytes(long value) { /** * Builds a {@link FieldSizeUsage}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FieldSizeUsage build() { _checkSingleUse(); @@ -155,10 +193,23 @@ public FieldSizeUsage build() { ); protected static void setupFieldSizeUsageDeserializer(ObjectDeserializer op) { - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldSizeUsage other = (FieldSizeUsage) o; + return Objects.equals(this.size, other.size) && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FielddataStats.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/FielddataStats.java index 97e913f9b0..53457e81f7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FielddataStats.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,35 +50,38 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.FielddataStats @JsonpDeserializable -public class FielddataStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FielddataStats implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Long evictions; + @Nonnull + private final Map fields; + @Nullable private final String memorySize; private final long memorySizeInBytes; - private final Map fields; - // --------------------------------------------------------------------------------------------- private FielddataStats(Builder builder) { - this.evictions = builder.evictions; + this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.memorySize = builder.memorySize; this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - } - public static FielddataStats of(Function> fn) { + public static FielddataStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -83,6 +93,14 @@ public final Long evictions() { return this.evictions; } + /** + * API name: {@code fields} + */ + @Nonnull + public final Map fields() { + return this.fields; + } + /** * API name: {@code memory_size} */ @@ -98,16 +116,10 @@ public final long memorySizeInBytes() { return this.memorySizeInBytes; } - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -115,19 +127,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.evictions != null) { generator.writeKey("evictions"); generator.write(this.evictions); - - } - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); @@ -135,61 +138,83 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.fields.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FielddataStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Long evictions; - + @Nullable + private Map fields; @Nullable private String memorySize; - private Long memorySizeInBytes; - @Nullable - private Map fields; + public Builder() {} - /** - * API name: {@code evictions} - */ - public final Builder evictions(@Nullable Long value) { - this.evictions = value; - return this; + private Builder(FielddataStats o) { + this.evictions = o.evictions; + this.fields = _mapCopy(o.fields); + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; } - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; + private Builder(Builder o) { + this.evictions = o.evictions; + this.fields = _mapCopy(o.fields); + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Required - API name: {@code memory_size_in_bytes} + * API name: {@code evictions} */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; + @Nonnull + public final Builder evictions(@Nullable Long value) { + this.evictions = value; return this; } /** * API name: {@code fields} + * *

- * Adds all entries of map to fields. + * Adds all elements of map to fields. + *

*/ + @Nonnull public final Builder fields(Map map) { this.fields = _mapPutAll(this.fields, map); return this; @@ -197,9 +222,12 @@ public final Builder fields(Map map) { /** * API name: {@code fields} + * *

* Adds an entry to fields. + *

*/ + @Nonnull public final Builder fields(String key, FieldMemoryUsage value) { this.fields = _mapPut(this.fields, key, value); return this; @@ -207,19 +235,41 @@ public final Builder fields(String key, FieldMemoryUsage value) { /** * API name: {@code fields} + * *

- * Adds an entry to fields using a builder lambda. + * Adds a value to fields using a builder lambda. + *

*/ + @Nonnull public final Builder fields(String key, Function> fn) { return fields(key, fn.apply(new FieldMemoryUsage.Builder()).build()); } + /** + * API name: {@code memory_size} + */ + @Nonnull + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + @Nonnull + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + /** * Builds a {@link FielddataStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FielddataStats build() { _checkSingleUse(); @@ -238,12 +288,30 @@ public FielddataStats build() { ); protected static void setupFielddataStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.evictions); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.memorySize); + result = 31 * result + Long.hashCode(this.memorySizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FielddataStats other = (FielddataStats) o; + return Objects.equals(this.evictions, other.evictions) + && Objects.equals(this.fields, other.fields) + && Objects.equals(this.memorySize, other.memorySize) + && this.memorySizeInBytes == other.memorySizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FlushStats.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/FlushStats.java index 63c8a54d0a..7d3896904e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/FlushStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,34 +49,36 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.FlushStats @JsonpDeserializable -public class FlushStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FlushStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long periodic; private final long total; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; // --------------------------------------------------------------------------------------------- private FlushStats(Builder builder) { - this.periodic = ApiTypeHelper.requireNonNull(builder.periodic, this, "periodic"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - } - public static FlushStats of(Function> fn) { + public static FlushStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -91,7 +100,7 @@ public final long total() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -105,6 +114,7 @@ public final long totalTimeInMillis() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,7 +122,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("periodic"); generator.write(this.periodic); @@ -121,33 +130,62 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FlushStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long periodic; - private Long total; - @Nullable - private String totalTime; - + private Time totalTime; private Long totalTimeInMillis; + public Builder() {} + + private Builder(FlushStats o) { + this.periodic = o.periodic; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.periodic = o.periodic; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code periodic} */ + @Nonnull public final Builder periodic(long value) { this.periodic = value; return this; @@ -156,6 +194,7 @@ public final Builder periodic(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -164,14 +203,24 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ + @Nonnull public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; @@ -180,9 +229,10 @@ public final Builder totalTimeInMillis(long value) { /** * Builds a {@link FlushStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FlushStats build() { _checkSingleUse(); @@ -201,12 +251,30 @@ public FlushStats build() { ); protected static void setupFlushStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::periodic, JsonpDeserializer.longDeserializer(), "periodic"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.periodic); + result = 31 * result + Long.hashCode(this.total); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FlushStats other = (FlushStats) o; + return this.periodic == other.periodic + && this.total == other.total + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GetStats.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GetStats.java index 1e35cc72ce..f3e9d01c88 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GetStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,31 +49,35 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.GetStats @JsonpDeserializable -public class GetStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long current; @Nullable - private final String existsTime; + private final Time existsTime; private final long existsTimeInMillis; private final long existsTotal; @Nullable - private final String missingTime; + private final Time missingTime; private final long missingTimeInMillis; private final long missingTotal; @Nullable - private final String time; + private final Time time; private final long timeInMillis; @@ -75,7 +86,6 @@ public class GetStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private GetStats(Builder builder) { - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); this.existsTime = builder.existsTime; this.existsTimeInMillis = ApiTypeHelper.requireNonNull(builder.existsTimeInMillis, this, "existsTimeInMillis"); @@ -86,10 +96,9 @@ private GetStats(Builder builder) { this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - } - public static GetStats of(Function> fn) { + public static GetStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -104,7 +113,7 @@ public final long current() { * API name: {@code exists_time} */ @Nullable - public final String existsTime() { + public final Time existsTime() { return this.existsTime; } @@ -126,7 +135,7 @@ public final long existsTotal() { * API name: {@code missing_time} */ @Nullable - public final String missingTime() { + public final Time missingTime() { return this.missingTime; } @@ -145,10 +154,10 @@ public final long missingTotal() { } /** - * API name: {@code time} + * API name: {@code getTime} */ @Nullable - public final String time() { + public final Time time() { return this.time; } @@ -169,6 +178,7 @@ public final long total() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -176,15 +186,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("current"); generator.write(this.current); if (this.existsTime != null) { generator.writeKey("exists_time"); - generator.write(this.existsTime); - + this.existsTime.serialize(generator, mapper); } + generator.writeKey("exists_time_in_millis"); generator.write(this.existsTimeInMillis); @@ -193,9 +202,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.missingTime != null) { generator.writeKey("missing_time"); - generator.write(this.missingTime); - + this.missingTime.serialize(generator, mapper); } + generator.writeKey("missing_time_in_millis"); generator.write(this.missingTimeInMillis); @@ -203,51 +212,86 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.missingTotal); if (this.time != null) { - generator.writeKey("time"); - generator.write(this.time); - + generator.writeKey("getTime"); + this.time.serialize(generator, mapper); } + generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); generator.writeKey("total"); generator.write(this.total); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long current; - @Nullable - private String existsTime; - + private Time existsTime; private Long existsTimeInMillis; - private Long existsTotal; - @Nullable - private String missingTime; - + private Time missingTime; private Long missingTimeInMillis; - private Long missingTotal; - @Nullable - private String time; - + private Time time; private Long timeInMillis; - private Long total; + public Builder() {} + + private Builder(GetStats o) { + this.current = o.current; + this.existsTime = o.existsTime; + this.existsTimeInMillis = o.existsTimeInMillis; + this.existsTotal = o.existsTotal; + this.missingTime = o.missingTime; + this.missingTimeInMillis = o.missingTimeInMillis; + this.missingTotal = o.missingTotal; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + private Builder(Builder o) { + this.current = o.current; + this.existsTime = o.existsTime; + this.existsTimeInMillis = o.existsTimeInMillis; + this.existsTotal = o.existsTotal; + this.missingTime = o.missingTime; + this.missingTimeInMillis = o.missingTimeInMillis; + this.missingTotal = o.missingTotal; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code current} */ + @Nonnull public final Builder current(long value) { this.current = value; return this; @@ -256,14 +300,24 @@ public final Builder current(long value) { /** * API name: {@code exists_time} */ - public final Builder existsTime(@Nullable String value) { + @Nonnull + public final Builder existsTime(@Nullable Time value) { this.existsTime = value; return this; } + /** + * API name: {@code exists_time} + */ + @Nonnull + public final Builder existsTime(Function> fn) { + return existsTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code exists_time_in_millis} */ + @Nonnull public final Builder existsTimeInMillis(long value) { this.existsTimeInMillis = value; return this; @@ -272,6 +326,7 @@ public final Builder existsTimeInMillis(long value) { /** * Required - API name: {@code exists_total} */ + @Nonnull public final Builder existsTotal(long value) { this.existsTotal = value; return this; @@ -280,14 +335,24 @@ public final Builder existsTotal(long value) { /** * API name: {@code missing_time} */ - public final Builder missingTime(@Nullable String value) { + @Nonnull + public final Builder missingTime(@Nullable Time value) { this.missingTime = value; return this; } + /** + * API name: {@code missing_time} + */ + @Nonnull + public final Builder missingTime(Function> fn) { + return missingTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code missing_time_in_millis} */ + @Nonnull public final Builder missingTimeInMillis(long value) { this.missingTimeInMillis = value; return this; @@ -296,22 +361,33 @@ public final Builder missingTimeInMillis(long value) { /** * Required - API name: {@code missing_total} */ + @Nonnull public final Builder missingTotal(long value) { this.missingTotal = value; return this; } /** - * API name: {@code time} + * API name: {@code getTime} */ - public final Builder time(@Nullable String value) { + @Nonnull + public final Builder time(@Nullable Time value) { this.time = value; return this; } + /** + * API name: {@code getTime} + */ + @Nonnull + public final Builder time(Function> fn) { + return time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ + @Nonnull public final Builder timeInMillis(long value) { this.timeInMillis = value; return this; @@ -320,6 +396,7 @@ public final Builder timeInMillis(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -328,9 +405,10 @@ public final Builder total(long value) { /** * Builds a {@link GetStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetStats build() { _checkSingleUse(); @@ -349,18 +427,48 @@ public GetStats build() { ); protected static void setupGetStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); + op.add(Builder::existsTime, Time._DESERIALIZER, "exists_time"); op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); - op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); + op.add(Builder::missingTime, Time._DESERIALIZER, "missing_time"); op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); - op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); + op.add(Builder::time, Time._DESERIALIZER, "getTime"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.current); + result = 31 * result + Objects.hashCode(this.existsTime); + result = 31 * result + Long.hashCode(this.existsTimeInMillis); + result = 31 * result + Long.hashCode(this.existsTotal); + result = 31 * result + Objects.hashCode(this.missingTime); + result = 31 * result + Long.hashCode(this.missingTimeInMillis); + result = 31 * result + Long.hashCode(this.missingTotal); + result = 31 * result + Objects.hashCode(this.time); + result = 31 * result + Long.hashCode(this.timeInMillis); + result = 31 * result + Long.hashCode(this.total); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetStats other = (GetStats) o; + return this.current == other.current + && Objects.equals(this.existsTime, other.existsTime) + && this.existsTimeInMillis == other.existsTimeInMillis + && this.existsTotal == other.existsTotal + && Objects.equals(this.missingTime, other.missingTime) + && this.missingTimeInMillis == other.missingTimeInMillis + && this.missingTotal == other.missingTotal + && Objects.equals(this.time, other.time) + && this.timeInMillis == other.timeInMillis + && this.total == other.total; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndexingStats.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndexingStats.java index da024b35f7..f78d089440 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndexingStats.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; -import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,76 +49,72 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.IndexingStats @JsonpDeserializable -public class IndexingStats implements PlainJsonSerializable { - private final long indexCurrent; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexingStats implements PlainJsonSerializable, ToCopyableBuilder { private final long deleteCurrent; @Nullable - private final String deleteTime; + private final Time deleteTime; private final long deleteTimeInMillis; private final long deleteTotal; - private final boolean isThrottled; - - private final long noopUpdateTotal; - @Nullable - private final String throttleTime; + private final DocStatus docStatus; - private final long throttleTimeInMillis; + private final long indexCurrent; + + private final long indexFailed; @Nullable - private final String indexTime; + private final Time indexTime; private final long indexTimeInMillis; private final long indexTotal; - private final long indexFailed; + private final boolean isThrottled; - private final Map types; + private final long noopUpdateTotal; + + @Nullable + private final Time throttleTime; + + private final long throttleTimeInMillis; // --------------------------------------------------------------------------------------------- private IndexingStats(Builder builder) { - - this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); this.deleteCurrent = ApiTypeHelper.requireNonNull(builder.deleteCurrent, this, "deleteCurrent"); this.deleteTime = builder.deleteTime; this.deleteTimeInMillis = ApiTypeHelper.requireNonNull(builder.deleteTimeInMillis, this, "deleteTimeInMillis"); this.deleteTotal = ApiTypeHelper.requireNonNull(builder.deleteTotal, this, "deleteTotal"); + this.docStatus = builder.docStatus; + this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); + this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); + this.indexTime = builder.indexTime; + this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); + this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); this.isThrottled = ApiTypeHelper.requireNonNull(builder.isThrottled, this, "isThrottled"); this.noopUpdateTotal = ApiTypeHelper.requireNonNull(builder.noopUpdateTotal, this, "noopUpdateTotal"); this.throttleTime = builder.throttleTime; this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); - this.indexTime = builder.indexTime; - this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); - this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); - this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); - this.types = ApiTypeHelper.unmodifiable(builder.types); - } - public static IndexingStats of(Function> fn) { + public static IndexingStats of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code index_current} - */ - public final long indexCurrent() { - return this.indexCurrent; - } - /** * Required - API name: {@code delete_current} */ @@ -124,7 +126,7 @@ public final long deleteCurrent() { * API name: {@code delete_time} */ @Nullable - public final String deleteTime() { + public final Time deleteTime() { return this.deleteTime; } @@ -143,39 +145,32 @@ public final long deleteTotal() { } /** - * Required - API name: {@code is_throttled} - */ - public final boolean isThrottled() { - return this.isThrottled; - } - - /** - * Required - API name: {@code noop_update_total} + * API name: {@code doc_status} */ - public final long noopUpdateTotal() { - return this.noopUpdateTotal; + @Nullable + public final DocStatus docStatus() { + return this.docStatus; } /** - * API name: {@code throttle_time} + * Required - API name: {@code index_current} */ - @Nullable - public final String throttleTime() { - return this.throttleTime; + public final long indexCurrent() { + return this.indexCurrent; } /** - * Required - API name: {@code throttle_time_in_millis} + * Required - API name: {@code index_failed} */ - public final long throttleTimeInMillis() { - return this.throttleTimeInMillis; + public final long indexFailed() { + return this.indexFailed; } /** * API name: {@code index_time} */ @Nullable - public final String indexTime() { + public final Time indexTime() { return this.indexTime; } @@ -194,22 +189,38 @@ public final long indexTotal() { } /** - * Required - API name: {@code index_failed} + * Required - API name: {@code is_throttled} */ - public final long indexFailed() { - return this.indexFailed; + public final boolean isThrottled() { + return this.isThrottled; } /** - * API name: {@code types} + * Required - API name: {@code noop_update_total} */ - public final Map types() { - return this.types; + public final long noopUpdateTotal() { + return this.noopUpdateTotal; + } + + /** + * API name: {@code throttle_time} + */ + @Nullable + public final Time throttleTime() { + return this.throttleTime; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final long throttleTimeInMillis() { + return this.throttleTimeInMillis; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -217,116 +228,139 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index_current"); - generator.write(this.indexCurrent); - generator.writeKey("delete_current"); generator.write(this.deleteCurrent); if (this.deleteTime != null) { generator.writeKey("delete_time"); - generator.write(this.deleteTime); - + this.deleteTime.serialize(generator, mapper); } + generator.writeKey("delete_time_in_millis"); generator.write(this.deleteTimeInMillis); generator.writeKey("delete_total"); generator.write(this.deleteTotal); - generator.writeKey("is_throttled"); - generator.write(this.isThrottled); - - generator.writeKey("noop_update_total"); - generator.write(this.noopUpdateTotal); + if (this.docStatus != null) { + generator.writeKey("doc_status"); + this.docStatus.serialize(generator, mapper); + } - if (this.throttleTime != null) { - generator.writeKey("throttle_time"); - generator.write(this.throttleTime); + generator.writeKey("index_current"); + generator.write(this.indexCurrent); - } - generator.writeKey("throttle_time_in_millis"); - generator.write(this.throttleTimeInMillis); + generator.writeKey("index_failed"); + generator.write(this.indexFailed); if (this.indexTime != null) { generator.writeKey("index_time"); - generator.write(this.indexTime); - + this.indexTime.serialize(generator, mapper); } + generator.writeKey("index_time_in_millis"); generator.write(this.indexTimeInMillis); generator.writeKey("index_total"); generator.write(this.indexTotal); - generator.writeKey("index_failed"); - generator.write(this.indexFailed); - - if (ApiTypeHelper.isDefined(this.types)) { - generator.writeKey("types"); - generator.writeStartObject(); - for (Map.Entry item0 : this.types.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeKey("is_throttled"); + generator.write(this.isThrottled); - } - generator.writeEnd(); + generator.writeKey("noop_update_total"); + generator.write(this.noopUpdateTotal); + if (this.throttleTime != null) { + generator.writeKey("throttle_time"); + this.throttleTime.serialize(generator, mapper); } + generator.writeKey("throttle_time_in_millis"); + generator.write(this.throttleTimeInMillis); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndexingStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long indexCurrent; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long deleteCurrent; - @Nullable - private String deleteTime; - + private Time deleteTime; private Long deleteTimeInMillis; - private Long deleteTotal; - - private Boolean isThrottled; - - private Long noopUpdateTotal; - @Nullable - private String throttleTime; - - private Long throttleTimeInMillis; - + private DocStatus docStatus; + private Long indexCurrent; + private Long indexFailed; @Nullable - private String indexTime; - + private Time indexTime; private Long indexTimeInMillis; - private Long indexTotal; + private Boolean isThrottled; + private Long noopUpdateTotal; + @Nullable + private Time throttleTime; + private Long throttleTimeInMillis; - private Long indexFailed; + public Builder() {} + + private Builder(IndexingStats o) { + this.deleteCurrent = o.deleteCurrent; + this.deleteTime = o.deleteTime; + this.deleteTimeInMillis = o.deleteTimeInMillis; + this.deleteTotal = o.deleteTotal; + this.docStatus = o.docStatus; + this.indexCurrent = o.indexCurrent; + this.indexFailed = o.indexFailed; + this.indexTime = o.indexTime; + this.indexTimeInMillis = o.indexTimeInMillis; + this.indexTotal = o.indexTotal; + this.isThrottled = o.isThrottled; + this.noopUpdateTotal = o.noopUpdateTotal; + this.throttleTime = o.throttleTime; + this.throttleTimeInMillis = o.throttleTimeInMillis; + } - @Nullable - private Map types; + private Builder(Builder o) { + this.deleteCurrent = o.deleteCurrent; + this.deleteTime = o.deleteTime; + this.deleteTimeInMillis = o.deleteTimeInMillis; + this.deleteTotal = o.deleteTotal; + this.docStatus = o.docStatus; + this.indexCurrent = o.indexCurrent; + this.indexFailed = o.indexFailed; + this.indexTime = o.indexTime; + this.indexTimeInMillis = o.indexTimeInMillis; + this.indexTotal = o.indexTotal; + this.isThrottled = o.isThrottled; + this.noopUpdateTotal = o.noopUpdateTotal; + this.throttleTime = o.throttleTime; + this.throttleTimeInMillis = o.throttleTimeInMillis; + } - /** - * Required - API name: {@code index_current} - */ - public final Builder indexCurrent(long value) { - this.indexCurrent = value; - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code delete_current} */ + @Nonnull public final Builder deleteCurrent(long value) { this.deleteCurrent = value; return this; @@ -335,14 +369,24 @@ public final Builder deleteCurrent(long value) { /** * API name: {@code delete_time} */ - public final Builder deleteTime(@Nullable String value) { + @Nonnull + public final Builder deleteTime(@Nullable Time value) { this.deleteTime = value; return this; } + /** + * API name: {@code delete_time} + */ + @Nonnull + public final Builder deleteTime(Function> fn) { + return deleteTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code delete_time_in_millis} */ + @Nonnull public final Builder deleteTimeInMillis(long value) { this.deleteTimeInMillis = value; return this; @@ -351,54 +395,68 @@ public final Builder deleteTimeInMillis(long value) { /** * Required - API name: {@code delete_total} */ + @Nonnull public final Builder deleteTotal(long value) { this.deleteTotal = value; return this; } /** - * Required - API name: {@code is_throttled} + * API name: {@code doc_status} */ - public final Builder isThrottled(boolean value) { - this.isThrottled = value; + @Nonnull + public final Builder docStatus(@Nullable DocStatus value) { + this.docStatus = value; return this; } /** - * Required - API name: {@code noop_update_total} + * API name: {@code doc_status} */ - public final Builder noopUpdateTotal(long value) { - this.noopUpdateTotal = value; - return this; + @Nonnull + public final Builder docStatus(Function> fn) { + return docStatus(fn.apply(new DocStatus.Builder()).build()); } /** - * API name: {@code throttle_time} + * Required - API name: {@code index_current} */ - public final Builder throttleTime(@Nullable String value) { - this.throttleTime = value; + @Nonnull + public final Builder indexCurrent(long value) { + this.indexCurrent = value; return this; } /** - * Required - API name: {@code throttle_time_in_millis} + * Required - API name: {@code index_failed} */ - public final Builder throttleTimeInMillis(long value) { - this.throttleTimeInMillis = value; + @Nonnull + public final Builder indexFailed(long value) { + this.indexFailed = value; return this; } /** * API name: {@code index_time} */ - public final Builder indexTime(@Nullable String value) { + @Nonnull + public final Builder indexTime(@Nullable Time value) { this.indexTime = value; return this; } + /** + * API name: {@code index_time} + */ + @Nonnull + public final Builder indexTime(Function> fn) { + return indexTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code index_time_in_millis} */ + @Nonnull public final Builder indexTimeInMillis(long value) { this.indexTimeInMillis = value; return this; @@ -407,54 +465,63 @@ public final Builder indexTimeInMillis(long value) { /** * Required - API name: {@code index_total} */ + @Nonnull public final Builder indexTotal(long value) { this.indexTotal = value; return this; } /** - * Required - API name: {@code index_failed} + * Required - API name: {@code is_throttled} */ - public final Builder indexFailed(long value) { - this.indexFailed = value; + @Nonnull + public final Builder isThrottled(boolean value) { + this.isThrottled = value; return this; } /** - * API name: {@code types} - *

- * Adds all entries of map to types. + * Required - API name: {@code noop_update_total} */ - public final Builder types(Map map) { - this.types = _mapPutAll(this.types, map); + @Nonnull + public final Builder noopUpdateTotal(long value) { + this.noopUpdateTotal = value; return this; } /** - * API name: {@code types} - *

- * Adds an entry to types. + * API name: {@code throttle_time} */ - public final Builder types(String key, IndexingStats value) { - this.types = _mapPut(this.types, key, value); + @Nonnull + public final Builder throttleTime(@Nullable Time value) { + this.throttleTime = value; return this; } /** - * API name: {@code types} - *

- * Adds an entry to types using a builder lambda. + * API name: {@code throttle_time} */ - public final Builder types(String key, Function> fn) { - return types(key, fn.apply(new IndexingStats.Builder()).build()); + @Nonnull + public final Builder throttleTime(Function> fn) { + return throttleTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + @Nonnull + public final Builder throttleTimeInMillis(long value) { + this.throttleTimeInMillis = value; + return this; } /** * Builds a {@link IndexingStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndexingStats build() { _checkSingleUse(); @@ -473,22 +540,60 @@ public IndexingStats build() { ); protected static void setupIndexingStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); op.add(Builder::deleteCurrent, JsonpDeserializer.longDeserializer(), "delete_current"); - op.add(Builder::deleteTime, JsonpDeserializer.stringDeserializer(), "delete_time"); + op.add(Builder::deleteTime, Time._DESERIALIZER, "delete_time"); op.add(Builder::deleteTimeInMillis, JsonpDeserializer.longDeserializer(), "delete_time_in_millis"); op.add(Builder::deleteTotal, JsonpDeserializer.longDeserializer(), "delete_total"); + op.add(Builder::docStatus, DocStatus._DESERIALIZER, "doc_status"); + op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); + op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); + op.add(Builder::indexTime, Time._DESERIALIZER, "index_time"); + op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); + op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); op.add(Builder::isThrottled, JsonpDeserializer.booleanDeserializer(), "is_throttled"); op.add(Builder::noopUpdateTotal, JsonpDeserializer.longDeserializer(), "noop_update_total"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTime, Time._DESERIALIZER, "throttle_time"); op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); - op.add(Builder::indexTime, JsonpDeserializer.stringDeserializer(), "index_time"); - op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); - op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); - op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); - op.add(Builder::types, JsonpDeserializer.stringMapDeserializer(IndexingStats._DESERIALIZER), "types"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.deleteCurrent); + result = 31 * result + Objects.hashCode(this.deleteTime); + result = 31 * result + Long.hashCode(this.deleteTimeInMillis); + result = 31 * result + Long.hashCode(this.deleteTotal); + result = 31 * result + Objects.hashCode(this.docStatus); + result = 31 * result + Long.hashCode(this.indexCurrent); + result = 31 * result + Long.hashCode(this.indexFailed); + result = 31 * result + Objects.hashCode(this.indexTime); + result = 31 * result + Long.hashCode(this.indexTimeInMillis); + result = 31 * result + Long.hashCode(this.indexTotal); + result = 31 * result + Boolean.hashCode(this.isThrottled); + result = 31 * result + Long.hashCode(this.noopUpdateTotal); + result = 31 * result + Objects.hashCode(this.throttleTime); + result = 31 * result + Long.hashCode(this.throttleTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexingStats other = (IndexingStats) o; + return this.deleteCurrent == other.deleteCurrent + && Objects.equals(this.deleteTime, other.deleteTime) + && this.deleteTimeInMillis == other.deleteTimeInMillis + && this.deleteTotal == other.deleteTotal + && Objects.equals(this.docStatus, other.docStatus) + && this.indexCurrent == other.indexCurrent + && this.indexFailed == other.indexFailed + && Objects.equals(this.indexTime, other.indexTime) + && this.indexTimeInMillis == other.indexTimeInMillis + && this.indexTotal == other.indexTotal + && this.isThrottled == other.isThrottled + && this.noopUpdateTotal == other.noopUpdateTotal + && Objects.equals(this.throttleTime, other.throttleTime) + && this.throttleTimeInMillis == other.throttleTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Level.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/Level.java index a7df990bb7..77e5517661 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Level.java @@ -30,20 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.Level + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum Level implements JsonEnum { Cluster("cluster"), Indices("indices"), - Shards("shards"), - - ; + Shards("shards"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/MergesStats.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/MergesStats.java index b7c743e2d6..9eeff90932 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/MergesStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.MergesStats @JsonpDeserializable -public class MergesStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MergesStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long current; private final long currentDocs; @@ -73,24 +84,26 @@ public class MergesStats implements PlainJsonSerializable { private final long totalSizeInBytes; @Nullable - private final String totalStoppedTime; + private final Time totalStoppedTime; private final long totalStoppedTimeInMillis; @Nullable - private final String totalThrottledTime; + private final Time totalThrottledTime; private final long totalThrottledTimeInMillis; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; + @Nullable + private final Long unreferencedFileCleanupsPerformed; + // --------------------------------------------------------------------------------------------- private MergesStats(Builder builder) { - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); this.currentDocs = ApiTypeHelper.requireNonNull(builder.currentDocs, this, "currentDocs"); this.currentSize = builder.currentSize; @@ -111,10 +124,10 @@ private MergesStats(Builder builder) { ); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - + this.unreferencedFileCleanupsPerformed = builder.unreferencedFileCleanupsPerformed; } - public static MergesStats of(Function> fn) { + public static MergesStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -195,7 +208,7 @@ public final long totalSizeInBytes() { * API name: {@code total_stopped_time} */ @Nullable - public final String totalStoppedTime() { + public final Time totalStoppedTime() { return this.totalStoppedTime; } @@ -210,7 +223,7 @@ public final long totalStoppedTimeInMillis() { * API name: {@code total_throttled_time} */ @Nullable - public final String totalThrottledTime() { + public final Time totalThrottledTime() { return this.totalThrottledTime; } @@ -225,7 +238,7 @@ public final long totalThrottledTimeInMillis() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -236,9 +249,18 @@ public final long totalTimeInMillis() { return this.totalTimeInMillis; } + /** + * API name: {@code unreferenced_file_cleanups_performed} + */ + @Nullable + public final Long unreferencedFileCleanupsPerformed() { + return this.unreferencedFileCleanupsPerformed; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -246,7 +268,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("current"); generator.write(this.current); @@ -256,8 +277,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.currentSize != null) { generator.writeKey("current_size"); generator.write(this.currentSize); - } + generator.writeKey("current_size_in_bytes"); generator.write(this.currentSizeInBytes); @@ -267,8 +288,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalAutoThrottle != null) { generator.writeKey("total_auto_throttle"); generator.write(this.totalAutoThrottle); - } + generator.writeKey("total_auto_throttle_in_bytes"); generator.write(this.totalAutoThrottleInBytes); @@ -278,85 +299,135 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalSize != null) { generator.writeKey("total_size"); generator.write(this.totalSize); - } + generator.writeKey("total_size_in_bytes"); generator.write(this.totalSizeInBytes); if (this.totalStoppedTime != null) { generator.writeKey("total_stopped_time"); - generator.write(this.totalStoppedTime); - + this.totalStoppedTime.serialize(generator, mapper); } + generator.writeKey("total_stopped_time_in_millis"); generator.write(this.totalStoppedTimeInMillis); if (this.totalThrottledTime != null) { generator.writeKey("total_throttled_time"); - generator.write(this.totalThrottledTime); - + this.totalThrottledTime.serialize(generator, mapper); } + generator.writeKey("total_throttled_time_in_millis"); generator.write(this.totalThrottledTimeInMillis); if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); + if (this.unreferencedFileCleanupsPerformed != null) { + generator.writeKey("unreferenced_file_cleanups_performed"); + generator.write(this.unreferencedFileCleanupsPerformed); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MergesStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long current; - private Long currentDocs; - @Nullable private String currentSize; - private Long currentSizeInBytes; - private Long total; - @Nullable private String totalAutoThrottle; - private Long totalAutoThrottleInBytes; - private Long totalDocs; - @Nullable private String totalSize; - private Long totalSizeInBytes; - @Nullable - private String totalStoppedTime; - + private Time totalStoppedTime; private Long totalStoppedTimeInMillis; - @Nullable - private String totalThrottledTime; - + private Time totalThrottledTime; private Long totalThrottledTimeInMillis; - @Nullable - private String totalTime; - + private Time totalTime; private Long totalTimeInMillis; + @Nullable + private Long unreferencedFileCleanupsPerformed; + + public Builder() {} + + private Builder(MergesStats o) { + this.current = o.current; + this.currentDocs = o.currentDocs; + this.currentSize = o.currentSize; + this.currentSizeInBytes = o.currentSizeInBytes; + this.total = o.total; + this.totalAutoThrottle = o.totalAutoThrottle; + this.totalAutoThrottleInBytes = o.totalAutoThrottleInBytes; + this.totalDocs = o.totalDocs; + this.totalSize = o.totalSize; + this.totalSizeInBytes = o.totalSizeInBytes; + this.totalStoppedTime = o.totalStoppedTime; + this.totalStoppedTimeInMillis = o.totalStoppedTimeInMillis; + this.totalThrottledTime = o.totalThrottledTime; + this.totalThrottledTimeInMillis = o.totalThrottledTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + this.unreferencedFileCleanupsPerformed = o.unreferencedFileCleanupsPerformed; + } + + private Builder(Builder o) { + this.current = o.current; + this.currentDocs = o.currentDocs; + this.currentSize = o.currentSize; + this.currentSizeInBytes = o.currentSizeInBytes; + this.total = o.total; + this.totalAutoThrottle = o.totalAutoThrottle; + this.totalAutoThrottleInBytes = o.totalAutoThrottleInBytes; + this.totalDocs = o.totalDocs; + this.totalSize = o.totalSize; + this.totalSizeInBytes = o.totalSizeInBytes; + this.totalStoppedTime = o.totalStoppedTime; + this.totalStoppedTimeInMillis = o.totalStoppedTimeInMillis; + this.totalThrottledTime = o.totalThrottledTime; + this.totalThrottledTimeInMillis = o.totalThrottledTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + this.unreferencedFileCleanupsPerformed = o.unreferencedFileCleanupsPerformed; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code current} */ + @Nonnull public final Builder current(long value) { this.current = value; return this; @@ -365,6 +436,7 @@ public final Builder current(long value) { /** * Required - API name: {@code current_docs} */ + @Nonnull public final Builder currentDocs(long value) { this.currentDocs = value; return this; @@ -373,6 +445,7 @@ public final Builder currentDocs(long value) { /** * API name: {@code current_size} */ + @Nonnull public final Builder currentSize(@Nullable String value) { this.currentSize = value; return this; @@ -381,6 +454,7 @@ public final Builder currentSize(@Nullable String value) { /** * Required - API name: {@code current_size_in_bytes} */ + @Nonnull public final Builder currentSizeInBytes(long value) { this.currentSizeInBytes = value; return this; @@ -389,6 +463,7 @@ public final Builder currentSizeInBytes(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -397,6 +472,7 @@ public final Builder total(long value) { /** * API name: {@code total_auto_throttle} */ + @Nonnull public final Builder totalAutoThrottle(@Nullable String value) { this.totalAutoThrottle = value; return this; @@ -405,6 +481,7 @@ public final Builder totalAutoThrottle(@Nullable String value) { /** * Required - API name: {@code total_auto_throttle_in_bytes} */ + @Nonnull public final Builder totalAutoThrottleInBytes(long value) { this.totalAutoThrottleInBytes = value; return this; @@ -413,6 +490,7 @@ public final Builder totalAutoThrottleInBytes(long value) { /** * Required - API name: {@code total_docs} */ + @Nonnull public final Builder totalDocs(long value) { this.totalDocs = value; return this; @@ -421,6 +499,7 @@ public final Builder totalDocs(long value) { /** * API name: {@code total_size} */ + @Nonnull public final Builder totalSize(@Nullable String value) { this.totalSize = value; return this; @@ -429,6 +508,7 @@ public final Builder totalSize(@Nullable String value) { /** * Required - API name: {@code total_size_in_bytes} */ + @Nonnull public final Builder totalSizeInBytes(long value) { this.totalSizeInBytes = value; return this; @@ -437,14 +517,24 @@ public final Builder totalSizeInBytes(long value) { /** * API name: {@code total_stopped_time} */ - public final Builder totalStoppedTime(@Nullable String value) { + @Nonnull + public final Builder totalStoppedTime(@Nullable Time value) { this.totalStoppedTime = value; return this; } + /** + * API name: {@code total_stopped_time} + */ + @Nonnull + public final Builder totalStoppedTime(Function> fn) { + return totalStoppedTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_stopped_time_in_millis} */ + @Nonnull public final Builder totalStoppedTimeInMillis(long value) { this.totalStoppedTimeInMillis = value; return this; @@ -453,14 +543,24 @@ public final Builder totalStoppedTimeInMillis(long value) { /** * API name: {@code total_throttled_time} */ - public final Builder totalThrottledTime(@Nullable String value) { + @Nonnull + public final Builder totalThrottledTime(@Nullable Time value) { this.totalThrottledTime = value; return this; } + /** + * API name: {@code total_throttled_time} + */ + @Nonnull + public final Builder totalThrottledTime(Function> fn) { + return totalThrottledTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_throttled_time_in_millis} */ + @Nonnull public final Builder totalThrottledTimeInMillis(long value) { this.totalThrottledTimeInMillis = value; return this; @@ -469,25 +569,45 @@ public final Builder totalThrottledTimeInMillis(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ + @Nonnull public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } + /** + * API name: {@code unreferenced_file_cleanups_performed} + */ + @Nonnull + public final Builder unreferencedFileCleanupsPerformed(@Nullable Long value) { + this.unreferencedFileCleanupsPerformed = value; + return this; + } + /** * Builds a {@link MergesStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MergesStats build() { _checkSingleUse(); @@ -506,7 +626,6 @@ public MergesStats build() { ); protected static void setupMergesStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); op.add(Builder::currentDocs, JsonpDeserializer.longDeserializer(), "current_docs"); op.add(Builder::currentSize, JsonpDeserializer.stringDeserializer(), "current_size"); @@ -517,13 +636,59 @@ protected static void setupMergesStatsDeserializer(ObjectDeserializer { + + @Nonnull private final Map attributes; + @Nonnull private final String ephemeralId; + @Nullable + private final String externalId; + @Nullable private final String id; + @Nonnull private final String name; - private final String transportAddress; - + @Nonnull private final List roles; + @Nonnull + private final String transportAddress; + // --------------------------------------------------------------------------------------------- private NodeAttributes(Builder builder) { - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); this.ephemeralId = ApiTypeHelper.requireNonNull(builder.ephemeralId, this, "ephemeralId"); + this.externalId = builder.externalId; this.id = builder.id; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); this.roles = ApiTypeHelper.unmodifiable(builder.roles); - + this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); } - public static NodeAttributes of(Function> fn) { + public static NodeAttributes of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -85,23 +103,30 @@ public static NodeAttributes of(Function> * Required - Lists node attributes. *

* API name: {@code attributes} + *

*/ + @Nonnull public final Map attributes() { return this.attributes; } /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} + * Required - API name: {@code ephemeral_id} */ + @Nonnull public final String ephemeralId() { return this.ephemeralId; } /** - * The unique identifier of the node. - *

+ * API name: {@code external_id} + */ + @Nullable + public final String externalId() { + return this.externalId; + } + + /** * API name: {@code id} */ @Nullable @@ -110,33 +135,33 @@ public final String id() { } /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} + * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} + * API name: {@code roles} */ - public final String transportAddress() { - return this.transportAddress; + @Nonnull + public final List roles() { + return this.roles; } /** - * API name: {@code roles} + * Required - API name: {@code transport_address} */ - public final List roles() { - return this.roles; + @Nonnull + public final String transportAddress() { + return this.transportAddress; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -144,32 +169,30 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } + generator.writeEnd(); + generator.writeKey("ephemeral_id"); generator.write(this.ephemeralId); + if (this.externalId != null) { + generator.writeKey("external_id"); + generator.write(this.externalId); + } + if (this.id != null) { generator.writeKey("id"); generator.write(this.id); - } + generator.writeKey("name"); generator.write(this.name); - generator.writeKey("transport_address"); - generator.write(this.transportAddress); - if (ApiTypeHelper.isDefined(this.roles)) { generator.writeKey("roles"); generator.writeStartArray(); @@ -177,39 +200,79 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { item0.serialize(generator, mapper); } generator.writeEnd(); - } + generator.writeKey("transport_address"); + generator.write(this.transportAddress); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NodeAttributes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map attributes; - private String ephemeralId; - + @Nullable + private String externalId; @Nullable private String id; - private String name; - - private String transportAddress; - @Nullable private List roles; + private String transportAddress; + + public Builder() {} + + private Builder(NodeAttributes o) { + this.attributes = _mapCopy(o.attributes); + this.ephemeralId = o.ephemeralId; + this.externalId = o.externalId; + this.id = o.id; + this.name = o.name; + this.roles = _listCopy(o.roles); + this.transportAddress = o.transportAddress; + } + + private Builder(Builder o) { + this.attributes = _mapCopy(o.attributes); + this.ephemeralId = o.ephemeralId; + this.externalId = o.externalId; + this.id = o.id; + this.name = o.name; + this.roles = _listCopy(o.roles); + this.transportAddress = o.transportAddress; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - Lists node attributes. *

* API name: {@code attributes} + *

+ * *

- * Adds all entries of map to attributes. + * Adds all elements of map to attributes. + *

*/ + @Nonnull public final Builder attributes(Map map) { this.attributes = _mapPutAll(this.attributes, map); return this; @@ -219,59 +282,62 @@ public final Builder attributes(Map map) { * Required - Lists node attributes. *

* API name: {@code attributes} + *

+ * *

* Adds an entry to attributes. + *

*/ + @Nonnull public final Builder attributes(String key, String value) { this.attributes = _mapPut(this.attributes, key, value); return this; } /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} + * Required - API name: {@code ephemeral_id} */ + @Nonnull public final Builder ephemeralId(String value) { this.ephemeralId = value; return this; } /** - * The unique identifier of the node. - *

- * API name: {@code id} + * API name: {@code external_id} */ - public final Builder id(@Nullable String value) { - this.id = value; + @Nonnull + public final Builder externalId(@Nullable String value) { + this.externalId = value; return this; } /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} + * API name: {@code id} */ - public final Builder name(String value) { - this.name = value; + @Nonnull + public final Builder id(@Nullable String value) { + this.id = value; return this; } /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} + * Required - API name: {@code name} */ - public final Builder transportAddress(String value) { - this.transportAddress = value; + @Nonnull + public final Builder name(String value) { + this.name = value; return this; } /** * API name: {@code roles} + * *

* Adds all elements of list to roles. + *

*/ + @Nonnull public final Builder roles(List list) { this.roles = _listAddAll(this.roles, list); return this; @@ -279,20 +345,33 @@ public final Builder roles(List list) { /** * API name: {@code roles} + * *

* Adds one or more values to roles. + *

*/ + @Nonnull public final Builder roles(NodeRole value, NodeRole... values) { this.roles = _listAdd(this.roles, value, values); return this; } + /** + * Required - API name: {@code transport_address} + */ + @Nonnull + public final Builder transportAddress(String value) { + this.transportAddress = value; + return this; + } + /** * Builds a {@link NodeAttributes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NodeAttributes build() { _checkSingleUse(); @@ -311,14 +390,39 @@ public NodeAttributes build() { ); protected static void setupNodeAttributesDeserializer(ObjectDeserializer op) { - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(Builder::ephemeralId, JsonpDeserializer.stringDeserializer(), "ephemeral_id"); + op.add(Builder::externalId, JsonpDeserializer.stringDeserializer(), "external_id"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); + op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.attributes.hashCode(); + result = 31 * result + this.ephemeralId.hashCode(); + result = 31 * result + Objects.hashCode(this.externalId); + result = 31 * result + Objects.hashCode(this.id); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.roles); + result = 31 * result + this.transportAddress.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodeAttributes other = (NodeAttributes) o; + return this.attributes.equals(other.attributes) + && this.ephemeralId.equals(other.ephemeralId) + && Objects.equals(this.externalId, other.externalId) + && Objects.equals(this.id, other.id) + && this.name.equals(other.name) + && Objects.equals(this.roles, other.roles) + && this.transportAddress.equals(other.transportAddress); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java index 3ee1dedd97..2dc1b0f92e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.QueryCacheStats @JsonpDeserializable -public class QueryCacheStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class QueryCacheStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long cacheCount; private final long cacheSize; @@ -69,7 +80,6 @@ public class QueryCacheStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private QueryCacheStats(Builder builder) { - this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); @@ -78,36 +88,48 @@ private QueryCacheStats(Builder builder) { this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); - } - public static QueryCacheStats of(Function> fn) { + public static QueryCacheStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code cache_count} + * Required - The total number of entries added to the query cache across all shards assigned to the selected nodes. This number + * includes all current and evicted entries. + *

+ * API name: {@code cache_count} + *

*/ public final long cacheCount() { return this.cacheCount; } /** - * Required - API name: {@code cache_size} + * Required - The total number of entries currently stored in the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code cache_size} + *

*/ public final long cacheSize() { return this.cacheSize; } /** - * Required - API name: {@code evictions} + * Required - The total number of query cache evictions across all shards assigned to the selected nodes. + *

+ * API name: {@code evictions} + *

*/ public final long evictions() { return this.evictions; } /** - * Required - API name: {@code hit_count} + * Required - The total number of query cache hits across all shards assigned to the selected nodes. + *

+ * API name: {@code hit_count} + *

*/ public final long hitCount() { return this.hitCount; @@ -122,21 +144,30 @@ public final String memorySize() { } /** - * Required - API name: {@code memory_size_in_bytes} + * Required - The total amount, in bytes, of memory used for the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code memory_size_in_bytes} + *

*/ public final long memorySizeInBytes() { return this.memorySizeInBytes; } /** - * Required - API name: {@code miss_count} + * Required - The total number of query cache misses across all shards assigned to the selected nodes. + *

+ * API name: {@code miss_count} + *

*/ public final long missCount() { return this.missCount; } /** - * Required - API name: {@code total_count} + * Required - The total number of hits and misses stored in the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code total_count} + *

*/ public final long totalCount() { return this.totalCount; @@ -153,7 +184,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("cache_count"); generator.write(this.cacheCount); @@ -169,8 +199,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.memorySize != null) { generator.writeKey("memory_size"); generator.write(this.memorySize); - } + generator.writeKey("memory_size_in_bytes"); generator.write(this.memorySizeInBytes); @@ -179,60 +209,109 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total_count"); generator.write(this.totalCount); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link QueryCacheStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long cacheCount; - private Long cacheSize; - private Long evictions; - private Long hitCount; - @Nullable private String memorySize; - private Long memorySizeInBytes; - private Long missCount; - private Long totalCount; + public Builder() {} + + private Builder(QueryCacheStats o) { + this.cacheCount = o.cacheCount; + this.cacheSize = o.cacheSize; + this.evictions = o.evictions; + this.hitCount = o.hitCount; + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + this.missCount = o.missCount; + this.totalCount = o.totalCount; + } + + private Builder(Builder o) { + this.cacheCount = o.cacheCount; + this.cacheSize = o.cacheSize; + this.evictions = o.evictions; + this.hitCount = o.hitCount; + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + this.missCount = o.missCount; + this.totalCount = o.totalCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code cache_count} + * Required - The total number of entries added to the query cache across all shards assigned to the selected nodes. This number + * includes all current and evicted entries. + *

+ * API name: {@code cache_count} + *

*/ + @Nonnull public final Builder cacheCount(long value) { this.cacheCount = value; return this; } /** - * Required - API name: {@code cache_size} + * Required - The total number of entries currently stored in the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code cache_size} + *

*/ + @Nonnull public final Builder cacheSize(long value) { this.cacheSize = value; return this; } /** - * Required - API name: {@code evictions} + * Required - The total number of query cache evictions across all shards assigned to the selected nodes. + *

+ * API name: {@code evictions} + *

*/ + @Nonnull public final Builder evictions(long value) { this.evictions = value; return this; } /** - * Required - API name: {@code hit_count} + * Required - The total number of query cache hits across all shards assigned to the selected nodes. + *

+ * API name: {@code hit_count} + *

*/ + @Nonnull public final Builder hitCount(long value) { this.hitCount = value; return this; @@ -241,30 +320,43 @@ public final Builder hitCount(long value) { /** * API name: {@code memory_size} */ + @Nonnull public final Builder memorySize(@Nullable String value) { this.memorySize = value; return this; } /** - * Required - API name: {@code memory_size_in_bytes} + * Required - The total amount, in bytes, of memory used for the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code memory_size_in_bytes} + *

*/ + @Nonnull public final Builder memorySizeInBytes(long value) { this.memorySizeInBytes = value; return this; } /** - * Required - API name: {@code miss_count} + * Required - The total number of query cache misses across all shards assigned to the selected nodes. + *

+ * API name: {@code miss_count} + *

*/ + @Nonnull public final Builder missCount(long value) { this.missCount = value; return this; } /** - * Required - API name: {@code total_count} + * Required - The total number of hits and misses stored in the query cache across all shards assigned to the selected nodes. + *

+ * API name: {@code total_count} + *

*/ + @Nonnull public final Builder totalCount(long value) { this.totalCount = value; return this; @@ -273,10 +365,10 @@ public final Builder totalCount(long value) { /** * Builds a {@link QueryCacheStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ @Override + @Nonnull public QueryCacheStats build() { _checkSingleUse(); @@ -295,7 +387,6 @@ public QueryCacheStats build() { ); protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::cacheCount, JsonpDeserializer.longDeserializer(), "cache_count"); op.add(Builder::cacheSize, JsonpDeserializer.longDeserializer(), "cache_size"); op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); @@ -304,7 +395,34 @@ protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer { + private final long currentAsSource; private final long currentAsTarget; @Nullable - private final String throttleTime; + private final Time throttleTime; private final long throttleTimeInMillis; // --------------------------------------------------------------------------------------------- private RecoveryStats(Builder builder) { - this.currentAsSource = ApiTypeHelper.requireNonNull(builder.currentAsSource, this, "currentAsSource"); this.currentAsTarget = ApiTypeHelper.requireNonNull(builder.currentAsTarget, this, "currentAsTarget"); this.throttleTime = builder.throttleTime; this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); - } - public static RecoveryStats of(Function> fn) { + public static RecoveryStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -91,7 +100,7 @@ public final long currentAsTarget() { * API name: {@code throttle_time} */ @Nullable - public final String throttleTime() { + public final Time throttleTime() { return this.throttleTime; } @@ -105,6 +114,7 @@ public final long throttleTimeInMillis() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,7 +122,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("current_as_source"); generator.write(this.currentAsSource); @@ -121,33 +130,62 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.throttleTime != null) { generator.writeKey("throttle_time"); - generator.write(this.throttleTime); - + this.throttleTime.serialize(generator, mapper); } + generator.writeKey("throttle_time_in_millis"); generator.write(this.throttleTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long currentAsSource; - private Long currentAsTarget; - @Nullable - private String throttleTime; - + private Time throttleTime; private Long throttleTimeInMillis; + public Builder() {} + + private Builder(RecoveryStats o) { + this.currentAsSource = o.currentAsSource; + this.currentAsTarget = o.currentAsTarget; + this.throttleTime = o.throttleTime; + this.throttleTimeInMillis = o.throttleTimeInMillis; + } + + private Builder(Builder o) { + this.currentAsSource = o.currentAsSource; + this.currentAsTarget = o.currentAsTarget; + this.throttleTime = o.throttleTime; + this.throttleTimeInMillis = o.throttleTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code current_as_source} */ + @Nonnull public final Builder currentAsSource(long value) { this.currentAsSource = value; return this; @@ -156,6 +194,7 @@ public final Builder currentAsSource(long value) { /** * Required - API name: {@code current_as_target} */ + @Nonnull public final Builder currentAsTarget(long value) { this.currentAsTarget = value; return this; @@ -164,14 +203,24 @@ public final Builder currentAsTarget(long value) { /** * API name: {@code throttle_time} */ - public final Builder throttleTime(@Nullable String value) { + @Nonnull + public final Builder throttleTime(@Nullable Time value) { this.throttleTime = value; return this; } + /** + * API name: {@code throttle_time} + */ + @Nonnull + public final Builder throttleTime(Function> fn) { + return throttleTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code throttle_time_in_millis} */ + @Nonnull public final Builder throttleTimeInMillis(long value) { this.throttleTimeInMillis = value; return this; @@ -180,9 +229,10 @@ public final Builder throttleTimeInMillis(long value) { /** * Builds a {@link RecoveryStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RecoveryStats build() { _checkSingleUse(); @@ -201,12 +251,30 @@ public RecoveryStats build() { ); protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTime, Time._DESERIALIZER, "throttle_time"); op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.currentAsSource); + result = 31 * result + Long.hashCode(this.currentAsTarget); + result = 31 * result + Objects.hashCode(this.throttleTime); + result = 31 * result + Long.hashCode(this.throttleTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryStats other = (RecoveryStats) o; + return this.currentAsSource == other.currentAsSource + && this.currentAsTarget == other.currentAsTarget + && Objects.equals(this.throttleTime, other.throttleTime) + && this.throttleTimeInMillis == other.throttleTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RefreshStats.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/RefreshStats.java index 8fc7ab801b..a66e4bdf04 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RefreshStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,15 +49,22 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.RefreshStats @JsonpDeserializable -public class RefreshStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RefreshStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long externalTotal; + @Nullable + private final Time externalTotalTime; + private final long externalTotalTimeInMillis; private final long listeners; @@ -58,24 +72,23 @@ public class RefreshStats implements PlainJsonSerializable { private final long total; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; // --------------------------------------------------------------------------------------------- private RefreshStats(Builder builder) { - this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal"); + this.externalTotalTime = builder.externalTotalTime; this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, "externalTotalTimeInMillis"); this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - } - public static RefreshStats of(Function> fn) { + public static RefreshStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -86,6 +99,14 @@ public final long externalTotal() { return this.externalTotal; } + /** + * API name: {@code external_total_time} + */ + @Nullable + public final Time externalTotalTime() { + return this.externalTotalTime; + } + /** * Required - API name: {@code external_total_time_in_millis} */ @@ -111,7 +132,7 @@ public final long total() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -125,6 +146,7 @@ public final long totalTimeInMillis() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -132,10 +154,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("external_total"); generator.write(this.externalTotal); + if (this.externalTotalTime != null) { + generator.writeKey("external_total_time"); + this.externalTotalTime.serialize(generator, mapper); + } + generator.writeKey("external_total_time_in_millis"); generator.write(this.externalTotalTimeInMillis); @@ -147,45 +173,98 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RefreshStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long externalTotal; - + @Nullable + private Time externalTotalTime; private Long externalTotalTimeInMillis; - private Long listeners; - private Long total; - @Nullable - private String totalTime; - + private Time totalTime; private Long totalTimeInMillis; + public Builder() {} + + private Builder(RefreshStats o) { + this.externalTotal = o.externalTotal; + this.externalTotalTime = o.externalTotalTime; + this.externalTotalTimeInMillis = o.externalTotalTimeInMillis; + this.listeners = o.listeners; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.externalTotal = o.externalTotal; + this.externalTotalTime = o.externalTotalTime; + this.externalTotalTimeInMillis = o.externalTotalTimeInMillis; + this.listeners = o.listeners; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code external_total} */ + @Nonnull public final Builder externalTotal(long value) { this.externalTotal = value; return this; } + /** + * API name: {@code external_total_time} + */ + @Nonnull + public final Builder externalTotalTime(@Nullable Time value) { + this.externalTotalTime = value; + return this; + } + + /** + * API name: {@code external_total_time} + */ + @Nonnull + public final Builder externalTotalTime(Function> fn) { + return externalTotalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code external_total_time_in_millis} */ + @Nonnull public final Builder externalTotalTimeInMillis(long value) { this.externalTotalTimeInMillis = value; return this; @@ -194,6 +273,7 @@ public final Builder externalTotalTimeInMillis(long value) { /** * Required - API name: {@code listeners} */ + @Nonnull public final Builder listeners(long value) { this.listeners = value; return this; @@ -202,6 +282,7 @@ public final Builder listeners(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -210,14 +291,24 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ + @Nonnull public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; @@ -226,9 +317,10 @@ public final Builder totalTimeInMillis(long value) { /** * Builds a {@link RefreshStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RefreshStats build() { _checkSingleUse(); @@ -247,14 +339,39 @@ public RefreshStats build() { ); protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); + op.add(Builder::externalTotalTime, Time._DESERIALIZER, "external_total_time"); op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), "external_total_time_in_millis"); op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.externalTotal); + result = 31 * result + Objects.hashCode(this.externalTotalTime); + result = 31 * result + Long.hashCode(this.externalTotalTimeInMillis); + result = 31 * result + Long.hashCode(this.listeners); + result = 31 * result + Long.hashCode(this.total); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RefreshStats other = (RefreshStats) o; + return this.externalTotal == other.externalTotal + && Objects.equals(this.externalTotalTime, other.externalTotalTime) + && this.externalTotalTimeInMillis == other.externalTotalTimeInMillis + && this.listeners == other.listeners + && this.total == other.total + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreDownloadStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreDownloadStats.java new file mode 100644 index 0000000000..91697450b9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreDownloadStats.java @@ -0,0 +1,294 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreDownloadStats + +/** + * Statistics related to downloads to the remote segment store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreDownloadStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final RemoteStoreUploadDownloadStats totalDownloadSize; + + @Nullable + private final Time totalTimeSpent; + + private final long totalTimeSpentInMillis; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreDownloadStats(Builder builder) { + this.totalDownloadSize = ApiTypeHelper.requireNonNull(builder.totalDownloadSize, this, "totalDownloadSize"); + this.totalTimeSpent = builder.totalTimeSpent; + this.totalTimeSpentInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeSpentInMillis, this, "totalTimeSpentInMillis"); + } + + public static RemoteStoreDownloadStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The total amount of data downloaded from the remote segment store. + *

+ * API name: {@code total_download_size} + *

+ */ + @Nonnull + public final RemoteStoreUploadDownloadStats totalDownloadSize() { + return this.totalDownloadSize; + } + + /** + * The total amount of time spent on downloads from the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nullable + public final Time totalTimeSpent() { + return this.totalTimeSpent; + } + + /** + * Required - The total duration, in milliseconds, spent on downloads from the remote segment store. + *

+ * API name: {@code total_time_spent_in_millis} + *

+ */ + public final long totalTimeSpentInMillis() { + return this.totalTimeSpentInMillis; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("total_download_size"); + this.totalDownloadSize.serialize(generator, mapper); + + if (this.totalTimeSpent != null) { + generator.writeKey("total_time_spent"); + this.totalTimeSpent.serialize(generator, mapper); + } + + generator.writeKey("total_time_spent_in_millis"); + generator.write(this.totalTimeSpentInMillis); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreDownloadStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private RemoteStoreUploadDownloadStats totalDownloadSize; + @Nullable + private Time totalTimeSpent; + private Long totalTimeSpentInMillis; + + public Builder() {} + + private Builder(RemoteStoreDownloadStats o) { + this.totalDownloadSize = o.totalDownloadSize; + this.totalTimeSpent = o.totalTimeSpent; + this.totalTimeSpentInMillis = o.totalTimeSpentInMillis; + } + + private Builder(Builder o) { + this.totalDownloadSize = o.totalDownloadSize; + this.totalTimeSpent = o.totalTimeSpent; + this.totalTimeSpentInMillis = o.totalTimeSpentInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The total amount of data downloaded from the remote segment store. + *

+ * API name: {@code total_download_size} + *

+ */ + @Nonnull + public final Builder totalDownloadSize(RemoteStoreUploadDownloadStats value) { + this.totalDownloadSize = value; + return this; + } + + /** + * Required - The total amount of data downloaded from the remote segment store. + *

+ * API name: {@code total_download_size} + *

+ */ + @Nonnull + public final Builder totalDownloadSize( + Function> fn + ) { + return totalDownloadSize(fn.apply(new RemoteStoreUploadDownloadStats.Builder()).build()); + } + + /** + * The total amount of time spent on downloads from the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nonnull + public final Builder totalTimeSpent(@Nullable Time value) { + this.totalTimeSpent = value; + return this; + } + + /** + * The total amount of time spent on downloads from the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nonnull + public final Builder totalTimeSpent(Function> fn) { + return totalTimeSpent(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total duration, in milliseconds, spent on downloads from the remote segment store. + *

+ * API name: {@code total_time_spent_in_millis} + *

+ */ + @Nonnull + public final Builder totalTimeSpentInMillis(long value) { + this.totalTimeSpentInMillis = value; + return this; + } + + /** + * Builds a {@link RemoteStoreDownloadStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreDownloadStats build() { + _checkSingleUse(); + + return new RemoteStoreDownloadStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreDownloadStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreDownloadStats::setupRemoteStoreDownloadStatsDeserializer + ); + + protected static void setupRemoteStoreDownloadStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::totalDownloadSize, RemoteStoreUploadDownloadStats._DESERIALIZER, "total_download_size"); + op.add(Builder::totalTimeSpent, Time._DESERIALIZER, "total_time_spent"); + op.add(Builder::totalTimeSpentInMillis, JsonpDeserializer.longDeserializer(), "total_time_spent_in_millis"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.totalDownloadSize.hashCode(); + result = 31 * result + Objects.hashCode(this.totalTimeSpent); + result = 31 * result + Long.hashCode(this.totalTimeSpentInMillis); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreDownloadStats other = (RemoteStoreDownloadStats) o; + return this.totalDownloadSize.equals(other.totalDownloadSize) + && Objects.equals(this.totalTimeSpent, other.totalTimeSpent) + && this.totalTimeSpentInMillis == other.totalTimeSpentInMillis; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreStats.java new file mode 100644 index 0000000000..56ce70e1ab --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreStats.java @@ -0,0 +1,231 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreStats + +/** + * Statistics related to remote segment store operations. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final RemoteStoreDownloadStats download; + + @Nonnull + private final RemoteStoreUploadStats upload; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreStats(Builder builder) { + this.download = ApiTypeHelper.requireNonNull(builder.download, this, "download"); + this.upload = ApiTypeHelper.requireNonNull(builder.upload, this, "upload"); + } + + public static RemoteStoreStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code download} + */ + @Nonnull + public final RemoteStoreDownloadStats download() { + return this.download; + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final RemoteStoreUploadStats upload() { + return this.upload; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("download"); + this.download.serialize(generator, mapper); + + generator.writeKey("upload"); + this.upload.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private RemoteStoreDownloadStats download; + private RemoteStoreUploadStats upload; + + public Builder() {} + + private Builder(RemoteStoreStats o) { + this.download = o.download; + this.upload = o.upload; + } + + private Builder(Builder o) { + this.download = o.download; + this.upload = o.upload; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code download} + */ + @Nonnull + public final Builder download(RemoteStoreDownloadStats value) { + this.download = value; + return this; + } + + /** + * Required - API name: {@code download} + */ + @Nonnull + public final Builder download(Function> fn) { + return download(fn.apply(new RemoteStoreDownloadStats.Builder()).build()); + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final Builder upload(RemoteStoreUploadStats value) { + this.upload = value; + return this; + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final Builder upload(Function> fn) { + return upload(fn.apply(new RemoteStoreUploadStats.Builder()).build()); + } + + /** + * Builds a {@link RemoteStoreStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreStats build() { + _checkSingleUse(); + + return new RemoteStoreStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreStats::setupRemoteStoreStatsDeserializer + ); + + protected static void setupRemoteStoreStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::download, RemoteStoreDownloadStats._DESERIALIZER, "download"); + op.add(Builder::upload, RemoteStoreUploadStats._DESERIALIZER, "upload"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.download.hashCode(); + result = 31 * result + this.upload.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreStats other = (RemoteStoreStats) o; + return this.download.equals(other.download) && this.upload.equals(other.upload); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogStats.java new file mode 100644 index 0000000000..2d651a68ea --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogStats.java @@ -0,0 +1,194 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreTranslogStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreTranslogStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final RemoteStoreTranslogUploadStats upload; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreTranslogStats(Builder builder) { + this.upload = ApiTypeHelper.requireNonNull(builder.upload, this, "upload"); + } + + public static RemoteStoreTranslogStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final RemoteStoreTranslogUploadStats upload() { + return this.upload; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("upload"); + this.upload.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreTranslogStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private RemoteStoreTranslogUploadStats upload; + + public Builder() {} + + private Builder(RemoteStoreTranslogStats o) { + this.upload = o.upload; + } + + private Builder(Builder o) { + this.upload = o.upload; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final Builder upload(RemoteStoreTranslogUploadStats value) { + this.upload = value; + return this; + } + + /** + * Required - API name: {@code upload} + */ + @Nonnull + public final Builder upload(Function> fn) { + return upload(fn.apply(new RemoteStoreTranslogUploadStats.Builder()).build()); + } + + /** + * Builds a {@link RemoteStoreTranslogStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreTranslogStats build() { + _checkSingleUse(); + + return new RemoteStoreTranslogStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreTranslogStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreTranslogStats::setupRemoteStoreTranslogStatsDeserializer + ); + + protected static void setupRemoteStoreTranslogStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::upload, RemoteStoreTranslogUploadStats._DESERIALIZER, "upload"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.upload.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreTranslogStats other = (RemoteStoreTranslogStats) o; + return this.upload.equals(other.upload); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadStats.java new file mode 100644 index 0000000000..e4211cd612 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadStats.java @@ -0,0 +1,240 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreTranslogUploadStats + +/** + * Statistics related to uploads to the remote translog store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreTranslogUploadStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final RemoteStoreTranslogUploadTotalUploadSizeStats totalUploadSize; + + @Nonnull + private final RemoteStoreTranslogUploadTotalUploadsStats totalUploads; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreTranslogUploadStats(Builder builder) { + this.totalUploadSize = ApiTypeHelper.requireNonNull(builder.totalUploadSize, this, "totalUploadSize"); + this.totalUploads = ApiTypeHelper.requireNonNull(builder.totalUploads, this, "totalUploads"); + } + + public static RemoteStoreTranslogUploadStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final RemoteStoreTranslogUploadTotalUploadSizeStats totalUploadSize() { + return this.totalUploadSize; + } + + /** + * Required - API name: {@code total_uploads} + */ + @Nonnull + public final RemoteStoreTranslogUploadTotalUploadsStats totalUploads() { + return this.totalUploads; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("total_upload_size"); + this.totalUploadSize.serialize(generator, mapper); + + generator.writeKey("total_uploads"); + this.totalUploads.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreTranslogUploadStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private RemoteStoreTranslogUploadTotalUploadSizeStats totalUploadSize; + private RemoteStoreTranslogUploadTotalUploadsStats totalUploads; + + public Builder() {} + + private Builder(RemoteStoreTranslogUploadStats o) { + this.totalUploadSize = o.totalUploadSize; + this.totalUploads = o.totalUploads; + } + + private Builder(Builder o) { + this.totalUploadSize = o.totalUploadSize; + this.totalUploads = o.totalUploads; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final Builder totalUploadSize(RemoteStoreTranslogUploadTotalUploadSizeStats value) { + this.totalUploadSize = value; + return this; + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final Builder totalUploadSize( + Function> fn + ) { + return totalUploadSize(fn.apply(new RemoteStoreTranslogUploadTotalUploadSizeStats.Builder()).build()); + } + + /** + * Required - API name: {@code total_uploads} + */ + @Nonnull + public final Builder totalUploads(RemoteStoreTranslogUploadTotalUploadsStats value) { + this.totalUploads = value; + return this; + } + + /** + * Required - API name: {@code total_uploads} + */ + @Nonnull + public final Builder totalUploads( + Function> fn + ) { + return totalUploads(fn.apply(new RemoteStoreTranslogUploadTotalUploadsStats.Builder()).build()); + } + + /** + * Builds a {@link RemoteStoreTranslogUploadStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreTranslogUploadStats build() { + _checkSingleUse(); + + return new RemoteStoreTranslogUploadStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreTranslogUploadStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreTranslogUploadStats::setupRemoteStoreTranslogUploadStatsDeserializer + ); + + protected static void setupRemoteStoreTranslogUploadStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::totalUploadSize, RemoteStoreTranslogUploadTotalUploadSizeStats._DESERIALIZER, "total_upload_size"); + op.add(Builder::totalUploads, RemoteStoreTranslogUploadTotalUploadsStats._DESERIALIZER, "total_uploads"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.totalUploadSize.hashCode(); + result = 31 * result + this.totalUploads.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreTranslogUploadStats other = (RemoteStoreTranslogUploadStats) o; + return this.totalUploadSize.equals(other.totalUploadSize) && this.totalUploads.equals(other.totalUploads); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadSizeStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadSizeStats.java new file mode 100644 index 0000000000..98655f04c2 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadSizeStats.java @@ -0,0 +1,386 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreTranslogUploadTotalUploadSizeStats + +/** + * The total amount of data uploaded to the remote translog store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreTranslogUploadTotalUploadSizeStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String failed; + + private final long failedBytes; + + @Nullable + private final String started; + + private final long startedBytes; + + @Nullable + private final String succeeded; + + private final long succeededBytes; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreTranslogUploadTotalUploadSizeStats(Builder builder) { + this.failed = builder.failed; + this.failedBytes = ApiTypeHelper.requireNonNull(builder.failedBytes, this, "failedBytes"); + this.started = builder.started; + this.startedBytes = ApiTypeHelper.requireNonNull(builder.startedBytes, this, "startedBytes"); + this.succeeded = builder.succeeded; + this.succeededBytes = ApiTypeHelper.requireNonNull(builder.succeededBytes, this, "succeededBytes"); + } + + public static RemoteStoreTranslogUploadTotalUploadSizeStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * The number of bytes that failed to upload to the remote translog store. + *

+ * API name: {@code failed} + *

+ */ + @Nullable + public final String failed() { + return this.failed; + } + + /** + * Required - The number of bytes that failed to upload to the remote translog store. + *

+ * API name: {@code failed_bytes} + *

+ */ + public final long failedBytes() { + return this.failedBytes; + } + + /** + * The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code started} + *

+ */ + @Nullable + public final String started() { + return this.started; + } + + /** + * Required - The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code started_bytes} + *

+ */ + public final long startedBytes() { + return this.startedBytes; + } + + /** + * The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code succeeded} + *

+ */ + @Nullable + public final String succeeded() { + return this.succeeded; + } + + /** + * Required - The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code succeeded_bytes} + *

+ */ + public final long succeededBytes() { + return this.succeededBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.failed != null) { + generator.writeKey("failed"); + generator.write(this.failed); + } + + generator.writeKey("failed_bytes"); + generator.write(this.failedBytes); + + if (this.started != null) { + generator.writeKey("started"); + generator.write(this.started); + } + + generator.writeKey("started_bytes"); + generator.write(this.startedBytes); + + if (this.succeeded != null) { + generator.writeKey("succeeded"); + generator.write(this.succeeded); + } + + generator.writeKey("succeeded_bytes"); + generator.write(this.succeededBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreTranslogUploadTotalUploadSizeStats}. + */ + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder { + @Nullable + private String failed; + private Long failedBytes; + @Nullable + private String started; + private Long startedBytes; + @Nullable + private String succeeded; + private Long succeededBytes; + + public Builder() {} + + private Builder(RemoteStoreTranslogUploadTotalUploadSizeStats o) { + this.failed = o.failed; + this.failedBytes = o.failedBytes; + this.started = o.started; + this.startedBytes = o.startedBytes; + this.succeeded = o.succeeded; + this.succeededBytes = o.succeededBytes; + } + + private Builder(Builder o) { + this.failed = o.failed; + this.failedBytes = o.failedBytes; + this.started = o.started; + this.startedBytes = o.startedBytes; + this.succeeded = o.succeeded; + this.succeededBytes = o.succeededBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The number of bytes that failed to upload to the remote translog store. + *

+ * API name: {@code failed} + *

+ */ + @Nonnull + public final Builder failed(@Nullable String value) { + this.failed = value; + return this; + } + + /** + * Required - The number of bytes that failed to upload to the remote translog store. + *

+ * API name: {@code failed_bytes} + *

+ */ + @Nonnull + public final Builder failedBytes(long value) { + this.failedBytes = value; + return this; + } + + /** + * The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code started} + *

+ */ + @Nonnull + public final Builder started(@Nullable String value) { + this.started = value; + return this; + } + + /** + * Required - The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code started_bytes} + *

+ */ + @Nonnull + public final Builder startedBytes(long value) { + this.startedBytes = value; + return this; + } + + /** + * The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code succeeded} + *

+ */ + @Nonnull + public final Builder succeeded(@Nullable String value) { + this.succeeded = value; + return this; + } + + /** + * Required - The number of bytes successfully uploaded to the remote translog store. + *

+ * API name: {@code succeeded_bytes} + *

+ */ + @Nonnull + public final Builder succeededBytes(long value) { + this.succeededBytes = value; + return this; + } + + /** + * Builds a {@link RemoteStoreTranslogUploadTotalUploadSizeStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreTranslogUploadTotalUploadSizeStats build() { + _checkSingleUse(); + + return new RemoteStoreTranslogUploadTotalUploadSizeStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreTranslogUploadTotalUploadSizeStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreTranslogUploadTotalUploadSizeStats::setupRemoteStoreTranslogUploadTotalUploadSizeStatsDeserializer + ); + + protected static void setupRemoteStoreTranslogUploadTotalUploadSizeStatsDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::failed, JsonpDeserializer.stringDeserializer(), "failed"); + op.add(Builder::failedBytes, JsonpDeserializer.longDeserializer(), "failed_bytes"); + op.add(Builder::started, JsonpDeserializer.stringDeserializer(), "started"); + op.add(Builder::startedBytes, JsonpDeserializer.longDeserializer(), "started_bytes"); + op.add(Builder::succeeded, JsonpDeserializer.stringDeserializer(), "succeeded"); + op.add(Builder::succeededBytes, JsonpDeserializer.longDeserializer(), "succeeded_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.failed); + result = 31 * result + Long.hashCode(this.failedBytes); + result = 31 * result + Objects.hashCode(this.started); + result = 31 * result + Long.hashCode(this.startedBytes); + result = 31 * result + Objects.hashCode(this.succeeded); + result = 31 * result + Long.hashCode(this.succeededBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreTranslogUploadTotalUploadSizeStats other = (RemoteStoreTranslogUploadTotalUploadSizeStats) o; + return Objects.equals(this.failed, other.failed) + && this.failedBytes == other.failedBytes + && Objects.equals(this.started, other.started) + && this.startedBytes == other.startedBytes + && Objects.equals(this.succeeded, other.succeeded) + && this.succeededBytes == other.succeededBytes; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadsStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadsStats.java new file mode 100644 index 0000000000..5fd40eea39 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreTranslogUploadTotalUploadsStats.java @@ -0,0 +1,263 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreTranslogUploadTotalUploadsStats + +/** + * The number of syncs to the remote translog store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreTranslogUploadTotalUploadsStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + private final long failed; + + private final long started; + + private final long succeeded; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreTranslogUploadTotalUploadsStats(Builder builder) { + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.started = ApiTypeHelper.requireNonNull(builder.started, this, "started"); + this.succeeded = ApiTypeHelper.requireNonNull(builder.succeeded, this, "succeeded"); + } + + public static RemoteStoreTranslogUploadTotalUploadsStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of failed upload syncs to the remote translog store. + *

+ * API name: {@code failed} + *

+ */ + public final long failed() { + return this.failed; + } + + /** + * Required - The number of upload syncs to the remote translog store that have started. + *

+ * API name: {@code started} + *

+ */ + public final long started() { + return this.started; + } + + /** + * Required - The number of successful upload syncs to the remote translog store. + *

+ * API name: {@code succeeded} + *

+ */ + public final long succeeded() { + return this.succeeded; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("failed"); + generator.write(this.failed); + + generator.writeKey("started"); + generator.write(this.started); + + generator.writeKey("succeeded"); + generator.write(this.succeeded); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreTranslogUploadTotalUploadsStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Long failed; + private Long started; + private Long succeeded; + + public Builder() {} + + private Builder(RemoteStoreTranslogUploadTotalUploadsStats o) { + this.failed = o.failed; + this.started = o.started; + this.succeeded = o.succeeded; + } + + private Builder(Builder o) { + this.failed = o.failed; + this.started = o.started; + this.succeeded = o.succeeded; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The number of failed upload syncs to the remote translog store. + *

+ * API name: {@code failed} + *

+ */ + @Nonnull + public final Builder failed(long value) { + this.failed = value; + return this; + } + + /** + * Required - The number of upload syncs to the remote translog store that have started. + *

+ * API name: {@code started} + *

+ */ + @Nonnull + public final Builder started(long value) { + this.started = value; + return this; + } + + /** + * Required - The number of successful upload syncs to the remote translog store. + *

+ * API name: {@code succeeded} + *

+ */ + @Nonnull + public final Builder succeeded(long value) { + this.succeeded = value; + return this; + } + + /** + * Builds a {@link RemoteStoreTranslogUploadTotalUploadsStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreTranslogUploadTotalUploadsStats build() { + _checkSingleUse(); + + return new RemoteStoreTranslogUploadTotalUploadsStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreTranslogUploadTotalUploadsStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreTranslogUploadTotalUploadsStats::setupRemoteStoreTranslogUploadTotalUploadsStatsDeserializer + ); + + protected static void setupRemoteStoreTranslogUploadTotalUploadsStatsDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::failed, JsonpDeserializer.longDeserializer(), "failed"); + op.add(Builder::started, JsonpDeserializer.longDeserializer(), "started"); + op.add(Builder::succeeded, JsonpDeserializer.longDeserializer(), "succeeded"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.failed); + result = 31 * result + Long.hashCode(this.started); + result = 31 * result + Long.hashCode(this.succeeded); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreTranslogUploadTotalUploadsStats other = (RemoteStoreTranslogUploadTotalUploadsStats) o; + return this.failed == other.failed && this.started == other.started && this.succeeded == other.succeeded; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadDownloadStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadDownloadStats.java new file mode 100644 index 0000000000..826915aa6e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadDownloadStats.java @@ -0,0 +1,382 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreUploadDownloadStats + +/** + * The amount of data, in bytes, uploaded or downloaded to/from the remote segment store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreUploadDownloadStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String failed; + + private final long failedBytes; + + @Nullable + private final String started; + + private final long startedBytes; + + @Nullable + private final String succeeded; + + private final long succeededBytes; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreUploadDownloadStats(Builder builder) { + this.failed = builder.failed; + this.failedBytes = ApiTypeHelper.requireNonNull(builder.failedBytes, this, "failedBytes"); + this.started = builder.started; + this.startedBytes = ApiTypeHelper.requireNonNull(builder.startedBytes, this, "startedBytes"); + this.succeeded = builder.succeeded; + this.succeededBytes = ApiTypeHelper.requireNonNull(builder.succeededBytes, this, "succeededBytes"); + } + + public static RemoteStoreUploadDownloadStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * The number of bytes that failed to upload to/from the remote segment store. + *

+ * API name: {@code failed} + *

+ */ + @Nullable + public final String failed() { + return this.failed; + } + + /** + * Required - The number of bytes that failed to upload to/from the remote segment store. + *

+ * API name: {@code failed_bytes} + *

+ */ + public final long failedBytes() { + return this.failedBytes; + } + + /** + * The number of bytes to upload/download to/from the remote segment store after the upload/download has started. + *

+ * API name: {@code started} + *

+ */ + @Nullable + public final String started() { + return this.started; + } + + /** + * Required - The number of bytes to upload/download to/from the remote segment store after the upload/download has started. + *

+ * API name: {@code started_bytes} + *

+ */ + public final long startedBytes() { + return this.startedBytes; + } + + /** + * The number of bytes successfully uploaded/downloaded to/from the remote segment store. + *

+ * API name: {@code succeeded} + *

+ */ + @Nullable + public final String succeeded() { + return this.succeeded; + } + + /** + * Required - The number of bytes successfully uploaded/downloaded to/from the remote segment store. + *

+ * API name: {@code succeeded_bytes} + *

+ */ + public final long succeededBytes() { + return this.succeededBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.failed != null) { + generator.writeKey("failed"); + generator.write(this.failed); + } + + generator.writeKey("failed_bytes"); + generator.write(this.failedBytes); + + if (this.started != null) { + generator.writeKey("started"); + generator.write(this.started); + } + + generator.writeKey("started_bytes"); + generator.write(this.startedBytes); + + if (this.succeeded != null) { + generator.writeKey("succeeded"); + generator.write(this.succeeded); + } + + generator.writeKey("succeeded_bytes"); + generator.write(this.succeededBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreUploadDownloadStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String failed; + private Long failedBytes; + @Nullable + private String started; + private Long startedBytes; + @Nullable + private String succeeded; + private Long succeededBytes; + + public Builder() {} + + private Builder(RemoteStoreUploadDownloadStats o) { + this.failed = o.failed; + this.failedBytes = o.failedBytes; + this.started = o.started; + this.startedBytes = o.startedBytes; + this.succeeded = o.succeeded; + this.succeededBytes = o.succeededBytes; + } + + private Builder(Builder o) { + this.failed = o.failed; + this.failedBytes = o.failedBytes; + this.started = o.started; + this.startedBytes = o.startedBytes; + this.succeeded = o.succeeded; + this.succeededBytes = o.succeededBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The number of bytes that failed to upload to/from the remote segment store. + *

+ * API name: {@code failed} + *

+ */ + @Nonnull + public final Builder failed(@Nullable String value) { + this.failed = value; + return this; + } + + /** + * Required - The number of bytes that failed to upload to/from the remote segment store. + *

+ * API name: {@code failed_bytes} + *

+ */ + @Nonnull + public final Builder failedBytes(long value) { + this.failedBytes = value; + return this; + } + + /** + * The number of bytes to upload/download to/from the remote segment store after the upload/download has started. + *

+ * API name: {@code started} + *

+ */ + @Nonnull + public final Builder started(@Nullable String value) { + this.started = value; + return this; + } + + /** + * Required - The number of bytes to upload/download to/from the remote segment store after the upload/download has started. + *

+ * API name: {@code started_bytes} + *

+ */ + @Nonnull + public final Builder startedBytes(long value) { + this.startedBytes = value; + return this; + } + + /** + * The number of bytes successfully uploaded/downloaded to/from the remote segment store. + *

+ * API name: {@code succeeded} + *

+ */ + @Nonnull + public final Builder succeeded(@Nullable String value) { + this.succeeded = value; + return this; + } + + /** + * Required - The number of bytes successfully uploaded/downloaded to/from the remote segment store. + *

+ * API name: {@code succeeded_bytes} + *

+ */ + @Nonnull + public final Builder succeededBytes(long value) { + this.succeededBytes = value; + return this; + } + + /** + * Builds a {@link RemoteStoreUploadDownloadStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreUploadDownloadStats build() { + _checkSingleUse(); + + return new RemoteStoreUploadDownloadStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreUploadDownloadStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreUploadDownloadStats::setupRemoteStoreUploadDownloadStatsDeserializer + ); + + protected static void setupRemoteStoreUploadDownloadStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::failed, JsonpDeserializer.stringDeserializer(), "failed"); + op.add(Builder::failedBytes, JsonpDeserializer.longDeserializer(), "failed_bytes"); + op.add(Builder::started, JsonpDeserializer.stringDeserializer(), "started"); + op.add(Builder::startedBytes, JsonpDeserializer.longDeserializer(), "started_bytes"); + op.add(Builder::succeeded, JsonpDeserializer.stringDeserializer(), "succeeded"); + op.add(Builder::succeededBytes, JsonpDeserializer.longDeserializer(), "succeeded_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.failed); + result = 31 * result + Long.hashCode(this.failedBytes); + result = 31 * result + Objects.hashCode(this.started); + result = 31 * result + Long.hashCode(this.startedBytes); + result = 31 * result + Objects.hashCode(this.succeeded); + result = 31 * result + Long.hashCode(this.succeededBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreUploadDownloadStats other = (RemoteStoreUploadDownloadStats) o; + return Objects.equals(this.failed, other.failed) + && this.failedBytes == other.failedBytes + && Objects.equals(this.started, other.started) + && this.startedBytes == other.startedBytes + && Objects.equals(this.succeeded, other.succeeded) + && this.succeededBytes == other.succeededBytes; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadPressureStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadPressureStats.java new file mode 100644 index 0000000000..783f2d3854 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadPressureStats.java @@ -0,0 +1,195 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreUploadPressureStats + +/** + * Statistics related to segment store upload backpressure. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreUploadPressureStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + private final long totalRejections; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreUploadPressureStats(Builder builder) { + this.totalRejections = ApiTypeHelper.requireNonNull(builder.totalRejections, this, "totalRejections"); + } + + public static RemoteStoreUploadPressureStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The total number of requests rejected due to segment store upload backpressure. + *

+ * API name: {@code total_rejections} + *

+ */ + public final long totalRejections() { + return this.totalRejections; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("total_rejections"); + generator.write(this.totalRejections); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreUploadPressureStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Long totalRejections; + + public Builder() {} + + private Builder(RemoteStoreUploadPressureStats o) { + this.totalRejections = o.totalRejections; + } + + private Builder(Builder o) { + this.totalRejections = o.totalRejections; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The total number of requests rejected due to segment store upload backpressure. + *

+ * API name: {@code total_rejections} + *

+ */ + @Nonnull + public final Builder totalRejections(long value) { + this.totalRejections = value; + return this; + } + + /** + * Builds a {@link RemoteStoreUploadPressureStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreUploadPressureStats build() { + _checkSingleUse(); + + return new RemoteStoreUploadPressureStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreUploadPressureStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreUploadPressureStats::setupRemoteStoreUploadPressureStatsDeserializer + ); + + protected static void setupRemoteStoreUploadPressureStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::totalRejections, JsonpDeserializer.longDeserializer(), "total_rejections"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.totalRejections); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreUploadPressureStats other = (RemoteStoreUploadPressureStats) o; + return this.totalRejections == other.totalRejections; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadRefreshSizeLagStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadRefreshSizeLagStats.java new file mode 100644 index 0000000000..3518da7f28 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadRefreshSizeLagStats.java @@ -0,0 +1,311 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreUploadRefreshSizeLagStats + +/** + * The amount of lag during upload between the remote segment store and the local store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreUploadRefreshSizeLagStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String max; + + private final long maxBytes; + + @Nullable + private final String total; + + private final long totalBytes; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreUploadRefreshSizeLagStats(Builder builder) { + this.max = builder.max; + this.maxBytes = ApiTypeHelper.requireNonNull(builder.maxBytes, this, "maxBytes"); + this.total = builder.total; + this.totalBytes = ApiTypeHelper.requireNonNull(builder.totalBytes, this, "totalBytes"); + } + + public static RemoteStoreUploadRefreshSizeLagStats of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code max} + *

+ */ + @Nullable + public final String max() { + return this.max; + } + + /** + * Required - The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code max_bytes} + *

+ */ + public final long maxBytes() { + return this.maxBytes; + } + + /** + * The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code total} + *

+ */ + @Nullable + public final String total() { + return this.total; + } + + /** + * Required - The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code total_bytes} + *

+ */ + public final long totalBytes() { + return this.totalBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.max != null) { + generator.writeKey("max"); + generator.write(this.max); + } + + generator.writeKey("max_bytes"); + generator.write(this.maxBytes); + + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + + generator.writeKey("total_bytes"); + generator.write(this.totalBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreUploadRefreshSizeLagStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String max; + private Long maxBytes; + @Nullable + private String total; + private Long totalBytes; + + public Builder() {} + + private Builder(RemoteStoreUploadRefreshSizeLagStats o) { + this.max = o.max; + this.maxBytes = o.maxBytes; + this.total = o.total; + this.totalBytes = o.totalBytes; + } + + private Builder(Builder o) { + this.max = o.max; + this.maxBytes = o.maxBytes; + this.total = o.total; + this.totalBytes = o.totalBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code max} + *

+ */ + @Nonnull + public final Builder max(@Nullable String value) { + this.max = value; + return this; + } + + /** + * Required - The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code max_bytes} + *

+ */ + @Nonnull + public final Builder maxBytes(long value) { + this.maxBytes = value; + return this; + } + + /** + * The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code total} + *

+ */ + @Nonnull + public final Builder total(@Nullable String value) { + this.total = value; + return this; + } + + /** + * Required - The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. + *

+ * API name: {@code total_bytes} + *

+ */ + @Nonnull + public final Builder totalBytes(long value) { + this.totalBytes = value; + return this; + } + + /** + * Builds a {@link RemoteStoreUploadRefreshSizeLagStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreUploadRefreshSizeLagStats build() { + _checkSingleUse(); + + return new RemoteStoreUploadRefreshSizeLagStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreUploadRefreshSizeLagStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreUploadRefreshSizeLagStats::setupRemoteStoreUploadRefreshSizeLagStatsDeserializer + ); + + protected static void setupRemoteStoreUploadRefreshSizeLagStatsDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::max, JsonpDeserializer.stringDeserializer(), "max"); + op.add(Builder::maxBytes, JsonpDeserializer.longDeserializer(), "max_bytes"); + op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); + op.add(Builder::totalBytes, JsonpDeserializer.longDeserializer(), "total_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.max); + result = 31 * result + Long.hashCode(this.maxBytes); + result = 31 * result + Objects.hashCode(this.total); + result = 31 * result + Long.hashCode(this.totalBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreUploadRefreshSizeLagStats other = (RemoteStoreUploadRefreshSizeLagStats) o; + return Objects.equals(this.max, other.max) + && this.maxBytes == other.maxBytes + && Objects.equals(this.total, other.total) + && this.totalBytes == other.totalBytes; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadStats.java new file mode 100644 index 0000000000..db5efd4309 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RemoteStoreUploadStats.java @@ -0,0 +1,450 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RemoteStoreUploadStats + +/** + * Statistics related to uploads to the remote segment store. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoteStoreUploadStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time maxRefreshTimeLag; + + private final long maxRefreshTimeLagInMillis; + + @Nullable + private final RemoteStoreUploadPressureStats pressure; + + @Nonnull + private final RemoteStoreUploadRefreshSizeLagStats refreshSizeLag; + + @Nullable + private final Time totalTimeSpent; + + private final long totalTimeSpentInMillis; + + @Nonnull + private final RemoteStoreUploadDownloadStats totalUploadSize; + + // --------------------------------------------------------------------------------------------- + + private RemoteStoreUploadStats(Builder builder) { + this.maxRefreshTimeLag = builder.maxRefreshTimeLag; + this.maxRefreshTimeLagInMillis = ApiTypeHelper.requireNonNull(builder.maxRefreshTimeLagInMillis, this, "maxRefreshTimeLagInMillis"); + this.pressure = builder.pressure; + this.refreshSizeLag = ApiTypeHelper.requireNonNull(builder.refreshSizeLag, this, "refreshSizeLag"); + this.totalTimeSpent = builder.totalTimeSpent; + this.totalTimeSpentInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeSpentInMillis, this, "totalTimeSpentInMillis"); + this.totalUploadSize = ApiTypeHelper.requireNonNull(builder.totalUploadSize, this, "totalUploadSize"); + } + + public static RemoteStoreUploadStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The maximum duration that the remote refresh is behind the local refresh. + *

+ * API name: {@code max_refresh_time_lag} + *

+ */ + @Nullable + public final Time maxRefreshTimeLag() { + return this.maxRefreshTimeLag; + } + + /** + * Required - The maximum duration, in milliseconds, that the remote refresh is behind the local refresh. + *

+ * API name: {@code max_refresh_time_lag_in_millis} + *

+ */ + public final long maxRefreshTimeLagInMillis() { + return this.maxRefreshTimeLagInMillis; + } + + /** + * API name: {@code pressure} + */ + @Nullable + public final RemoteStoreUploadPressureStats pressure() { + return this.pressure; + } + + /** + * Required - API name: {@code refresh_size_lag} + */ + @Nonnull + public final RemoteStoreUploadRefreshSizeLagStats refreshSizeLag() { + return this.refreshSizeLag; + } + + /** + * The total amount of time spent on uploads to the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nullable + public final Time totalTimeSpent() { + return this.totalTimeSpent; + } + + /** + * Required - The total amount of time, in milliseconds, spent on uploads to the remote segment store. + *

+ * API name: {@code total_time_spent_in_millis} + *

+ */ + public final long totalTimeSpentInMillis() { + return this.totalTimeSpentInMillis; + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final RemoteStoreUploadDownloadStats totalUploadSize() { + return this.totalUploadSize; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.maxRefreshTimeLag != null) { + generator.writeKey("max_refresh_time_lag"); + this.maxRefreshTimeLag.serialize(generator, mapper); + } + + generator.writeKey("max_refresh_time_lag_in_millis"); + generator.write(this.maxRefreshTimeLagInMillis); + + if (this.pressure != null) { + generator.writeKey("pressure"); + this.pressure.serialize(generator, mapper); + } + + generator.writeKey("refresh_size_lag"); + this.refreshSizeLag.serialize(generator, mapper); + + if (this.totalTimeSpent != null) { + generator.writeKey("total_time_spent"); + this.totalTimeSpent.serialize(generator, mapper); + } + + generator.writeKey("total_time_spent_in_millis"); + generator.write(this.totalTimeSpentInMillis); + + generator.writeKey("total_upload_size"); + this.totalUploadSize.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RemoteStoreUploadStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time maxRefreshTimeLag; + private Long maxRefreshTimeLagInMillis; + @Nullable + private RemoteStoreUploadPressureStats pressure; + private RemoteStoreUploadRefreshSizeLagStats refreshSizeLag; + @Nullable + private Time totalTimeSpent; + private Long totalTimeSpentInMillis; + private RemoteStoreUploadDownloadStats totalUploadSize; + + public Builder() {} + + private Builder(RemoteStoreUploadStats o) { + this.maxRefreshTimeLag = o.maxRefreshTimeLag; + this.maxRefreshTimeLagInMillis = o.maxRefreshTimeLagInMillis; + this.pressure = o.pressure; + this.refreshSizeLag = o.refreshSizeLag; + this.totalTimeSpent = o.totalTimeSpent; + this.totalTimeSpentInMillis = o.totalTimeSpentInMillis; + this.totalUploadSize = o.totalUploadSize; + } + + private Builder(Builder o) { + this.maxRefreshTimeLag = o.maxRefreshTimeLag; + this.maxRefreshTimeLagInMillis = o.maxRefreshTimeLagInMillis; + this.pressure = o.pressure; + this.refreshSizeLag = o.refreshSizeLag; + this.totalTimeSpent = o.totalTimeSpent; + this.totalTimeSpentInMillis = o.totalTimeSpentInMillis; + this.totalUploadSize = o.totalUploadSize; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The maximum duration that the remote refresh is behind the local refresh. + *

+ * API name: {@code max_refresh_time_lag} + *

+ */ + @Nonnull + public final Builder maxRefreshTimeLag(@Nullable Time value) { + this.maxRefreshTimeLag = value; + return this; + } + + /** + * The maximum duration that the remote refresh is behind the local refresh. + *

+ * API name: {@code max_refresh_time_lag} + *

+ */ + @Nonnull + public final Builder maxRefreshTimeLag(Function> fn) { + return maxRefreshTimeLag(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The maximum duration, in milliseconds, that the remote refresh is behind the local refresh. + *

+ * API name: {@code max_refresh_time_lag_in_millis} + *

+ */ + @Nonnull + public final Builder maxRefreshTimeLagInMillis(long value) { + this.maxRefreshTimeLagInMillis = value; + return this; + } + + /** + * API name: {@code pressure} + */ + @Nonnull + public final Builder pressure(@Nullable RemoteStoreUploadPressureStats value) { + this.pressure = value; + return this; + } + + /** + * API name: {@code pressure} + */ + @Nonnull + public final Builder pressure(Function> fn) { + return pressure(fn.apply(new RemoteStoreUploadPressureStats.Builder()).build()); + } + + /** + * Required - API name: {@code refresh_size_lag} + */ + @Nonnull + public final Builder refreshSizeLag(RemoteStoreUploadRefreshSizeLagStats value) { + this.refreshSizeLag = value; + return this; + } + + /** + * Required - API name: {@code refresh_size_lag} + */ + @Nonnull + public final Builder refreshSizeLag( + Function> fn + ) { + return refreshSizeLag(fn.apply(new RemoteStoreUploadRefreshSizeLagStats.Builder()).build()); + } + + /** + * The total amount of time spent on uploads to the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nonnull + public final Builder totalTimeSpent(@Nullable Time value) { + this.totalTimeSpent = value; + return this; + } + + /** + * The total amount of time spent on uploads to the remote segment store. + *

+ * API name: {@code total_time_spent} + *

+ */ + @Nonnull + public final Builder totalTimeSpent(Function> fn) { + return totalTimeSpent(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total amount of time, in milliseconds, spent on uploads to the remote segment store. + *

+ * API name: {@code total_time_spent_in_millis} + *

+ */ + @Nonnull + public final Builder totalTimeSpentInMillis(long value) { + this.totalTimeSpentInMillis = value; + return this; + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final Builder totalUploadSize(RemoteStoreUploadDownloadStats value) { + this.totalUploadSize = value; + return this; + } + + /** + * Required - API name: {@code total_upload_size} + */ + @Nonnull + public final Builder totalUploadSize( + Function> fn + ) { + return totalUploadSize(fn.apply(new RemoteStoreUploadDownloadStats.Builder()).build()); + } + + /** + * Builds a {@link RemoteStoreUploadStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RemoteStoreUploadStats build() { + _checkSingleUse(); + + return new RemoteStoreUploadStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteStoreUploadStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RemoteStoreUploadStats::setupRemoteStoreUploadStatsDeserializer + ); + + protected static void setupRemoteStoreUploadStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::maxRefreshTimeLag, Time._DESERIALIZER, "max_refresh_time_lag"); + op.add(Builder::maxRefreshTimeLagInMillis, JsonpDeserializer.longDeserializer(), "max_refresh_time_lag_in_millis"); + op.add(Builder::pressure, RemoteStoreUploadPressureStats._DESERIALIZER, "pressure"); + op.add(Builder::refreshSizeLag, RemoteStoreUploadRefreshSizeLagStats._DESERIALIZER, "refresh_size_lag"); + op.add(Builder::totalTimeSpent, Time._DESERIALIZER, "total_time_spent"); + op.add(Builder::totalTimeSpentInMillis, JsonpDeserializer.longDeserializer(), "total_time_spent_in_millis"); + op.add(Builder::totalUploadSize, RemoteStoreUploadDownloadStats._DESERIALIZER, "total_upload_size"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxRefreshTimeLag); + result = 31 * result + Long.hashCode(this.maxRefreshTimeLagInMillis); + result = 31 * result + Objects.hashCode(this.pressure); + result = 31 * result + this.refreshSizeLag.hashCode(); + result = 31 * result + Objects.hashCode(this.totalTimeSpent); + result = 31 * result + Long.hashCode(this.totalTimeSpentInMillis); + result = 31 * result + this.totalUploadSize.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RemoteStoreUploadStats other = (RemoteStoreUploadStats) o; + return Objects.equals(this.maxRefreshTimeLag, other.maxRefreshTimeLag) + && this.maxRefreshTimeLagInMillis == other.maxRefreshTimeLagInMillis + && Objects.equals(this.pressure, other.pressure) + && this.refreshSizeLag.equals(other.refreshSizeLag) + && Objects.equals(this.totalTimeSpent, other.totalTimeSpent) + && this.totalTimeSpentInMillis == other.totalTimeSpentInMillis + && this.totalUploadSize.equals(other.totalUploadSize); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java index 6f026a8566..48347e26e8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.RequestCacheStats @JsonpDeserializable -public class RequestCacheStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RequestCacheStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long evictions; private final long hitCount; @@ -63,16 +74,14 @@ public class RequestCacheStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private RequestCacheStats(Builder builder) { - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); this.memorySize = builder.memorySize; this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - } - public static RequestCacheStats of(Function> fn) { + public static RequestCacheStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -115,6 +124,7 @@ public final long missCount() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -122,7 +132,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("evictions"); generator.write(this.evictions); @@ -132,37 +141,67 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.memorySize != null) { generator.writeKey("memory_size"); generator.write(this.memorySize); - } + generator.writeKey("memory_size_in_bytes"); generator.write(this.memorySizeInBytes); generator.writeKey("miss_count"); generator.write(this.missCount); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RequestCacheStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long evictions; - private Long hitCount; - @Nullable private String memorySize; - private Long memorySizeInBytes; - private Long missCount; + public Builder() {} + + private Builder(RequestCacheStats o) { + this.evictions = o.evictions; + this.hitCount = o.hitCount; + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + this.missCount = o.missCount; + } + + private Builder(Builder o) { + this.evictions = o.evictions; + this.hitCount = o.hitCount; + this.memorySize = o.memorySize; + this.memorySizeInBytes = o.memorySizeInBytes; + this.missCount = o.missCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code evictions} */ + @Nonnull public final Builder evictions(long value) { this.evictions = value; return this; @@ -171,6 +210,7 @@ public final Builder evictions(long value) { /** * Required - API name: {@code hit_count} */ + @Nonnull public final Builder hitCount(long value) { this.hitCount = value; return this; @@ -179,6 +219,7 @@ public final Builder hitCount(long value) { /** * API name: {@code memory_size} */ + @Nonnull public final Builder memorySize(@Nullable String value) { this.memorySize = value; return this; @@ -187,6 +228,7 @@ public final Builder memorySize(@Nullable String value) { /** * Required - API name: {@code memory_size_in_bytes} */ + @Nonnull public final Builder memorySizeInBytes(long value) { this.memorySizeInBytes = value; return this; @@ -195,6 +237,7 @@ public final Builder memorySizeInBytes(long value) { /** * Required - API name: {@code miss_count} */ + @Nonnull public final Builder missCount(long value) { this.missCount = value; return this; @@ -203,9 +246,10 @@ public final Builder missCount(long value) { /** * Builds a {@link RequestCacheStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RequestCacheStats build() { _checkSingleUse(); @@ -224,13 +268,33 @@ public RequestCacheStats build() { ); protected static void setupRequestCacheStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.evictions); + result = 31 * result + Long.hashCode(this.hitCount); + result = 31 * result + Objects.hashCode(this.memorySize); + result = 31 * result + Long.hashCode(this.memorySizeInBytes); + result = 31 * result + Long.hashCode(this.missCount); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RequestCacheStats other = (RequestCacheStats) o; + return this.evictions == other.evictions + && this.hitCount == other.hitCount + && Objects.equals(this.memorySize, other.memorySize) + && this.memorySizeInBytes == other.memorySizeInBytes + && this.missCount == other.missCount; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestStats.java new file mode 100644 index 0000000000..a56935b39d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/RequestStats.java @@ -0,0 +1,294 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.RequestStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RequestStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long current; + + @Nullable + private final Time time; + + @Nullable + private final Long timeInMillis; + + @Nullable + private final Long total; + + // --------------------------------------------------------------------------------------------- + + private RequestStats(Builder builder) { + this.current = builder.current; + this.time = builder.time; + this.timeInMillis = builder.timeInMillis; + this.total = builder.total; + } + + public static RequestStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code current} + */ + @Nullable + public final Long current() { + return this.current; + } + + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + + /** + * API name: {@code time_in_millis} + */ + @Nullable + public final Long timeInMillis() { + return this.timeInMillis; + } + + /** + * API name: {@code total} + */ + @Nullable + public final Long total() { + return this.total; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.current != null) { + generator.writeKey("current"); + generator.write(this.current); + } + + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } + + if (this.timeInMillis != null) { + generator.writeKey("time_in_millis"); + generator.write(this.timeInMillis); + } + + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RequestStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long current; + @Nullable + private Time time; + @Nullable + private Long timeInMillis; + @Nullable + private Long total; + + public Builder() {} + + private Builder(RequestStats o) { + this.current = o.current; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + private Builder(Builder o) { + this.current = o.current; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code current} + */ + @Nonnull + public final Builder current(@Nullable Long value) { + this.current = value; + return this; + } + + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(Function> fn) { + return time(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code time_in_millis} + */ + @Nonnull + public final Builder timeInMillis(@Nullable Long value) { + this.timeInMillis = value; + return this; + } + + /** + * API name: {@code total} + */ + @Nonnull + public final Builder total(@Nullable Long value) { + this.total = value; + return this; + } + + /** + * Builds a {@link RequestStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RequestStats build() { + _checkSingleUse(); + + return new RequestStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RequestStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RequestStats::setupRequestStatsDeserializer + ); + + protected static void setupRequestStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::time, Time._DESERIALIZER, "time"); + op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.current); + result = 31 * result + Objects.hashCode(this.time); + result = 31 * result + Objects.hashCode(this.timeInMillis); + result = 31 * result + Objects.hashCode(this.total); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RequestStats other = (RequestStats) o; + return Objects.equals(this.current, other.current) + && Objects.equals(this.time, other.time) + && Objects.equals(this.timeInMillis, other.timeInMillis) + && Objects.equals(this.total, other.total); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SearchStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SearchStats.java new file mode 100644 index 0000000000..9730caf6ca --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SearchStats.java @@ -0,0 +1,1339 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.SearchStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SearchStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long concurrentAvgSliceCount; + + @Nullable + private final Long concurrentQueryCurrent; + + @Nullable + private final Time concurrentQueryTime; + + @Nullable + private final Long concurrentQueryTimeInMillis; + + @Nullable + private final Long concurrentQueryTotal; + + private final long fetchCurrent; + + @Nullable + private final Time fetchTime; + + private final long fetchTimeInMillis; + + private final long fetchTotal; + + @Nonnull + private final Map groups; + + @Nullable + private final Long openContexts; + + @Nullable + private final Long pointInTimeCurrent; + + @Nullable + private final Time pointInTimeTime; + + @Nullable + private final Long pointInTimeTimeInMillis; + + @Nullable + private final Long pointInTimeTotal; + + private final long queryCurrent; + + @Nullable + private final Time queryTime; + + private final long queryTimeInMillis; + + private final long queryTotal; + + @Nonnull + private final Map request; + + private final long scrollCurrent; + + @Nullable + private final Time scrollTime; + + private final long scrollTimeInMillis; + + private final long scrollTotal; + + @Nullable + private final Long searchIdleReactivateCountTotal; + + private final long suggestCurrent; + + @Nullable + private final Time suggestTime; + + private final long suggestTimeInMillis; + + private final long suggestTotal; + + // --------------------------------------------------------------------------------------------- + + private SearchStats(Builder builder) { + this.concurrentAvgSliceCount = builder.concurrentAvgSliceCount; + this.concurrentQueryCurrent = builder.concurrentQueryCurrent; + this.concurrentQueryTime = builder.concurrentQueryTime; + this.concurrentQueryTimeInMillis = builder.concurrentQueryTimeInMillis; + this.concurrentQueryTotal = builder.concurrentQueryTotal; + this.fetchCurrent = ApiTypeHelper.requireNonNull(builder.fetchCurrent, this, "fetchCurrent"); + this.fetchTime = builder.fetchTime; + this.fetchTimeInMillis = ApiTypeHelper.requireNonNull(builder.fetchTimeInMillis, this, "fetchTimeInMillis"); + this.fetchTotal = ApiTypeHelper.requireNonNull(builder.fetchTotal, this, "fetchTotal"); + this.groups = ApiTypeHelper.unmodifiable(builder.groups); + this.openContexts = builder.openContexts; + this.pointInTimeCurrent = builder.pointInTimeCurrent; + this.pointInTimeTime = builder.pointInTimeTime; + this.pointInTimeTimeInMillis = builder.pointInTimeTimeInMillis; + this.pointInTimeTotal = builder.pointInTimeTotal; + this.queryCurrent = ApiTypeHelper.requireNonNull(builder.queryCurrent, this, "queryCurrent"); + this.queryTime = builder.queryTime; + this.queryTimeInMillis = ApiTypeHelper.requireNonNull(builder.queryTimeInMillis, this, "queryTimeInMillis"); + this.queryTotal = ApiTypeHelper.requireNonNull(builder.queryTotal, this, "queryTotal"); + this.request = ApiTypeHelper.unmodifiable(builder.request); + this.scrollCurrent = ApiTypeHelper.requireNonNull(builder.scrollCurrent, this, "scrollCurrent"); + this.scrollTime = builder.scrollTime; + this.scrollTimeInMillis = ApiTypeHelper.requireNonNull(builder.scrollTimeInMillis, this, "scrollTimeInMillis"); + this.scrollTotal = ApiTypeHelper.requireNonNull(builder.scrollTotal, this, "scrollTotal"); + this.searchIdleReactivateCountTotal = builder.searchIdleReactivateCountTotal; + this.suggestCurrent = ApiTypeHelper.requireNonNull(builder.suggestCurrent, this, "suggestCurrent"); + this.suggestTime = builder.suggestTime; + this.suggestTimeInMillis = ApiTypeHelper.requireNonNull(builder.suggestTimeInMillis, this, "suggestTimeInMillis"); + this.suggestTotal = ApiTypeHelper.requireNonNull(builder.suggestTotal, this, "suggestTotal"); + } + + public static SearchStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The average slice count of all search requests. This is computed as the total slice count divided by the total number of concurrent + * search requests. + *

+ * API name: {@code concurrent_avg_slice_count} + *

+ */ + @Nullable + public final Long concurrentAvgSliceCount() { + return this.concurrentAvgSliceCount; + } + + /** + * The number of currently running query operations using concurrent segment search. + *

+ * API name: {@code concurrent_query_current} + *

+ */ + @Nullable + public final Long concurrentQueryCurrent() { + return this.concurrentQueryCurrent; + } + + /** + * API name: {@code concurrent_query_time} + */ + @Nullable + public final Time concurrentQueryTime() { + return this.concurrentQueryTime; + } + + /** + * The total amount of time taken by all query operations using concurrent segment search, in milliseconds. + *

+ * API name: {@code concurrent_query_time_in_millis} + *

+ */ + @Nullable + public final Long concurrentQueryTimeInMillis() { + return this.concurrentQueryTimeInMillis; + } + + /** + * The total number of query operations using concurrent segment search. + *

+ * API name: {@code concurrent_query_total} + *

+ */ + @Nullable + public final Long concurrentQueryTotal() { + return this.concurrentQueryTotal; + } + + /** + * Required - The number of currently running shard fetch operations. + *

+ * API name: {@code fetch_current} + *

+ */ + public final long fetchCurrent() { + return this.fetchCurrent; + } + + /** + * The total amount of time taken to complete all shard fetch operations. + *

+ * API name: {@code fetch_time} + *

+ */ + @Nullable + public final Time fetchTime() { + return this.fetchTime; + } + + /** + * Required - The total amount of time taken to complete all shard fetch operations, in milliseconds. + *

+ * API name: {@code fetch_time_in_millis} + *

+ */ + public final long fetchTimeInMillis() { + return this.fetchTimeInMillis; + } + + /** + * Required - The total number of shard fetch operations. + *

+ * API name: {@code fetch_total} + *

+ */ + public final long fetchTotal() { + return this.fetchTotal; + } + + /** + * API name: {@code groups} + */ + @Nonnull + public final Map groups() { + return this.groups; + } + + /** + * The number of open search contexts. + *

+ * API name: {@code open_contexts} + *

+ */ + @Nullable + public final Long openContexts() { + return this.openContexts; + } + + /** + * The number of currently open shard PIT contexts. + *

+ * API name: {@code point_in_time_current} + *

+ */ + @Nullable + public final Long pointInTimeCurrent() { + return this.pointInTimeCurrent; + } + + /** + * API name: {@code point_in_time_time} + */ + @Nullable + public final Time pointInTimeTime() { + return this.pointInTimeTime; + } + + /** + * The amount of time that shard PIT contexts have been held open since the node last restarted, in milliseconds. + *

+ * API name: {@code point_in_time_time_in_millis} + *

+ */ + @Nullable + public final Long pointInTimeTimeInMillis() { + return this.pointInTimeTimeInMillis; + } + + /** + * The total number of shard Point in Time (PIT) contexts created (completed and active) since the node last restarted. + *

+ * API name: {@code point_in_time_total} + *

+ */ + @Nullable + public final Long pointInTimeTotal() { + return this.pointInTimeTotal; + } + + /** + * Required - The number of currently running shard query operations. + *

+ * API name: {@code query_current} + *

+ */ + public final long queryCurrent() { + return this.queryCurrent; + } + + /** + * The total amount of time taken to complete all shard query operations. + *

+ * API name: {@code query_time} + *

+ */ + @Nullable + public final Time queryTime() { + return this.queryTime; + } + + /** + * Required - The total amount of time taken to complete all shard query operations, in milliseconds. + *

+ * API name: {@code query_time_in_millis} + *

+ */ + public final long queryTimeInMillis() { + return this.queryTimeInMillis; + } + + /** + * Required - The total number of shard query operations. + *

+ * API name: {@code query_total} + *

+ */ + public final long queryTotal() { + return this.queryTotal; + } + + /** + * Statistics related to coordinator search operations for the node. + *

+ * API name: {@code request} + *

+ */ + @Nonnull + public final Map request() { + return this.request; + } + + /** + * Required - The number of shard scroll operations that are currently running. + *

+ * API name: {@code scroll_current} + *

+ */ + public final long scrollCurrent() { + return this.scrollCurrent; + } + + /** + * The total amount of time taken to complete all shard scroll operations. + *

+ * API name: {@code scroll_time} + *

+ */ + @Nullable + public final Time scrollTime() { + return this.scrollTime; + } + + /** + * Required - The total amount of time taken to complete all shard scroll operations, in milliseconds. + *

+ * API name: {@code scroll_time_in_millis} + *

+ */ + public final long scrollTimeInMillis() { + return this.scrollTimeInMillis; + } + + /** + * Required - The total number of shard scroll operations. + *

+ * API name: {@code scroll_total} + *

+ */ + public final long scrollTotal() { + return this.scrollTotal; + } + + /** + * API name: {@code search_idle_reactivate_count_total} + */ + @Nullable + public final Long searchIdleReactivateCountTotal() { + return this.searchIdleReactivateCountTotal; + } + + /** + * Required - The number of currently running shard suggest operations. + *

+ * API name: {@code suggest_current} + *

+ */ + public final long suggestCurrent() { + return this.suggestCurrent; + } + + /** + * The total amount of time take to complete all shard suggest operations. + *

+ * API name: {@code suggest_time} + *

+ */ + @Nullable + public final Time suggestTime() { + return this.suggestTime; + } + + /** + * Required - The total amount of time taken to complete all shard suggest operations, in milliseconds. + *

+ * API name: {@code suggest_time_in_millis} + *

+ */ + public final long suggestTimeInMillis() { + return this.suggestTimeInMillis; + } + + /** + * Required - The total number of shard suggest operations. + *

+ * API name: {@code suggest_total} + *

+ */ + public final long suggestTotal() { + return this.suggestTotal; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.concurrentAvgSliceCount != null) { + generator.writeKey("concurrent_avg_slice_count"); + generator.write(this.concurrentAvgSliceCount); + } + + if (this.concurrentQueryCurrent != null) { + generator.writeKey("concurrent_query_current"); + generator.write(this.concurrentQueryCurrent); + } + + if (this.concurrentQueryTime != null) { + generator.writeKey("concurrent_query_time"); + this.concurrentQueryTime.serialize(generator, mapper); + } + + if (this.concurrentQueryTimeInMillis != null) { + generator.writeKey("concurrent_query_time_in_millis"); + generator.write(this.concurrentQueryTimeInMillis); + } + + if (this.concurrentQueryTotal != null) { + generator.writeKey("concurrent_query_total"); + generator.write(this.concurrentQueryTotal); + } + + generator.writeKey("fetch_current"); + generator.write(this.fetchCurrent); + + if (this.fetchTime != null) { + generator.writeKey("fetch_time"); + this.fetchTime.serialize(generator, mapper); + } + + generator.writeKey("fetch_time_in_millis"); + generator.write(this.fetchTimeInMillis); + + generator.writeKey("fetch_total"); + generator.write(this.fetchTotal); + + if (ApiTypeHelper.isDefined(this.groups)) { + generator.writeKey("groups"); + generator.writeStartObject(); + for (Map.Entry item0 : this.groups.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.openContexts != null) { + generator.writeKey("open_contexts"); + generator.write(this.openContexts); + } + + if (this.pointInTimeCurrent != null) { + generator.writeKey("point_in_time_current"); + generator.write(this.pointInTimeCurrent); + } + + if (this.pointInTimeTime != null) { + generator.writeKey("point_in_time_time"); + this.pointInTimeTime.serialize(generator, mapper); + } + + if (this.pointInTimeTimeInMillis != null) { + generator.writeKey("point_in_time_time_in_millis"); + generator.write(this.pointInTimeTimeInMillis); + } + + if (this.pointInTimeTotal != null) { + generator.writeKey("point_in_time_total"); + generator.write(this.pointInTimeTotal); + } + + generator.writeKey("query_current"); + generator.write(this.queryCurrent); + + if (this.queryTime != null) { + generator.writeKey("query_time"); + this.queryTime.serialize(generator, mapper); + } + + generator.writeKey("query_time_in_millis"); + generator.write(this.queryTimeInMillis); + + generator.writeKey("query_total"); + generator.write(this.queryTotal); + + if (ApiTypeHelper.isDefined(this.request)) { + generator.writeKey("request"); + generator.writeStartObject(); + for (Map.Entry item0 : this.request.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("scroll_current"); + generator.write(this.scrollCurrent); + + if (this.scrollTime != null) { + generator.writeKey("scroll_time"); + this.scrollTime.serialize(generator, mapper); + } + + generator.writeKey("scroll_time_in_millis"); + generator.write(this.scrollTimeInMillis); + + generator.writeKey("scroll_total"); + generator.write(this.scrollTotal); + + if (this.searchIdleReactivateCountTotal != null) { + generator.writeKey("search_idle_reactivate_count_total"); + generator.write(this.searchIdleReactivateCountTotal); + } + + generator.writeKey("suggest_current"); + generator.write(this.suggestCurrent); + + if (this.suggestTime != null) { + generator.writeKey("suggest_time"); + this.suggestTime.serialize(generator, mapper); + } + + generator.writeKey("suggest_time_in_millis"); + generator.write(this.suggestTimeInMillis); + + generator.writeKey("suggest_total"); + generator.write(this.suggestTotal); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SearchStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long concurrentAvgSliceCount; + @Nullable + private Long concurrentQueryCurrent; + @Nullable + private Time concurrentQueryTime; + @Nullable + private Long concurrentQueryTimeInMillis; + @Nullable + private Long concurrentQueryTotal; + private Long fetchCurrent; + @Nullable + private Time fetchTime; + private Long fetchTimeInMillis; + private Long fetchTotal; + @Nullable + private Map groups; + @Nullable + private Long openContexts; + @Nullable + private Long pointInTimeCurrent; + @Nullable + private Time pointInTimeTime; + @Nullable + private Long pointInTimeTimeInMillis; + @Nullable + private Long pointInTimeTotal; + private Long queryCurrent; + @Nullable + private Time queryTime; + private Long queryTimeInMillis; + private Long queryTotal; + @Nullable + private Map request; + private Long scrollCurrent; + @Nullable + private Time scrollTime; + private Long scrollTimeInMillis; + private Long scrollTotal; + @Nullable + private Long searchIdleReactivateCountTotal; + private Long suggestCurrent; + @Nullable + private Time suggestTime; + private Long suggestTimeInMillis; + private Long suggestTotal; + + public Builder() {} + + private Builder(SearchStats o) { + this.concurrentAvgSliceCount = o.concurrentAvgSliceCount; + this.concurrentQueryCurrent = o.concurrentQueryCurrent; + this.concurrentQueryTime = o.concurrentQueryTime; + this.concurrentQueryTimeInMillis = o.concurrentQueryTimeInMillis; + this.concurrentQueryTotal = o.concurrentQueryTotal; + this.fetchCurrent = o.fetchCurrent; + this.fetchTime = o.fetchTime; + this.fetchTimeInMillis = o.fetchTimeInMillis; + this.fetchTotal = o.fetchTotal; + this.groups = _mapCopy(o.groups); + this.openContexts = o.openContexts; + this.pointInTimeCurrent = o.pointInTimeCurrent; + this.pointInTimeTime = o.pointInTimeTime; + this.pointInTimeTimeInMillis = o.pointInTimeTimeInMillis; + this.pointInTimeTotal = o.pointInTimeTotal; + this.queryCurrent = o.queryCurrent; + this.queryTime = o.queryTime; + this.queryTimeInMillis = o.queryTimeInMillis; + this.queryTotal = o.queryTotal; + this.request = _mapCopy(o.request); + this.scrollCurrent = o.scrollCurrent; + this.scrollTime = o.scrollTime; + this.scrollTimeInMillis = o.scrollTimeInMillis; + this.scrollTotal = o.scrollTotal; + this.searchIdleReactivateCountTotal = o.searchIdleReactivateCountTotal; + this.suggestCurrent = o.suggestCurrent; + this.suggestTime = o.suggestTime; + this.suggestTimeInMillis = o.suggestTimeInMillis; + this.suggestTotal = o.suggestTotal; + } + + private Builder(Builder o) { + this.concurrentAvgSliceCount = o.concurrentAvgSliceCount; + this.concurrentQueryCurrent = o.concurrentQueryCurrent; + this.concurrentQueryTime = o.concurrentQueryTime; + this.concurrentQueryTimeInMillis = o.concurrentQueryTimeInMillis; + this.concurrentQueryTotal = o.concurrentQueryTotal; + this.fetchCurrent = o.fetchCurrent; + this.fetchTime = o.fetchTime; + this.fetchTimeInMillis = o.fetchTimeInMillis; + this.fetchTotal = o.fetchTotal; + this.groups = _mapCopy(o.groups); + this.openContexts = o.openContexts; + this.pointInTimeCurrent = o.pointInTimeCurrent; + this.pointInTimeTime = o.pointInTimeTime; + this.pointInTimeTimeInMillis = o.pointInTimeTimeInMillis; + this.pointInTimeTotal = o.pointInTimeTotal; + this.queryCurrent = o.queryCurrent; + this.queryTime = o.queryTime; + this.queryTimeInMillis = o.queryTimeInMillis; + this.queryTotal = o.queryTotal; + this.request = _mapCopy(o.request); + this.scrollCurrent = o.scrollCurrent; + this.scrollTime = o.scrollTime; + this.scrollTimeInMillis = o.scrollTimeInMillis; + this.scrollTotal = o.scrollTotal; + this.searchIdleReactivateCountTotal = o.searchIdleReactivateCountTotal; + this.suggestCurrent = o.suggestCurrent; + this.suggestTime = o.suggestTime; + this.suggestTimeInMillis = o.suggestTimeInMillis; + this.suggestTotal = o.suggestTotal; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The average slice count of all search requests. This is computed as the total slice count divided by the total number of + * concurrent search requests. + *

+ * API name: {@code concurrent_avg_slice_count} + *

+ */ + @Nonnull + public final Builder concurrentAvgSliceCount(@Nullable Long value) { + this.concurrentAvgSliceCount = value; + return this; + } + + /** + * The number of currently running query operations using concurrent segment search. + *

+ * API name: {@code concurrent_query_current} + *

+ */ + @Nonnull + public final Builder concurrentQueryCurrent(@Nullable Long value) { + this.concurrentQueryCurrent = value; + return this; + } + + /** + * API name: {@code concurrent_query_time} + */ + @Nonnull + public final Builder concurrentQueryTime(@Nullable Time value) { + this.concurrentQueryTime = value; + return this; + } + + /** + * API name: {@code concurrent_query_time} + */ + @Nonnull + public final Builder concurrentQueryTime(Function> fn) { + return concurrentQueryTime(fn.apply(new Time.Builder()).build()); + } + + /** + * The total amount of time taken by all query operations using concurrent segment search, in milliseconds. + *

+ * API name: {@code concurrent_query_time_in_millis} + *

+ */ + @Nonnull + public final Builder concurrentQueryTimeInMillis(@Nullable Long value) { + this.concurrentQueryTimeInMillis = value; + return this; + } + + /** + * The total number of query operations using concurrent segment search. + *

+ * API name: {@code concurrent_query_total} + *

+ */ + @Nonnull + public final Builder concurrentQueryTotal(@Nullable Long value) { + this.concurrentQueryTotal = value; + return this; + } + + /** + * Required - The number of currently running shard fetch operations. + *

+ * API name: {@code fetch_current} + *

+ */ + @Nonnull + public final Builder fetchCurrent(long value) { + this.fetchCurrent = value; + return this; + } + + /** + * The total amount of time taken to complete all shard fetch operations. + *

+ * API name: {@code fetch_time} + *

+ */ + @Nonnull + public final Builder fetchTime(@Nullable Time value) { + this.fetchTime = value; + return this; + } + + /** + * The total amount of time taken to complete all shard fetch operations. + *

+ * API name: {@code fetch_time} + *

+ */ + @Nonnull + public final Builder fetchTime(Function> fn) { + return fetchTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total amount of time taken to complete all shard fetch operations, in milliseconds. + *

+ * API name: {@code fetch_time_in_millis} + *

+ */ + @Nonnull + public final Builder fetchTimeInMillis(long value) { + this.fetchTimeInMillis = value; + return this; + } + + /** + * Required - The total number of shard fetch operations. + *

+ * API name: {@code fetch_total} + *

+ */ + @Nonnull + public final Builder fetchTotal(long value) { + this.fetchTotal = value; + return this; + } + + /** + * API name: {@code groups} + * + *

+ * Adds all elements of map to groups. + *

+ */ + @Nonnull + public final Builder groups(Map map) { + this.groups = _mapPutAll(this.groups, map); + return this; + } + + /** + * API name: {@code groups} + * + *

+ * Adds an entry to groups. + *

+ */ + @Nonnull + public final Builder groups(String key, SearchStats value) { + this.groups = _mapPut(this.groups, key, value); + return this; + } + + /** + * API name: {@code groups} + * + *

+ * Adds a value to groups using a builder lambda. + *

+ */ + @Nonnull + public final Builder groups(String key, Function> fn) { + return groups(key, fn.apply(new SearchStats.Builder()).build()); + } + + /** + * The number of open search contexts. + *

+ * API name: {@code open_contexts} + *

+ */ + @Nonnull + public final Builder openContexts(@Nullable Long value) { + this.openContexts = value; + return this; + } + + /** + * The number of currently open shard PIT contexts. + *

+ * API name: {@code point_in_time_current} + *

+ */ + @Nonnull + public final Builder pointInTimeCurrent(@Nullable Long value) { + this.pointInTimeCurrent = value; + return this; + } + + /** + * API name: {@code point_in_time_time} + */ + @Nonnull + public final Builder pointInTimeTime(@Nullable Time value) { + this.pointInTimeTime = value; + return this; + } + + /** + * API name: {@code point_in_time_time} + */ + @Nonnull + public final Builder pointInTimeTime(Function> fn) { + return pointInTimeTime(fn.apply(new Time.Builder()).build()); + } + + /** + * The amount of time that shard PIT contexts have been held open since the node last restarted, in milliseconds. + *

+ * API name: {@code point_in_time_time_in_millis} + *

+ */ + @Nonnull + public final Builder pointInTimeTimeInMillis(@Nullable Long value) { + this.pointInTimeTimeInMillis = value; + return this; + } + + /** + * The total number of shard Point in Time (PIT) contexts created (completed and active) since the node last restarted. + *

+ * API name: {@code point_in_time_total} + *

+ */ + @Nonnull + public final Builder pointInTimeTotal(@Nullable Long value) { + this.pointInTimeTotal = value; + return this; + } + + /** + * Required - The number of currently running shard query operations. + *

+ * API name: {@code query_current} + *

+ */ + @Nonnull + public final Builder queryCurrent(long value) { + this.queryCurrent = value; + return this; + } + + /** + * The total amount of time taken to complete all shard query operations. + *

+ * API name: {@code query_time} + *

+ */ + @Nonnull + public final Builder queryTime(@Nullable Time value) { + this.queryTime = value; + return this; + } + + /** + * The total amount of time taken to complete all shard query operations. + *

+ * API name: {@code query_time} + *

+ */ + @Nonnull + public final Builder queryTime(Function> fn) { + return queryTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total amount of time taken to complete all shard query operations, in milliseconds. + *

+ * API name: {@code query_time_in_millis} + *

+ */ + @Nonnull + public final Builder queryTimeInMillis(long value) { + this.queryTimeInMillis = value; + return this; + } + + /** + * Required - The total number of shard query operations. + *

+ * API name: {@code query_total} + *

+ */ + @Nonnull + public final Builder queryTotal(long value) { + this.queryTotal = value; + return this; + } + + /** + * Statistics related to coordinator search operations for the node. + *

+ * API name: {@code request} + *

+ * + *

+ * Adds all elements of map to request. + *

+ */ + @Nonnull + public final Builder request(Map map) { + this.request = _mapPutAll(this.request, map); + return this; + } + + /** + * Statistics related to coordinator search operations for the node. + *

+ * API name: {@code request} + *

+ * + *

+ * Adds an entry to request. + *

+ */ + @Nonnull + public final Builder request(String key, RequestStats value) { + this.request = _mapPut(this.request, key, value); + return this; + } + + /** + * Statistics related to coordinator search operations for the node. + *

+ * API name: {@code request} + *

+ * + *

+ * Adds a value to request using a builder lambda. + *

+ */ + @Nonnull + public final Builder request(String key, Function> fn) { + return request(key, fn.apply(new RequestStats.Builder()).build()); + } + + /** + * Required - The number of shard scroll operations that are currently running. + *

+ * API name: {@code scroll_current} + *

+ */ + @Nonnull + public final Builder scrollCurrent(long value) { + this.scrollCurrent = value; + return this; + } + + /** + * The total amount of time taken to complete all shard scroll operations. + *

+ * API name: {@code scroll_time} + *

+ */ + @Nonnull + public final Builder scrollTime(@Nullable Time value) { + this.scrollTime = value; + return this; + } + + /** + * The total amount of time taken to complete all shard scroll operations. + *

+ * API name: {@code scroll_time} + *

+ */ + @Nonnull + public final Builder scrollTime(Function> fn) { + return scrollTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total amount of time taken to complete all shard scroll operations, in milliseconds. + *

+ * API name: {@code scroll_time_in_millis} + *

+ */ + @Nonnull + public final Builder scrollTimeInMillis(long value) { + this.scrollTimeInMillis = value; + return this; + } + + /** + * Required - The total number of shard scroll operations. + *

+ * API name: {@code scroll_total} + *

+ */ + @Nonnull + public final Builder scrollTotal(long value) { + this.scrollTotal = value; + return this; + } + + /** + * API name: {@code search_idle_reactivate_count_total} + */ + @Nonnull + public final Builder searchIdleReactivateCountTotal(@Nullable Long value) { + this.searchIdleReactivateCountTotal = value; + return this; + } + + /** + * Required - The number of currently running shard suggest operations. + *

+ * API name: {@code suggest_current} + *

+ */ + @Nonnull + public final Builder suggestCurrent(long value) { + this.suggestCurrent = value; + return this; + } + + /** + * The total amount of time take to complete all shard suggest operations. + *

+ * API name: {@code suggest_time} + *

+ */ + @Nonnull + public final Builder suggestTime(@Nullable Time value) { + this.suggestTime = value; + return this; + } + + /** + * The total amount of time take to complete all shard suggest operations. + *

+ * API name: {@code suggest_time} + *

+ */ + @Nonnull + public final Builder suggestTime(Function> fn) { + return suggestTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The total amount of time taken to complete all shard suggest operations, in milliseconds. + *

+ * API name: {@code suggest_time_in_millis} + *

+ */ + @Nonnull + public final Builder suggestTimeInMillis(long value) { + this.suggestTimeInMillis = value; + return this; + } + + /** + * Required - The total number of shard suggest operations. + *

+ * API name: {@code suggest_total} + *

+ */ + @Nonnull + public final Builder suggestTotal(long value) { + this.suggestTotal = value; + return this; + } + + /** + * Builds a {@link SearchStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SearchStats build() { + _checkSingleUse(); + + return new SearchStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SearchStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SearchStats::setupSearchStatsDeserializer + ); + + protected static void setupSearchStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::concurrentAvgSliceCount, JsonpDeserializer.longDeserializer(), "concurrent_avg_slice_count"); + op.add(Builder::concurrentQueryCurrent, JsonpDeserializer.longDeserializer(), "concurrent_query_current"); + op.add(Builder::concurrentQueryTime, Time._DESERIALIZER, "concurrent_query_time"); + op.add(Builder::concurrentQueryTimeInMillis, JsonpDeserializer.longDeserializer(), "concurrent_query_time_in_millis"); + op.add(Builder::concurrentQueryTotal, JsonpDeserializer.longDeserializer(), "concurrent_query_total"); + op.add(Builder::fetchCurrent, JsonpDeserializer.longDeserializer(), "fetch_current"); + op.add(Builder::fetchTime, Time._DESERIALIZER, "fetch_time"); + op.add(Builder::fetchTimeInMillis, JsonpDeserializer.longDeserializer(), "fetch_time_in_millis"); + op.add(Builder::fetchTotal, JsonpDeserializer.longDeserializer(), "fetch_total"); + op.add(Builder::groups, JsonpDeserializer.stringMapDeserializer(SearchStats._DESERIALIZER), "groups"); + op.add(Builder::openContexts, JsonpDeserializer.longDeserializer(), "open_contexts"); + op.add(Builder::pointInTimeCurrent, JsonpDeserializer.longDeserializer(), "point_in_time_current"); + op.add(Builder::pointInTimeTime, Time._DESERIALIZER, "point_in_time_time"); + op.add(Builder::pointInTimeTimeInMillis, JsonpDeserializer.longDeserializer(), "point_in_time_time_in_millis"); + op.add(Builder::pointInTimeTotal, JsonpDeserializer.longDeserializer(), "point_in_time_total"); + op.add(Builder::queryCurrent, JsonpDeserializer.longDeserializer(), "query_current"); + op.add(Builder::queryTime, Time._DESERIALIZER, "query_time"); + op.add(Builder::queryTimeInMillis, JsonpDeserializer.longDeserializer(), "query_time_in_millis"); + op.add(Builder::queryTotal, JsonpDeserializer.longDeserializer(), "query_total"); + op.add(Builder::request, JsonpDeserializer.stringMapDeserializer(RequestStats._DESERIALIZER), "request"); + op.add(Builder::scrollCurrent, JsonpDeserializer.longDeserializer(), "scroll_current"); + op.add(Builder::scrollTime, Time._DESERIALIZER, "scroll_time"); + op.add(Builder::scrollTimeInMillis, JsonpDeserializer.longDeserializer(), "scroll_time_in_millis"); + op.add(Builder::scrollTotal, JsonpDeserializer.longDeserializer(), "scroll_total"); + op.add(Builder::searchIdleReactivateCountTotal, JsonpDeserializer.longDeserializer(), "search_idle_reactivate_count_total"); + op.add(Builder::suggestCurrent, JsonpDeserializer.longDeserializer(), "suggest_current"); + op.add(Builder::suggestTime, Time._DESERIALIZER, "suggest_time"); + op.add(Builder::suggestTimeInMillis, JsonpDeserializer.longDeserializer(), "suggest_time_in_millis"); + op.add(Builder::suggestTotal, JsonpDeserializer.longDeserializer(), "suggest_total"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.concurrentAvgSliceCount); + result = 31 * result + Objects.hashCode(this.concurrentQueryCurrent); + result = 31 * result + Objects.hashCode(this.concurrentQueryTime); + result = 31 * result + Objects.hashCode(this.concurrentQueryTimeInMillis); + result = 31 * result + Objects.hashCode(this.concurrentQueryTotal); + result = 31 * result + Long.hashCode(this.fetchCurrent); + result = 31 * result + Objects.hashCode(this.fetchTime); + result = 31 * result + Long.hashCode(this.fetchTimeInMillis); + result = 31 * result + Long.hashCode(this.fetchTotal); + result = 31 * result + Objects.hashCode(this.groups); + result = 31 * result + Objects.hashCode(this.openContexts); + result = 31 * result + Objects.hashCode(this.pointInTimeCurrent); + result = 31 * result + Objects.hashCode(this.pointInTimeTime); + result = 31 * result + Objects.hashCode(this.pointInTimeTimeInMillis); + result = 31 * result + Objects.hashCode(this.pointInTimeTotal); + result = 31 * result + Long.hashCode(this.queryCurrent); + result = 31 * result + Objects.hashCode(this.queryTime); + result = 31 * result + Long.hashCode(this.queryTimeInMillis); + result = 31 * result + Long.hashCode(this.queryTotal); + result = 31 * result + Objects.hashCode(this.request); + result = 31 * result + Long.hashCode(this.scrollCurrent); + result = 31 * result + Objects.hashCode(this.scrollTime); + result = 31 * result + Long.hashCode(this.scrollTimeInMillis); + result = 31 * result + Long.hashCode(this.scrollTotal); + result = 31 * result + Objects.hashCode(this.searchIdleReactivateCountTotal); + result = 31 * result + Long.hashCode(this.suggestCurrent); + result = 31 * result + Objects.hashCode(this.suggestTime); + result = 31 * result + Long.hashCode(this.suggestTimeInMillis); + result = 31 * result + Long.hashCode(this.suggestTotal); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SearchStats other = (SearchStats) o; + return Objects.equals(this.concurrentAvgSliceCount, other.concurrentAvgSliceCount) + && Objects.equals(this.concurrentQueryCurrent, other.concurrentQueryCurrent) + && Objects.equals(this.concurrentQueryTime, other.concurrentQueryTime) + && Objects.equals(this.concurrentQueryTimeInMillis, other.concurrentQueryTimeInMillis) + && Objects.equals(this.concurrentQueryTotal, other.concurrentQueryTotal) + && this.fetchCurrent == other.fetchCurrent + && Objects.equals(this.fetchTime, other.fetchTime) + && this.fetchTimeInMillis == other.fetchTimeInMillis + && this.fetchTotal == other.fetchTotal + && Objects.equals(this.groups, other.groups) + && Objects.equals(this.openContexts, other.openContexts) + && Objects.equals(this.pointInTimeCurrent, other.pointInTimeCurrent) + && Objects.equals(this.pointInTimeTime, other.pointInTimeTime) + && Objects.equals(this.pointInTimeTimeInMillis, other.pointInTimeTimeInMillis) + && Objects.equals(this.pointInTimeTotal, other.pointInTimeTotal) + && this.queryCurrent == other.queryCurrent + && Objects.equals(this.queryTime, other.queryTime) + && this.queryTimeInMillis == other.queryTimeInMillis + && this.queryTotal == other.queryTotal + && Objects.equals(this.request, other.request) + && this.scrollCurrent == other.scrollCurrent + && Objects.equals(this.scrollTime, other.scrollTime) + && this.scrollTimeInMillis == other.scrollTimeInMillis + && this.scrollTotal == other.scrollTotal + && Objects.equals(this.searchIdleReactivateCountTotal, other.searchIdleReactivateCountTotal) + && this.suggestCurrent == other.suggestCurrent + && Objects.equals(this.suggestTime, other.suggestTime) + && this.suggestTimeInMillis == other.suggestTimeInMillis + && this.suggestTotal == other.suggestTotal; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentReplicationStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentReplicationStats.java new file mode 100644 index 0000000000..bf27a23349 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentReplicationStats.java @@ -0,0 +1,247 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.SegmentReplicationStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SegmentReplicationStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final JsonData maxBytesBehind; + + @Nonnull + private final JsonData maxReplicationLag; + + @Nonnull + private final JsonData totalBytesBehind; + + // --------------------------------------------------------------------------------------------- + + private SegmentReplicationStats(Builder builder) { + this.maxBytesBehind = ApiTypeHelper.requireNonNull(builder.maxBytesBehind, this, "maxBytesBehind"); + this.maxReplicationLag = ApiTypeHelper.requireNonNull(builder.maxReplicationLag, this, "maxReplicationLag"); + this.totalBytesBehind = ApiTypeHelper.requireNonNull(builder.totalBytesBehind, this, "totalBytesBehind"); + } + + public static SegmentReplicationStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code max_bytes_behind} + */ + @Nonnull + public final JsonData maxBytesBehind() { + return this.maxBytesBehind; + } + + /** + * Required - API name: {@code max_replication_lag} + */ + @Nonnull + public final JsonData maxReplicationLag() { + return this.maxReplicationLag; + } + + /** + * Required - API name: {@code total_bytes_behind} + */ + @Nonnull + public final JsonData totalBytesBehind() { + return this.totalBytesBehind; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("max_bytes_behind"); + this.maxBytesBehind.serialize(generator, mapper); + + generator.writeKey("max_replication_lag"); + this.maxReplicationLag.serialize(generator, mapper); + + generator.writeKey("total_bytes_behind"); + this.totalBytesBehind.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SegmentReplicationStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private JsonData maxBytesBehind; + private JsonData maxReplicationLag; + private JsonData totalBytesBehind; + + public Builder() {} + + private Builder(SegmentReplicationStats o) { + this.maxBytesBehind = o.maxBytesBehind; + this.maxReplicationLag = o.maxReplicationLag; + this.totalBytesBehind = o.totalBytesBehind; + } + + private Builder(Builder o) { + this.maxBytesBehind = o.maxBytesBehind; + this.maxReplicationLag = o.maxReplicationLag; + this.totalBytesBehind = o.totalBytesBehind; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code max_bytes_behind} + */ + @Nonnull + public final Builder maxBytesBehind(JsonData value) { + this.maxBytesBehind = value; + return this; + } + + /** + * Required - API name: {@code max_replication_lag} + */ + @Nonnull + public final Builder maxReplicationLag(JsonData value) { + this.maxReplicationLag = value; + return this; + } + + /** + * Required - API name: {@code total_bytes_behind} + */ + @Nonnull + public final Builder totalBytesBehind(JsonData value) { + this.totalBytesBehind = value; + return this; + } + + /** + * Builds a {@link SegmentReplicationStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SegmentReplicationStats build() { + _checkSingleUse(); + + return new SegmentReplicationStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SegmentReplicationStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SegmentReplicationStats::setupSegmentReplicationStatsDeserializer + ); + + protected static void setupSegmentReplicationStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::maxBytesBehind, JsonData._DESERIALIZER, "max_bytes_behind"); + op.add(Builder::maxReplicationLag, JsonData._DESERIALIZER, "max_replication_lag"); + op.add(Builder::totalBytesBehind, JsonData._DESERIALIZER, "total_bytes_behind"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.maxBytesBehind.hashCode(); + result = 31 * result + this.maxReplicationLag.hashCode(); + result = 31 * result + this.totalBytesBehind.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SegmentReplicationStats other = (SegmentReplicationStats) o; + return this.maxBytesBehind.equals(other.maxBytesBehind) + && this.maxReplicationLag.equals(other.maxReplicationLag) + && this.totalBytesBehind.equals(other.totalBytesBehind); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentsStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentsStats.java new file mode 100644 index 0000000000..2a29f50f2c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/SegmentsStats.java @@ -0,0 +1,1128 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch.indices.stats.ShardFileSizeInfo; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.SegmentsStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SegmentsStats implements PlainJsonSerializable, ToCopyableBuilder { + + private final int count; + + @Nullable + private final String docValuesMemory; + + private final long docValuesMemoryInBytes; + + @Nonnull + private final Map fileSizes; + + @Nullable + private final String fixedBitSet; + + private final long fixedBitSetMemoryInBytes; + + @Nullable + private final Long indexWriterMaxMemoryInBytes; + + @Nullable + private final String indexWriterMemory; + + private final long indexWriterMemoryInBytes; + + private final long maxUnsafeAutoIdTimestamp; + + @Nullable + private final String memory; + + private final long memoryInBytes; + + @Nullable + private final String normsMemory; + + private final long normsMemoryInBytes; + + @Nullable + private final String pointsMemory; + + private final long pointsMemoryInBytes; + + @Nullable + private final RemoteStoreStats remoteStore; + + @Nullable + private final SegmentReplicationStats segmentReplication; + + @Nullable + private final String storedFieldsMemory; + + private final long storedFieldsMemoryInBytes; + + @Nullable + private final String termVectorsMemory; + + private final long termVectorsMemoryInBytes; + + @Nullable + private final String termsMemory; + + private final long termsMemoryInBytes; + + @Nullable + private final String versionMapMemory; + + private final long versionMapMemoryInBytes; + + // --------------------------------------------------------------------------------------------- + + private SegmentsStats(Builder builder) { + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.docValuesMemory = builder.docValuesMemory; + this.docValuesMemoryInBytes = ApiTypeHelper.requireNonNull(builder.docValuesMemoryInBytes, this, "docValuesMemoryInBytes"); + this.fileSizes = ApiTypeHelper.unmodifiableRequired(builder.fileSizes, this, "fileSizes"); + this.fixedBitSet = builder.fixedBitSet; + this.fixedBitSetMemoryInBytes = ApiTypeHelper.requireNonNull(builder.fixedBitSetMemoryInBytes, this, "fixedBitSetMemoryInBytes"); + this.indexWriterMaxMemoryInBytes = builder.indexWriterMaxMemoryInBytes; + this.indexWriterMemory = builder.indexWriterMemory; + this.indexWriterMemoryInBytes = ApiTypeHelper.requireNonNull(builder.indexWriterMemoryInBytes, this, "indexWriterMemoryInBytes"); + this.maxUnsafeAutoIdTimestamp = ApiTypeHelper.requireNonNull(builder.maxUnsafeAutoIdTimestamp, this, "maxUnsafeAutoIdTimestamp"); + this.memory = builder.memory; + this.memoryInBytes = ApiTypeHelper.requireNonNull(builder.memoryInBytes, this, "memoryInBytes"); + this.normsMemory = builder.normsMemory; + this.normsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.normsMemoryInBytes, this, "normsMemoryInBytes"); + this.pointsMemory = builder.pointsMemory; + this.pointsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.pointsMemoryInBytes, this, "pointsMemoryInBytes"); + this.remoteStore = builder.remoteStore; + this.segmentReplication = builder.segmentReplication; + this.storedFieldsMemory = builder.storedFieldsMemory; + this.storedFieldsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.storedFieldsMemoryInBytes, this, "storedFieldsMemoryInBytes"); + this.termVectorsMemory = builder.termVectorsMemory; + this.termVectorsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.termVectorsMemoryInBytes, this, "termVectorsMemoryInBytes"); + this.termsMemory = builder.termsMemory; + this.termsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.termsMemoryInBytes, this, "termsMemoryInBytes"); + this.versionMapMemory = builder.versionMapMemory; + this.versionMapMemoryInBytes = ApiTypeHelper.requireNonNull(builder.versionMapMemoryInBytes, this, "versionMapMemoryInBytes"); + } + + public static SegmentsStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The total number of segments across all shards assigned to the selected nodes. + *

+ * API name: {@code count} + *

+ */ + public final int count() { + return this.count; + } + + /** + * API name: {@code doc_values_memory} + */ + @Nullable + public final String docValuesMemory() { + return this.docValuesMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for document values across all shards assigned to the selected nodes. + *

+ * API name: {@code doc_values_memory_in_bytes} + *

+ */ + public final long docValuesMemoryInBytes() { + return this.docValuesMemoryInBytes; + } + + /** + * Required - This object is not populated by the cluster stats API. To get information on segment files, use the node stats API. + *

+ * API name: {@code file_sizes} + *

+ */ + @Nonnull + public final Map fileSizes() { + return this.fileSizes; + } + + /** + * API name: {@code fixed_bit_set} + */ + @Nullable + public final String fixedBitSet() { + return this.fixedBitSet; + } + + /** + * Required - The total amount of memory, in bytes, used by fixed bit sets across all shards assigned to the selected nodes. + *

+ * API name: {@code fixed_bit_set_memory_in_bytes} + *

+ */ + public final long fixedBitSetMemoryInBytes() { + return this.fixedBitSetMemoryInBytes; + } + + /** + * API name: {@code index_writer_max_memory_in_bytes} + */ + @Nullable + public final Long indexWriterMaxMemoryInBytes() { + return this.indexWriterMaxMemoryInBytes; + } + + /** + * API name: {@code index_writer_memory} + */ + @Nullable + public final String indexWriterMemory() { + return this.indexWriterMemory; + } + + /** + * Required - The total amount, in bytes, of memory used by all index writers across all shards assigned to the selected nodes. + *

+ * API name: {@code index_writer_memory_in_bytes} + *

+ */ + public final long indexWriterMemoryInBytes() { + return this.indexWriterMemoryInBytes; + } + + /** + * Required - The Unix timestamp, in milliseconds, of the most recently retried indexing request. + *

+ * API name: {@code max_unsafe_auto_id_timestamp} + *

+ */ + public final long maxUnsafeAutoIdTimestamp() { + return this.maxUnsafeAutoIdTimestamp; + } + + /** + * The total amount of memory used for segments across all shards assigned to the selected nodes. + *

+ * API name: {@code memory} + *

+ */ + @Nullable + public final String memory() { + return this.memory; + } + + /** + * Required - The total amount, in bytes, of memory used for segments across all shards assigned to the selected nodes. + *

+ * API name: {@code memory_in_bytes} + *

+ */ + public final long memoryInBytes() { + return this.memoryInBytes; + } + + /** + * The total amount of memory used for normalization factors across all shards assigned to the selected nodes. + *

+ * API name: {@code norms_memory} + *

+ */ + @Nullable + public final String normsMemory() { + return this.normsMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for normalization factors across all shards assigned to the selected nodes. + *

+ * API name: {@code norms_memory_in_bytes} + *

+ */ + public final long normsMemoryInBytes() { + return this.normsMemoryInBytes; + } + + /** + * The total amount of memory used for points across all shards assigned to the selected nodes. + *

+ * API name: {@code points_memory} + *

+ */ + @Nullable + public final String pointsMemory() { + return this.pointsMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for points across all shards assigned to the selected nodes. + *

+ * API name: {@code points_memory_in_bytes} + *

+ */ + public final long pointsMemoryInBytes() { + return this.pointsMemoryInBytes; + } + + /** + * API name: {@code remote_store} + */ + @Nullable + public final RemoteStoreStats remoteStore() { + return this.remoteStore; + } + + /** + * API name: {@code segment_replication} + */ + @Nullable + public final SegmentReplicationStats segmentReplication() { + return this.segmentReplication; + } + + /** + * The total amount of memory used for stored fields across all shards assigned to the selected nodes. + *

+ * API name: {@code stored_fields_memory} + *

+ */ + @Nullable + public final String storedFieldsMemory() { + return this.storedFieldsMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for stored fields across all shards assigned to the selected nodes. + *

+ * API name: {@code stored_fields_memory_in_bytes} + *

+ */ + public final long storedFieldsMemoryInBytes() { + return this.storedFieldsMemoryInBytes; + } + + /** + * The total amount of memory used for term vectors across all shards assigned to the selected nodes. + *

+ * API name: {@code term_vectors_memory} + *

+ */ + @Nullable + public final String termVectorsMemory() { + return this.termVectorsMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for term vectors across all shards assigned to the selected nodes. + *

+ * API name: {@code term_vectors_memory_in_bytes} + *

+ */ + public final long termVectorsMemoryInBytes() { + return this.termVectorsMemoryInBytes; + } + + /** + * The total amount of memory used for terms across all shards assigned to the selected nodes. + *

+ * API name: {@code terms_memory} + *

+ */ + @Nullable + public final String termsMemory() { + return this.termsMemory; + } + + /** + * Required - The total amount, in bytes, of memory used for terms across all shards assigned to the selected nodes. + *

+ * API name: {@code terms_memory_in_bytes} + *

+ */ + public final long termsMemoryInBytes() { + return this.termsMemoryInBytes; + } + + /** + * The total amount of memory used by all version maps across all shards assigned to the selected nodes. + *

+ * API name: {@code version_map_memory} + *

+ */ + @Nullable + public final String versionMapMemory() { + return this.versionMapMemory; + } + + /** + * Required - The total amount, in bytes, of memory used by all version maps across all shards assigned to the selected nodes. + *

+ * API name: {@code version_map_memory_in_bytes} + *

+ */ + public final long versionMapMemoryInBytes() { + return this.versionMapMemoryInBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("count"); + generator.write(this.count); + + if (this.docValuesMemory != null) { + generator.writeKey("doc_values_memory"); + generator.write(this.docValuesMemory); + } + + generator.writeKey("doc_values_memory_in_bytes"); + generator.write(this.docValuesMemoryInBytes); + + generator.writeKey("file_sizes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fileSizes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + + if (this.fixedBitSet != null) { + generator.writeKey("fixed_bit_set"); + generator.write(this.fixedBitSet); + } + + generator.writeKey("fixed_bit_set_memory_in_bytes"); + generator.write(this.fixedBitSetMemoryInBytes); + + if (this.indexWriterMaxMemoryInBytes != null) { + generator.writeKey("index_writer_max_memory_in_bytes"); + generator.write(this.indexWriterMaxMemoryInBytes); + } + + if (this.indexWriterMemory != null) { + generator.writeKey("index_writer_memory"); + generator.write(this.indexWriterMemory); + } + + generator.writeKey("index_writer_memory_in_bytes"); + generator.write(this.indexWriterMemoryInBytes); + + generator.writeKey("max_unsafe_auto_id_timestamp"); + generator.write(this.maxUnsafeAutoIdTimestamp); + + if (this.memory != null) { + generator.writeKey("memory"); + generator.write(this.memory); + } + + generator.writeKey("memory_in_bytes"); + generator.write(this.memoryInBytes); + + if (this.normsMemory != null) { + generator.writeKey("norms_memory"); + generator.write(this.normsMemory); + } + + generator.writeKey("norms_memory_in_bytes"); + generator.write(this.normsMemoryInBytes); + + if (this.pointsMemory != null) { + generator.writeKey("points_memory"); + generator.write(this.pointsMemory); + } + + generator.writeKey("points_memory_in_bytes"); + generator.write(this.pointsMemoryInBytes); + + if (this.remoteStore != null) { + generator.writeKey("remote_store"); + this.remoteStore.serialize(generator, mapper); + } + + if (this.segmentReplication != null) { + generator.writeKey("segment_replication"); + this.segmentReplication.serialize(generator, mapper); + } + + if (this.storedFieldsMemory != null) { + generator.writeKey("stored_fields_memory"); + generator.write(this.storedFieldsMemory); + } + + generator.writeKey("stored_fields_memory_in_bytes"); + generator.write(this.storedFieldsMemoryInBytes); + + if (this.termVectorsMemory != null) { + generator.writeKey("term_vectors_memory"); + generator.write(this.termVectorsMemory); + } + + generator.writeKey("term_vectors_memory_in_bytes"); + generator.write(this.termVectorsMemoryInBytes); + + if (this.termsMemory != null) { + generator.writeKey("terms_memory"); + generator.write(this.termsMemory); + } + + generator.writeKey("terms_memory_in_bytes"); + generator.write(this.termsMemoryInBytes); + + if (this.versionMapMemory != null) { + generator.writeKey("version_map_memory"); + generator.write(this.versionMapMemory); + } + + generator.writeKey("version_map_memory_in_bytes"); + generator.write(this.versionMapMemoryInBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SegmentsStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Integer count; + @Nullable + private String docValuesMemory; + private Long docValuesMemoryInBytes; + private Map fileSizes; + @Nullable + private String fixedBitSet; + private Long fixedBitSetMemoryInBytes; + @Nullable + private Long indexWriterMaxMemoryInBytes; + @Nullable + private String indexWriterMemory; + private Long indexWriterMemoryInBytes; + private Long maxUnsafeAutoIdTimestamp; + @Nullable + private String memory; + private Long memoryInBytes; + @Nullable + private String normsMemory; + private Long normsMemoryInBytes; + @Nullable + private String pointsMemory; + private Long pointsMemoryInBytes; + @Nullable + private RemoteStoreStats remoteStore; + @Nullable + private SegmentReplicationStats segmentReplication; + @Nullable + private String storedFieldsMemory; + private Long storedFieldsMemoryInBytes; + @Nullable + private String termVectorsMemory; + private Long termVectorsMemoryInBytes; + @Nullable + private String termsMemory; + private Long termsMemoryInBytes; + @Nullable + private String versionMapMemory; + private Long versionMapMemoryInBytes; + + public Builder() {} + + private Builder(SegmentsStats o) { + this.count = o.count; + this.docValuesMemory = o.docValuesMemory; + this.docValuesMemoryInBytes = o.docValuesMemoryInBytes; + this.fileSizes = _mapCopy(o.fileSizes); + this.fixedBitSet = o.fixedBitSet; + this.fixedBitSetMemoryInBytes = o.fixedBitSetMemoryInBytes; + this.indexWriterMaxMemoryInBytes = o.indexWriterMaxMemoryInBytes; + this.indexWriterMemory = o.indexWriterMemory; + this.indexWriterMemoryInBytes = o.indexWriterMemoryInBytes; + this.maxUnsafeAutoIdTimestamp = o.maxUnsafeAutoIdTimestamp; + this.memory = o.memory; + this.memoryInBytes = o.memoryInBytes; + this.normsMemory = o.normsMemory; + this.normsMemoryInBytes = o.normsMemoryInBytes; + this.pointsMemory = o.pointsMemory; + this.pointsMemoryInBytes = o.pointsMemoryInBytes; + this.remoteStore = o.remoteStore; + this.segmentReplication = o.segmentReplication; + this.storedFieldsMemory = o.storedFieldsMemory; + this.storedFieldsMemoryInBytes = o.storedFieldsMemoryInBytes; + this.termVectorsMemory = o.termVectorsMemory; + this.termVectorsMemoryInBytes = o.termVectorsMemoryInBytes; + this.termsMemory = o.termsMemory; + this.termsMemoryInBytes = o.termsMemoryInBytes; + this.versionMapMemory = o.versionMapMemory; + this.versionMapMemoryInBytes = o.versionMapMemoryInBytes; + } + + private Builder(Builder o) { + this.count = o.count; + this.docValuesMemory = o.docValuesMemory; + this.docValuesMemoryInBytes = o.docValuesMemoryInBytes; + this.fileSizes = _mapCopy(o.fileSizes); + this.fixedBitSet = o.fixedBitSet; + this.fixedBitSetMemoryInBytes = o.fixedBitSetMemoryInBytes; + this.indexWriterMaxMemoryInBytes = o.indexWriterMaxMemoryInBytes; + this.indexWriterMemory = o.indexWriterMemory; + this.indexWriterMemoryInBytes = o.indexWriterMemoryInBytes; + this.maxUnsafeAutoIdTimestamp = o.maxUnsafeAutoIdTimestamp; + this.memory = o.memory; + this.memoryInBytes = o.memoryInBytes; + this.normsMemory = o.normsMemory; + this.normsMemoryInBytes = o.normsMemoryInBytes; + this.pointsMemory = o.pointsMemory; + this.pointsMemoryInBytes = o.pointsMemoryInBytes; + this.remoteStore = o.remoteStore; + this.segmentReplication = o.segmentReplication; + this.storedFieldsMemory = o.storedFieldsMemory; + this.storedFieldsMemoryInBytes = o.storedFieldsMemoryInBytes; + this.termVectorsMemory = o.termVectorsMemory; + this.termVectorsMemoryInBytes = o.termVectorsMemoryInBytes; + this.termsMemory = o.termsMemory; + this.termsMemoryInBytes = o.termsMemoryInBytes; + this.versionMapMemory = o.versionMapMemory; + this.versionMapMemoryInBytes = o.versionMapMemoryInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The total number of segments across all shards assigned to the selected nodes. + *

+ * API name: {@code count} + *

+ */ + @Nonnull + public final Builder count(int value) { + this.count = value; + return this; + } + + /** + * API name: {@code doc_values_memory} + */ + @Nonnull + public final Builder docValuesMemory(@Nullable String value) { + this.docValuesMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for document values across all shards assigned to the selected nodes. + *

+ * API name: {@code doc_values_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder docValuesMemoryInBytes(long value) { + this.docValuesMemoryInBytes = value; + return this; + } + + /** + * Required - This object is not populated by the cluster stats API. To get information on segment files, use the node stats API. + *

+ * API name: {@code file_sizes} + *

+ * + *

+ * Adds all elements of map to fileSizes. + *

+ */ + @Nonnull + public final Builder fileSizes(Map map) { + this.fileSizes = _mapPutAll(this.fileSizes, map); + return this; + } + + /** + * Required - This object is not populated by the cluster stats API. To get information on segment files, use the node stats API. + *

+ * API name: {@code file_sizes} + *

+ * + *

+ * Adds an entry to fileSizes. + *

+ */ + @Nonnull + public final Builder fileSizes(String key, ShardFileSizeInfo value) { + this.fileSizes = _mapPut(this.fileSizes, key, value); + return this; + } + + /** + * Required - This object is not populated by the cluster stats API. To get information on segment files, use the node stats API. + *

+ * API name: {@code file_sizes} + *

+ * + *

+ * Adds a value to fileSizes using a builder lambda. + *

+ */ + @Nonnull + public final Builder fileSizes(String key, Function> fn) { + return fileSizes(key, fn.apply(new ShardFileSizeInfo.Builder()).build()); + } + + /** + * API name: {@code fixed_bit_set} + */ + @Nonnull + public final Builder fixedBitSet(@Nullable String value) { + this.fixedBitSet = value; + return this; + } + + /** + * Required - The total amount of memory, in bytes, used by fixed bit sets across all shards assigned to the selected nodes. + *

+ * API name: {@code fixed_bit_set_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder fixedBitSetMemoryInBytes(long value) { + this.fixedBitSetMemoryInBytes = value; + return this; + } + + /** + * API name: {@code index_writer_max_memory_in_bytes} + */ + @Nonnull + public final Builder indexWriterMaxMemoryInBytes(@Nullable Long value) { + this.indexWriterMaxMemoryInBytes = value; + return this; + } + + /** + * API name: {@code index_writer_memory} + */ + @Nonnull + public final Builder indexWriterMemory(@Nullable String value) { + this.indexWriterMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used by all index writers across all shards assigned to the selected nodes. + *

+ * API name: {@code index_writer_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder indexWriterMemoryInBytes(long value) { + this.indexWriterMemoryInBytes = value; + return this; + } + + /** + * Required - The Unix timestamp, in milliseconds, of the most recently retried indexing request. + *

+ * API name: {@code max_unsafe_auto_id_timestamp} + *

+ */ + @Nonnull + public final Builder maxUnsafeAutoIdTimestamp(long value) { + this.maxUnsafeAutoIdTimestamp = value; + return this; + } + + /** + * The total amount of memory used for segments across all shards assigned to the selected nodes. + *

+ * API name: {@code memory} + *

+ */ + @Nonnull + public final Builder memory(@Nullable String value) { + this.memory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for segments across all shards assigned to the selected nodes. + *

+ * API name: {@code memory_in_bytes} + *

+ */ + @Nonnull + public final Builder memoryInBytes(long value) { + this.memoryInBytes = value; + return this; + } + + /** + * The total amount of memory used for normalization factors across all shards assigned to the selected nodes. + *

+ * API name: {@code norms_memory} + *

+ */ + @Nonnull + public final Builder normsMemory(@Nullable String value) { + this.normsMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for normalization factors across all shards assigned to the selected nodes. + *

+ * API name: {@code norms_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder normsMemoryInBytes(long value) { + this.normsMemoryInBytes = value; + return this; + } + + /** + * The total amount of memory used for points across all shards assigned to the selected nodes. + *

+ * API name: {@code points_memory} + *

+ */ + @Nonnull + public final Builder pointsMemory(@Nullable String value) { + this.pointsMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for points across all shards assigned to the selected nodes. + *

+ * API name: {@code points_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder pointsMemoryInBytes(long value) { + this.pointsMemoryInBytes = value; + return this; + } + + /** + * API name: {@code remote_store} + */ + @Nonnull + public final Builder remoteStore(@Nullable RemoteStoreStats value) { + this.remoteStore = value; + return this; + } + + /** + * API name: {@code remote_store} + */ + @Nonnull + public final Builder remoteStore(Function> fn) { + return remoteStore(fn.apply(new RemoteStoreStats.Builder()).build()); + } + + /** + * API name: {@code segment_replication} + */ + @Nonnull + public final Builder segmentReplication(@Nullable SegmentReplicationStats value) { + this.segmentReplication = value; + return this; + } + + /** + * API name: {@code segment_replication} + */ + @Nonnull + public final Builder segmentReplication(Function> fn) { + return segmentReplication(fn.apply(new SegmentReplicationStats.Builder()).build()); + } + + /** + * The total amount of memory used for stored fields across all shards assigned to the selected nodes. + *

+ * API name: {@code stored_fields_memory} + *

+ */ + @Nonnull + public final Builder storedFieldsMemory(@Nullable String value) { + this.storedFieldsMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for stored fields across all shards assigned to the selected nodes. + *

+ * API name: {@code stored_fields_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder storedFieldsMemoryInBytes(long value) { + this.storedFieldsMemoryInBytes = value; + return this; + } + + /** + * The total amount of memory used for term vectors across all shards assigned to the selected nodes. + *

+ * API name: {@code term_vectors_memory} + *

+ */ + @Nonnull + public final Builder termVectorsMemory(@Nullable String value) { + this.termVectorsMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for term vectors across all shards assigned to the selected nodes. + *

+ * API name: {@code term_vectors_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder termVectorsMemoryInBytes(long value) { + this.termVectorsMemoryInBytes = value; + return this; + } + + /** + * The total amount of memory used for terms across all shards assigned to the selected nodes. + *

+ * API name: {@code terms_memory} + *

+ */ + @Nonnull + public final Builder termsMemory(@Nullable String value) { + this.termsMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used for terms across all shards assigned to the selected nodes. + *

+ * API name: {@code terms_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder termsMemoryInBytes(long value) { + this.termsMemoryInBytes = value; + return this; + } + + /** + * The total amount of memory used by all version maps across all shards assigned to the selected nodes. + *

+ * API name: {@code version_map_memory} + *

+ */ + @Nonnull + public final Builder versionMapMemory(@Nullable String value) { + this.versionMapMemory = value; + return this; + } + + /** + * Required - The total amount, in bytes, of memory used by all version maps across all shards assigned to the selected nodes. + *

+ * API name: {@code version_map_memory_in_bytes} + *

+ */ + @Nonnull + public final Builder versionMapMemoryInBytes(long value) { + this.versionMapMemoryInBytes = value; + return this; + } + + /** + * Builds a {@link SegmentsStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SegmentsStats build() { + _checkSingleUse(); + + return new SegmentsStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SegmentsStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SegmentsStats::setupSegmentsStatsDeserializer + ); + + protected static void setupSegmentsStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + op.add(Builder::docValuesMemory, JsonpDeserializer.stringDeserializer(), "doc_values_memory"); + op.add(Builder::docValuesMemoryInBytes, JsonpDeserializer.longDeserializer(), "doc_values_memory_in_bytes"); + op.add(Builder::fileSizes, JsonpDeserializer.stringMapDeserializer(ShardFileSizeInfo._DESERIALIZER), "file_sizes"); + op.add(Builder::fixedBitSet, JsonpDeserializer.stringDeserializer(), "fixed_bit_set"); + op.add(Builder::fixedBitSetMemoryInBytes, JsonpDeserializer.longDeserializer(), "fixed_bit_set_memory_in_bytes"); + op.add(Builder::indexWriterMaxMemoryInBytes, JsonpDeserializer.longDeserializer(), "index_writer_max_memory_in_bytes"); + op.add(Builder::indexWriterMemory, JsonpDeserializer.stringDeserializer(), "index_writer_memory"); + op.add(Builder::indexWriterMemoryInBytes, JsonpDeserializer.longDeserializer(), "index_writer_memory_in_bytes"); + op.add(Builder::maxUnsafeAutoIdTimestamp, JsonpDeserializer.longDeserializer(), "max_unsafe_auto_id_timestamp"); + op.add(Builder::memory, JsonpDeserializer.stringDeserializer(), "memory"); + op.add(Builder::memoryInBytes, JsonpDeserializer.longDeserializer(), "memory_in_bytes"); + op.add(Builder::normsMemory, JsonpDeserializer.stringDeserializer(), "norms_memory"); + op.add(Builder::normsMemoryInBytes, JsonpDeserializer.longDeserializer(), "norms_memory_in_bytes"); + op.add(Builder::pointsMemory, JsonpDeserializer.stringDeserializer(), "points_memory"); + op.add(Builder::pointsMemoryInBytes, JsonpDeserializer.longDeserializer(), "points_memory_in_bytes"); + op.add(Builder::remoteStore, RemoteStoreStats._DESERIALIZER, "remote_store"); + op.add(Builder::segmentReplication, SegmentReplicationStats._DESERIALIZER, "segment_replication"); + op.add(Builder::storedFieldsMemory, JsonpDeserializer.stringDeserializer(), "stored_fields_memory"); + op.add(Builder::storedFieldsMemoryInBytes, JsonpDeserializer.longDeserializer(), "stored_fields_memory_in_bytes"); + op.add(Builder::termVectorsMemory, JsonpDeserializer.stringDeserializer(), "term_vectors_memory"); + op.add(Builder::termVectorsMemoryInBytes, JsonpDeserializer.longDeserializer(), "term_vectors_memory_in_bytes"); + op.add(Builder::termsMemory, JsonpDeserializer.stringDeserializer(), "terms_memory"); + op.add(Builder::termsMemoryInBytes, JsonpDeserializer.longDeserializer(), "terms_memory_in_bytes"); + op.add(Builder::versionMapMemory, JsonpDeserializer.stringDeserializer(), "version_map_memory"); + op.add(Builder::versionMapMemoryInBytes, JsonpDeserializer.longDeserializer(), "version_map_memory_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.docValuesMemory); + result = 31 * result + Long.hashCode(this.docValuesMemoryInBytes); + result = 31 * result + this.fileSizes.hashCode(); + result = 31 * result + Objects.hashCode(this.fixedBitSet); + result = 31 * result + Long.hashCode(this.fixedBitSetMemoryInBytes); + result = 31 * result + Objects.hashCode(this.indexWriterMaxMemoryInBytes); + result = 31 * result + Objects.hashCode(this.indexWriterMemory); + result = 31 * result + Long.hashCode(this.indexWriterMemoryInBytes); + result = 31 * result + Long.hashCode(this.maxUnsafeAutoIdTimestamp); + result = 31 * result + Objects.hashCode(this.memory); + result = 31 * result + Long.hashCode(this.memoryInBytes); + result = 31 * result + Objects.hashCode(this.normsMemory); + result = 31 * result + Long.hashCode(this.normsMemoryInBytes); + result = 31 * result + Objects.hashCode(this.pointsMemory); + result = 31 * result + Long.hashCode(this.pointsMemoryInBytes); + result = 31 * result + Objects.hashCode(this.remoteStore); + result = 31 * result + Objects.hashCode(this.segmentReplication); + result = 31 * result + Objects.hashCode(this.storedFieldsMemory); + result = 31 * result + Long.hashCode(this.storedFieldsMemoryInBytes); + result = 31 * result + Objects.hashCode(this.termVectorsMemory); + result = 31 * result + Long.hashCode(this.termVectorsMemoryInBytes); + result = 31 * result + Objects.hashCode(this.termsMemory); + result = 31 * result + Long.hashCode(this.termsMemoryInBytes); + result = 31 * result + Objects.hashCode(this.versionMapMemory); + result = 31 * result + Long.hashCode(this.versionMapMemoryInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SegmentsStats other = (SegmentsStats) o; + return this.count == other.count + && Objects.equals(this.docValuesMemory, other.docValuesMemory) + && this.docValuesMemoryInBytes == other.docValuesMemoryInBytes + && this.fileSizes.equals(other.fileSizes) + && Objects.equals(this.fixedBitSet, other.fixedBitSet) + && this.fixedBitSetMemoryInBytes == other.fixedBitSetMemoryInBytes + && Objects.equals(this.indexWriterMaxMemoryInBytes, other.indexWriterMaxMemoryInBytes) + && Objects.equals(this.indexWriterMemory, other.indexWriterMemory) + && this.indexWriterMemoryInBytes == other.indexWriterMemoryInBytes + && this.maxUnsafeAutoIdTimestamp == other.maxUnsafeAutoIdTimestamp + && Objects.equals(this.memory, other.memory) + && this.memoryInBytes == other.memoryInBytes + && Objects.equals(this.normsMemory, other.normsMemory) + && this.normsMemoryInBytes == other.normsMemoryInBytes + && Objects.equals(this.pointsMemory, other.pointsMemory) + && this.pointsMemoryInBytes == other.pointsMemoryInBytes + && Objects.equals(this.remoteStore, other.remoteStore) + && Objects.equals(this.segmentReplication, other.segmentReplication) + && Objects.equals(this.storedFieldsMemory, other.storedFieldsMemory) + && this.storedFieldsMemoryInBytes == other.storedFieldsMemoryInBytes + && Objects.equals(this.termVectorsMemory, other.termVectorsMemory) + && this.termVectorsMemoryInBytes == other.termVectorsMemoryInBytes + && Objects.equals(this.termsMemory, other.termsMemory) + && this.termsMemoryInBytes == other.termsMemoryInBytes + && Objects.equals(this.versionMapMemory, other.versionMapMemory) + && this.versionMapMemoryInBytes == other.versionMapMemoryInBytes; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/StoreStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/StoreStats.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/StoreStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/StoreStats.java index 267f57aec8..2f8010684c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/StoreStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/StoreStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,63 +49,40 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.StoreStats @JsonpDeserializable -public class StoreStats implements PlainJsonSerializable { - @Nullable - private final String size; - - private final long sizeInBytes; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StoreStats implements PlainJsonSerializable, ToCopyableBuilder { @Nullable private final String reserved; private final long reservedInBytes; - @Deprecated @Nullable - private final String totalDataSetSize; + private final String size; - @Deprecated - @Nullable - private final Long totalDataSetSizeInBytes; + private final long sizeInBytes; // --------------------------------------------------------------------------------------------- private StoreStats(Builder builder) { - - this.size = builder.size; - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); this.reserved = builder.reserved; this.reservedInBytes = ApiTypeHelper.requireNonNull(builder.reservedInBytes, this, "reservedInBytes"); - this.totalDataSetSize = builder.totalDataSetSize; - this.totalDataSetSizeInBytes = builder.totalDataSetSizeInBytes; - + this.size = builder.size; + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); } - public static StoreStats of(Function> fn) { + public static StoreStats of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final long sizeInBytes() { - return this.sizeInBytes; - } - /** * API name: {@code reserved} */ @@ -108,37 +92,38 @@ public final String reserved() { } /** - * Required - API name: {@code reserved_in_bytes} + * Required - A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring + * snapshots, and similar activities. + *

+ * API name: {@code reserved_in_bytes} + *

*/ public final long reservedInBytes() { return this.reservedInBytes; } /** - * @deprecated - * Not returned by server - * API name: {@code total_data_set_size} + * API name: {@code size} */ - @Deprecated @Nullable - public final String totalDataSetSize() { - return this.totalDataSetSize; + public final String size() { + return this.size; } /** - * @deprecated - * Not returned by server - * API name: {@code total_data_set_size_in_bytes} + * Required - The total size, in bytes, of all shards assigned to the selected nodes. + *

+ * API name: {@code size_in_bytes} + *

*/ - @Deprecated - @Nullable - public final Long totalDataSetSizeInBytes() { - return this.totalDataSetSizeInBytes; + public final long sizeInBytes() { + return this.sizeInBytes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -146,121 +131,119 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - if (this.reserved != null) { generator.writeKey("reserved"); generator.write(this.reserved); - } + generator.writeKey("reserved_in_bytes"); generator.write(this.reservedInBytes); - if (this.totalDataSetSize != null) { - generator.writeKey("total_data_set_size"); - generator.write(this.totalDataSetSize); - - } - if (this.totalDataSetSizeInBytes != null) { - generator.writeKey("total_data_set_size_in_bytes"); - generator.write(this.totalDataSetSizeInBytes); - + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); } + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StoreStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String size; - - private Long sizeInBytes; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String reserved; - private Long reservedInBytes; - - @Deprecated @Nullable - private String totalDataSetSize; + private String size; + private Long sizeInBytes; - @Deprecated - @Nullable - private Long totalDataSetSizeInBytes; + public Builder() {} - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; + private Builder(StoreStats o) { + this.reserved = o.reserved; + this.reservedInBytes = o.reservedInBytes; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; } - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; + private Builder(Builder o) { + this.reserved = o.reserved; + this.reservedInBytes = o.reservedInBytes; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code reserved} */ + @Nonnull public final Builder reserved(@Nullable String value) { this.reserved = value; return this; } /** - * Required - API name: {@code reserved_in_bytes} + * Required - A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, + * restoring snapshots, and similar activities. + *

+ * API name: {@code reserved_in_bytes} + *

*/ + @Nonnull public final Builder reservedInBytes(long value) { this.reservedInBytes = value; return this; } /** - * @deprecated - * Not returned by server - * API name: {@code total_data_set_size} + * API name: {@code size} */ - @Deprecated - public final Builder totalDataSetSize(@Nullable String value) { - this.totalDataSetSize = value; + @Nonnull + public final Builder size(@Nullable String value) { + this.size = value; return this; } /** - * @deprecated - * Not returned by server - * API name: {@code total_data_set_size_in_bytes} + * Required - The total size, in bytes, of all shards assigned to the selected nodes. + *

+ * API name: {@code size_in_bytes} + *

*/ - @Deprecated - public final Builder totalDataSetSizeInBytes(@Nullable Long value) { - this.totalDataSetSizeInBytes = value; + @Nonnull + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; return this; } /** * Builds a {@link StoreStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StoreStats build() { _checkSingleUse(); @@ -279,14 +262,30 @@ public StoreStats build() { ); protected static void setupStoreStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); op.add(Builder::reserved, JsonpDeserializer.stringDeserializer(), "reserved"); op.add(Builder::reservedInBytes, JsonpDeserializer.longDeserializer(), "reserved_in_bytes"); - op.add(Builder::totalDataSetSize, JsonpDeserializer.stringDeserializer(), "total_data_set_size"); - op.add(Builder::totalDataSetSizeInBytes, JsonpDeserializer.longDeserializer(), "total_data_set_size_in_bytes"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.reserved); + result = 31 * result + Long.hashCode(this.reservedInBytes); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + StoreStats other = (StoreStats) o; + return Objects.equals(this.reserved, other.reserved) + && this.reservedInBytes == other.reservedInBytes + && Objects.equals(this.size, other.size) + && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/TranslogStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TranslogStats.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/TranslogStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/TranslogStats.java index 6c7652fd30..79adffbe2c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/TranslogStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TranslogStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,16 +49,23 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.TranslogStats @JsonpDeserializable -public class TranslogStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TranslogStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long earliestLastModifiedAge; - private final long operations; + private final int operations; + + @Nullable + private final RemoteStoreTranslogStats remoteStore; @Nullable private final String size; @@ -68,18 +82,17 @@ public class TranslogStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private TranslogStats(Builder builder) { - this.earliestLastModifiedAge = ApiTypeHelper.requireNonNull(builder.earliestLastModifiedAge, this, "earliestLastModifiedAge"); this.operations = ApiTypeHelper.requireNonNull(builder.operations, this, "operations"); + this.remoteStore = builder.remoteStore; this.size = builder.size; this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); this.uncommittedOperations = ApiTypeHelper.requireNonNull(builder.uncommittedOperations, this, "uncommittedOperations"); this.uncommittedSize = builder.uncommittedSize; this.uncommittedSizeInBytes = ApiTypeHelper.requireNonNull(builder.uncommittedSizeInBytes, this, "uncommittedSizeInBytes"); - } - public static TranslogStats of(Function> fn) { + public static TranslogStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -93,10 +106,18 @@ public final long earliestLastModifiedAge() { /** * Required - API name: {@code operations} */ - public final long operations() { + public final int operations() { return this.operations; } + /** + * API name: {@code remote_store} + */ + @Nullable + public final RemoteStoreTranslogStats remoteStore() { + return this.remoteStore; + } + /** * API name: {@code size} */ @@ -137,6 +158,7 @@ public final long uncommittedSizeInBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -144,18 +166,22 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("earliest_last_modified_age"); generator.write(this.earliestLastModifiedAge); generator.writeKey("operations"); generator.write(this.operations); + if (this.remoteStore != null) { + generator.writeKey("remote_store"); + this.remoteStore.serialize(generator, mapper); + } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + generator.writeKey("size_in_bytes"); generator.write(this.sizeInBytes); @@ -165,39 +191,75 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.uncommittedSize != null) { generator.writeKey("uncommitted_size"); generator.write(this.uncommittedSize); - } + generator.writeKey("uncommitted_size_in_bytes"); generator.write(this.uncommittedSizeInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TranslogStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long earliestLastModifiedAge; - - private Long operations; - + private Integer operations; + @Nullable + private RemoteStoreTranslogStats remoteStore; @Nullable private String size; - private Long sizeInBytes; - private Integer uncommittedOperations; - @Nullable private String uncommittedSize; - private Long uncommittedSizeInBytes; + public Builder() {} + + private Builder(TranslogStats o) { + this.earliestLastModifiedAge = o.earliestLastModifiedAge; + this.operations = o.operations; + this.remoteStore = o.remoteStore; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + this.uncommittedOperations = o.uncommittedOperations; + this.uncommittedSize = o.uncommittedSize; + this.uncommittedSizeInBytes = o.uncommittedSizeInBytes; + } + + private Builder(Builder o) { + this.earliestLastModifiedAge = o.earliestLastModifiedAge; + this.operations = o.operations; + this.remoteStore = o.remoteStore; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + this.uncommittedOperations = o.uncommittedOperations; + this.uncommittedSize = o.uncommittedSize; + this.uncommittedSizeInBytes = o.uncommittedSizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code earliest_last_modified_age} */ + @Nonnull public final Builder earliestLastModifiedAge(long value) { this.earliestLastModifiedAge = value; return this; @@ -206,14 +268,33 @@ public final Builder earliestLastModifiedAge(long value) { /** * Required - API name: {@code operations} */ - public final Builder operations(long value) { + @Nonnull + public final Builder operations(int value) { this.operations = value; return this; } + /** + * API name: {@code remote_store} + */ + @Nonnull + public final Builder remoteStore(@Nullable RemoteStoreTranslogStats value) { + this.remoteStore = value; + return this; + } + + /** + * API name: {@code remote_store} + */ + @Nonnull + public final Builder remoteStore(Function> fn) { + return remoteStore(fn.apply(new RemoteStoreTranslogStats.Builder()).build()); + } + /** * API name: {@code size} */ + @Nonnull public final Builder size(@Nullable String value) { this.size = value; return this; @@ -222,6 +303,7 @@ public final Builder size(@Nullable String value) { /** * Required - API name: {@code size_in_bytes} */ + @Nonnull public final Builder sizeInBytes(long value) { this.sizeInBytes = value; return this; @@ -230,6 +312,7 @@ public final Builder sizeInBytes(long value) { /** * Required - API name: {@code uncommitted_operations} */ + @Nonnull public final Builder uncommittedOperations(int value) { this.uncommittedOperations = value; return this; @@ -238,6 +321,7 @@ public final Builder uncommittedOperations(int value) { /** * API name: {@code uncommitted_size} */ + @Nonnull public final Builder uncommittedSize(@Nullable String value) { this.uncommittedSize = value; return this; @@ -246,6 +330,7 @@ public final Builder uncommittedSize(@Nullable String value) { /** * Required - API name: {@code uncommitted_size_in_bytes} */ + @Nonnull public final Builder uncommittedSizeInBytes(long value) { this.uncommittedSizeInBytes = value; return this; @@ -254,9 +339,10 @@ public final Builder uncommittedSizeInBytes(long value) { /** * Builds a {@link TranslogStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TranslogStats build() { _checkSingleUse(); @@ -275,15 +361,42 @@ public TranslogStats build() { ); protected static void setupTranslogStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::earliestLastModifiedAge, JsonpDeserializer.longDeserializer(), "earliest_last_modified_age"); - op.add(Builder::operations, JsonpDeserializer.longDeserializer(), "operations"); + op.add(Builder::operations, JsonpDeserializer.integerDeserializer(), "operations"); + op.add(Builder::remoteStore, RemoteStoreTranslogStats._DESERIALIZER, "remote_store"); op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); op.add(Builder::uncommittedOperations, JsonpDeserializer.integerDeserializer(), "uncommitted_operations"); op.add(Builder::uncommittedSize, JsonpDeserializer.stringDeserializer(), "uncommitted_size"); op.add(Builder::uncommittedSizeInBytes, JsonpDeserializer.longDeserializer(), "uncommitted_size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.earliestLastModifiedAge); + result = 31 * result + Integer.hashCode(this.operations); + result = 31 * result + Objects.hashCode(this.remoteStore); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + result = 31 * result + Integer.hashCode(this.uncommittedOperations); + result = 31 * result + Objects.hashCode(this.uncommittedSize); + result = 31 * result + Long.hashCode(this.uncommittedSizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TranslogStats other = (TranslogStats) o; + return this.earliestLastModifiedAge == other.earliestLastModifiedAge + && this.operations == other.operations + && Objects.equals(this.remoteStore, other.remoteStore) + && Objects.equals(this.size, other.size) + && this.sizeInBytes == other.sizeInBytes + && this.uncommittedOperations == other.uncommittedOperations + && Objects.equals(this.uncommittedSize, other.uncommittedSize) + && this.uncommittedSizeInBytes == other.uncommittedSizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WarmerStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WarmerStats.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/WarmerStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/WarmerStats.java index f478d1643a..c81a986911 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WarmerStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WarmerStats.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,34 +49,36 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.WarmerStats @JsonpDeserializable -public class WarmerStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class WarmerStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long current; private final long total; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; // --------------------------------------------------------------------------------------------- private WarmerStats(Builder builder) { - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - } - public static WarmerStats of(Function> fn) { + public static WarmerStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -91,7 +100,7 @@ public final long total() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -105,6 +114,7 @@ public final long totalTimeInMillis() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,7 +122,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("current"); generator.write(this.current); @@ -121,33 +130,62 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link WarmerStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long current; - private Long total; - @Nullable - private String totalTime; - + private Time totalTime; private Long totalTimeInMillis; + public Builder() {} + + private Builder(WarmerStats o) { + this.current = o.current; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.current = o.current; + this.total = o.total; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code current} */ + @Nonnull public final Builder current(long value) { this.current = value; return this; @@ -156,6 +194,7 @@ public final Builder current(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -164,14 +203,24 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ + @Nonnull public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; @@ -180,9 +229,10 @@ public final Builder totalTimeInMillis(long value) { /** * Builds a {@link WarmerStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public WarmerStats build() { _checkSingleUse(); @@ -201,12 +251,30 @@ public WarmerStats build() { ); protected static void setupWarmerStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.current); + result = 31 * result + Long.hashCode(this.total); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + WarmerStats other = (WarmerStats) o; + return this.current == other.current + && this.total == other.total + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java similarity index 53% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java index 980afd4fa9..b1141255b2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -51,113 +58,157 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.clone.Request /** - * Clones an index - * + * Clones an index. */ @JsonpDeserializable -public class CloneIndexRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloneIndexRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final Map aliases; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final String index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final Map settings; + @Nonnull private final String target; + @Nullable + private final Time taskExecutionTimeout; + @Nullable private final Time timeout; @Nullable private final WaitForActiveShards waitForActiveShards; + @Nullable + private final Boolean waitForCompletion; + // --------------------------------------------------------------------------------------------- private CloneIndexRequest(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); + this.taskExecutionTimeout = builder.taskExecutionTimeout; this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; - + this.waitForCompletion = builder.waitForCompletion; } - public static CloneIndexRequest of(Function> fn) { + public static CloneIndexRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

*/ + @Nonnull public final Map aliases() { return this.aliases; } /** - * Required - The name of the source index to clone + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Required - Name of the source index to clone. *

* API name: {@code index} + *

*/ + @Nonnull public final String index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable public final Time masterTimeout() { return this.masterTimeout; } /** - * Specify timeout for connection to cluster-manager + * Configuration options for the target index. *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** * API name: {@code settings} + *

*/ + @Nonnull public final Map settings() { return this.settings; } /** - * Required - The name of the target index to clone into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final String target() { return this.target; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nullable + public final Time taskExecutionTimeout() { + return this.taskExecutionTimeout; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -165,19 +216,32 @@ public final Time timeout() { } /** - * Set the number of active shards to wait for on the cloned index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer + * up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { return this.waitForActiveShards; } + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -185,217 +249,339 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartObject(); for (Map.Entry item0 : this.aliases.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link CloneIndexRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Map aliases; - + @Nullable + private Time clusterManagerTimeout; private String index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Map settings; - private String target; - + @Nullable + private Time taskExecutionTimeout; @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(CloneIndexRequest o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } /** - * Required - The name of the source index to clone + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - Name of the source index to clone. *

* API name: {@code index} + *

*/ + @Nonnull public final Builder index(String value) { this.index = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager + * Configuration options for the target index. *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** * API name: {@code settings} + *

+ * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; } /** + * Configuration options for the target index. + *

* API name: {@code settings} + *

+ * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; } /** - * Required - The name of the target index to clone into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final Builder target(String value) { this.target = value; return this; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(@Nullable Time value) { + this.taskExecutionTimeout = value; + return this; + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(Function> fn) { + return taskExecutionTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Set the number of active shards to wait for on the cloned index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * Set the number of active shards to wait for on the cloned index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + } + + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; } /** * Builds a {@link CloneIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CloneIndexRequest build() { _checkSingleUse(); @@ -414,10 +600,8 @@ public CloneIndexRequest build() { ); protected static void setupCloneIndexRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); - } // --------------------------------------------------------------------------------------------- @@ -426,56 +610,75 @@ protected static void setupCloneIndexRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _index = 1 << 0; - final int _target = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _target; - - if (propsSet == (_index | _target)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_clone"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.target, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(request.index, buf); + buf.append("/_clone/"); + SimpleEndpoint.pathEncode(request.target, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } if (request.masterTimeout != null) { params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.clusterManagerTimeout != null) { - params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + if (request.taskExecutionTimeout != null) { + params.put("task_execution_timeout", request.taskExecutionTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); } if (request.waitForActiveShards != null) { params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); } return params; - }, SimpleEndpoint.emptyMap(), true, CloneIndexResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + this.target.hashCode(); + result = 31 * result + Objects.hashCode(this.taskExecutionTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloneIndexRequest other = (CloneIndexRequest) o; + return Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.settings, other.settings) + && this.target.equals(other.target) + && Objects.equals(this.taskExecutionTimeout, other.taskExecutionTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java index 2a9f28571a..61ccd4b7dd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloneIndexResponse.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,12 +47,19 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.clone.Response @JsonpDeserializable -public class CloneIndexResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloneIndexResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + + @Nonnull private final String index; private final boolean shardsAcknowledged; @@ -55,19 +68,18 @@ public class CloneIndexResponse extends AcknowledgedResponseBase { private CloneIndexResponse(Builder builder) { super(builder); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - } - public static CloneIndexResponse of(Function> fn) { + public static CloneIndexResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } @@ -80,30 +92,66 @@ public final boolean shardsAcknowledged() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("index"); generator.write(this.index); generator.writeKey("shards_acknowledged"); generator.write(this.shardsAcknowledged); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CloneIndexResponse}. */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { private String index; - private Boolean shardsAcknowledged; + public Builder() {} + + private Builder(CloneIndexResponse o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + private Builder(Builder o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -112,22 +160,19 @@ public final Builder index(String value) { /** * Required - API name: {@code shards_acknowledged} */ + @Nonnull public final Builder shardsAcknowledged(boolean value) { this.shardsAcknowledged = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link CloneIndexResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CloneIndexResponse build() { _checkSingleUse(); @@ -146,10 +191,27 @@ public CloneIndexResponse build() { ); protected static void setupCloneIndexResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Boolean.hashCode(this.shardsAcknowledged); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloneIndexResponse other = (CloneIndexResponse) o; + return this.index.equals(other.index) && this.shardsAcknowledged == other.shardsAcknowledged; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java similarity index 54% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java index d2ecd16df6..2740b47027 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -46,34 +53,38 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.close.Request /** * Closes an index. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloseIndexRequest extends RequestBase implements ToCopyableBuilder { -public class CloseIndexRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; @@ -83,28 +94,26 @@ public class CloseIndexRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private CloseIndexRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; - } - public static CloseIndexRequest of(Function> fn) { + public static CloseIndexRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -112,20 +121,34 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -133,18 +156,22 @@ public final Boolean ignoreUnavailable() { } /** - * Required - A comma separated list of indices to close + * Required - Comma-separated list or wildcard expression of index names used to limit the request. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -153,19 +180,10 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -173,12 +191,11 @@ public final Time timeout() { } /** - * Sets the number of active shards to wait for before the operation returns. - * Set to index-setting to wait according to the index setting - * index.write.wait_for_active_shards, or all to wait - * for all shards, or an integer. Defaults to 0. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer + * up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { @@ -187,198 +204,265 @@ public final WaitForActiveShards waitForActiveShards() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CloseIndexRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - private List index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; + public Builder() {} + + private Builder(CloseIndexRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * Required - A comma separated list of indices to close + * Required - Comma-separated list or wildcard expression of index names used to limit the request. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * Required - A comma separated list of indices to close + * Required - Comma-separated list or wildcard expression of index names used to limit the request. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Sets the number of active shards to wait for before the operation returns. - * Set to index-setting to wait according to the index setting - * index.write.wait_for_active_shards, or all to wait - * for all shards, or an integer. Defaults to 0. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * Sets the number of active shards to wait for before the operation returns. - * Set to index-setting to wait according to the index setting - * index.write.wait_for_active_shards, or all to wait - * for all shards, or an integer. Defaults to 0. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); } /** * Builds a {@link CloseIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CloseIndexRequest build() { _checkSingleUse(); @@ -392,37 +476,21 @@ public CloseIndexRequest build() { * Endpoint "{@code indices.close}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_close"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_close"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); @@ -433,20 +501,48 @@ public CloseIndexRequest build() { if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } + if (request.waitForActiveShards != null) { + params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, CloseIndexResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloseIndexRequest other = (CloseIndexRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java index c48bbde5c6..fcb59fc378 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CloseIndexResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,12 +49,19 @@ import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; import org.opensearch.client.opensearch.indices.close.CloseIndexResult; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.close.Response @JsonpDeserializable -public class CloseIndexResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloseIndexResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + + @Nonnull private final Map indices; private final boolean shardsAcknowledged; @@ -57,19 +70,18 @@ public class CloseIndexResponse extends AcknowledgedResponseBase { private CloseIndexResponse(Builder builder) { super(builder); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - } - public static CloseIndexResponse of(Function> fn) { + public static CloseIndexResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -82,40 +94,75 @@ public final boolean shardsAcknowledged() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartObject(); - for (Map.Entry item0 : this.indices.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("shards_acknowledged"); generator.write(this.shardsAcknowledged); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CloseIndexResponse}. */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { private Map indices; - private Boolean shardsAcknowledged; + public Builder() {} + + private Builder(CloseIndexResponse o) { + super(o); + this.indices = _mapCopy(o.indices); + this.shardsAcknowledged = o.shardsAcknowledged; + } + + private Builder(Builder o) { + super(o); + this.indices = _mapCopy(o.indices); + this.shardsAcknowledged = o.shardsAcknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -123,9 +170,12 @@ public final Builder indices(Map map) { /** * Required - API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, CloseIndexResult value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -133,9 +183,12 @@ public final Builder indices(String key, CloseIndexResult value) { /** * Required - API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new CloseIndexResult.Builder()).build()); } @@ -143,22 +196,19 @@ public final Builder indices(String key, Function op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(CloseIndexResult._DESERIALIZER), "indices"); op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.indices.hashCode(); + result = 31 * result + Boolean.hashCode(this.shardsAcknowledged); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloseIndexResponse other = (CloseIndexResponse) o; + return this.indices.equals(other.indices) && this.shardsAcknowledged == other.shardsAcknowledged; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushRequest.java new file mode 100644 index 0000000000..60d356c64c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushRequest.java @@ -0,0 +1,439 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.ExpandWildcard; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.flush.Request + +/** + * Performs the flush operation on one or more indexes. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FlushRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Boolean allowNoIndices; + + @Nonnull + private final List expandWildcards; + + @Nullable + private final Boolean force; + + @Nullable + private final Boolean ignoreUnavailable; + + @Nonnull + private final List index; + + @Nullable + private final Boolean waitIfOngoing; + + // --------------------------------------------------------------------------------------------- + + private FlushRequest(Builder builder) { + this.allowNoIndices = builder.allowNoIndices; + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.force = builder.force; + this.ignoreUnavailable = builder.ignoreUnavailable; + this.index = ApiTypeHelper.unmodifiable(builder.index); + this.waitIfOngoing = builder.waitIfOngoing; + } + + public static FlushRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. + *

+ * API name: {@code allow_no_indices} + *

+ */ + @Nullable + public final Boolean allowNoIndices() { + return this.allowNoIndices; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ */ + @Nonnull + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * If true, the request forces a flush even if there are no changes to commit to the index. + *

+ * API name: {@code force} + *

+ */ + @Nullable + public final Boolean force() { + return this.force; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. + *

+ * API name: {@code ignore_unavailable} + *

+ */ + @Nullable + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; + } + + /** + * Comma-separated list of data streams, indexes, and aliases to flush. Supports wildcards (*). To flush all data streams + * and indexes, omit this parameter or use * or _all. + *

+ * API name: {@code index} + *

+ */ + @Nonnull + public final List index() { + return this.index; + } + + /** + * If true, the flush operation blocks until execution when another flush operation is running. If false, + * OpenSearch returns an error if you request a flush when another flush operation is running. + *

+ * API name: {@code wait_if_ongoing} + *

+ */ + @Nullable + public final Boolean waitIfOngoing() { + return this.waitIfOngoing; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link FlushRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean allowNoIndices; + @Nullable + private List expandWildcards; + @Nullable + private Boolean force; + @Nullable + private Boolean ignoreUnavailable; + @Nullable + private List index; + @Nullable + private Boolean waitIfOngoing; + + public Builder() {} + + private Builder(FlushRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.force = o.force; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.waitIfOngoing = o.waitIfOngoing; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.force = o.force; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.waitIfOngoing = o.waitIfOngoing; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. + *

+ * API name: {@code allow_no_indices} + *

+ */ + @Nonnull + public final Builder allowNoIndices(@Nullable Boolean value) { + this.allowNoIndices = value; + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ * + *

+ * Adds all elements of list to expandWildcards. + *

+ */ + @Nonnull + public final Builder expandWildcards(List list) { + this.expandWildcards = _listAddAll(this.expandWildcards, list); + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ * + *

+ * Adds one or more values to expandWildcards. + *

+ */ + @Nonnull + public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { + this.expandWildcards = _listAdd(this.expandWildcards, value, values); + return this; + } + + /** + * If true, the request forces a flush even if there are no changes to commit to the index. + *

+ * API name: {@code force} + *

+ */ + @Nonnull + public final Builder force(@Nullable Boolean value) { + this.force = value; + return this; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. + *

+ * API name: {@code ignore_unavailable} + *

+ */ + @Nonnull + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; + } + + /** + * Comma-separated list of data streams, indexes, and aliases to flush. Supports wildcards (*). To flush all data + * streams and indexes, omit this parameter or use * or _all. + *

+ * API name: {@code index} + *

+ * + *

+ * Adds all elements of list to index. + *

+ */ + @Nonnull + public final Builder index(List list) { + this.index = _listAddAll(this.index, list); + return this; + } + + /** + * Comma-separated list of data streams, indexes, and aliases to flush. Supports wildcards (*). To flush all data + * streams and indexes, omit this parameter or use * or _all. + *

+ * API name: {@code index} + *

+ * + *

+ * Adds one or more values to index. + *

+ */ + @Nonnull + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); + return this; + } + + /** + * If true, the flush operation blocks until execution when another flush operation is running. If false, + * OpenSearch returns an error if you request a flush when another flush operation is running. + *

+ * API name: {@code wait_if_ongoing} + *

+ */ + @Nonnull + public final Builder waitIfOngoing(@Nullable Boolean value) { + this.waitIfOngoing = value; + return this; + } + + /** + * Builds a {@link FlushRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public FlushRequest build() { + _checkSingleUse(); + + return new FlushRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.flush}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + final int _index = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; + + if (propsSet == 0) { + return "/_flush"; + } + if (propsSet == (_index)) { + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_flush"); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + } + if (request.force != null) { + params.put("force", String.valueOf(request.force)); + } + if (request.ignoreUnavailable != null) { + params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); + } + if (request.waitIfOngoing != null) { + params.put("wait_if_ongoing", String.valueOf(request.waitIfOngoing)); + } + return params; + }, + SimpleEndpoint.emptyMap(), + false, + FlushResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.force); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.waitIfOngoing); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FlushRequest other = (FlushRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.force, other.force) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.waitIfOngoing, other.waitIfOngoing); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushResponse.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushResponse.java index 28e99a9077..f1330e8848 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FlushResponse.java @@ -30,39 +30,78 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.ShardsOperationResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.flush.Response @JsonpDeserializable -public class FlushResponse extends ShardsOperationResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FlushResponse extends ShardsOperationResponseBase implements ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private FlushResponse(Builder builder) { super(builder); - } - public static FlushResponse of(Function> fn) { + public static FlushResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FlushResponse}. */ + public static class Builder extends ShardsOperationResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(FlushResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends ShardsOperationResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +109,10 @@ protected Builder self() { /** * Builds a {@link FlushResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FlushResponse build() { _checkSingleUse(); @@ -91,8 +131,22 @@ public FlushResponse build() { ); protected static void setupFlushResponseDeserializer(ObjectDeserializer op) { - ShardsOperationResponseBase.setupShardsOperationResponseBaseDeserializer(op); + setupShardsOperationResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java index 16d521bef9..7fe66f814a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,20 +51,23 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.forcemerge.Request /** - * Performs the force merge operation on one or more indices. - * + * Performs the force merge operation on one or more indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ForcemergeRequest extends RequestBase implements ToCopyableBuilder { -public class ForcemergeRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable @@ -66,6 +76,7 @@ public class ForcemergeRequest extends RequestBase { @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -74,10 +85,15 @@ public class ForcemergeRequest extends RequestBase { @Nullable private final Boolean onlyExpungeDeletes; + @Nullable + private final Boolean primaryOnly; + + @Nullable + private final Boolean waitForCompletion; + // --------------------------------------------------------------------------------------------- private ForcemergeRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.flush = builder.flush; @@ -85,19 +101,20 @@ private ForcemergeRequest(Builder builder) { this.index = ApiTypeHelper.unmodifiable(builder.index); this.maxNumSegments = builder.maxNumSegments; this.onlyExpungeDeletes = builder.onlyExpungeDeletes; - + this.primaryOnly = builder.primaryOnly; + this.waitForCompletion = builder.waitForCompletion; } - public static ForcemergeRequest of(Function> fn) { + public static ForcemergeRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or when + * no indexes have been specified) *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -105,20 +122,21 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Specify whether the index should be flushed after performing the operation - * (default: true) + * Specify whether the index should be flushed after performing the operation. *

* API name: {@code flush} + *

*/ @Nullable public final Boolean flush() { @@ -126,10 +144,10 @@ public final Boolean flush() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed) *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -137,19 +155,22 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * The number of segments the index should be merged into (default: dynamic) + * The number of larger segments into which smaller segments are merged. Set this parameter to 1 to merge all segments into one segment. + * The default behavior is to perform the merge as necessary. *

* API name: {@code max_num_segments} + *

*/ @Nullable public final Long maxNumSegments() { @@ -160,131 +181,212 @@ public final Long maxNumSegments() { * Specify whether the operation should only expunge deleted documents *

* API name: {@code only_expunge_deletes} + *

*/ @Nullable public final Boolean onlyExpungeDeletes() { return this.onlyExpungeDeletes; } + /** + * Specify whether the operation should only perform on primary shards. Defaults to false. + *

+ * API name: {@code primary_only} + *

+ */ + @Nullable + public final Boolean primaryOnly() { + return this.primaryOnly; + } + + /** + * Should the request wait until the force merge is completed. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ForcemergeRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean flush; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Long maxNumSegments; - @Nullable private Boolean onlyExpungeDeletes; + @Nullable + private Boolean primaryOnly; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(ForcemergeRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flush = o.flush; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.maxNumSegments = o.maxNumSegments; + this.onlyExpungeDeletes = o.onlyExpungeDeletes; + this.primaryOnly = o.primaryOnly; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flush = o.flush; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.maxNumSegments = o.maxNumSegments; + this.onlyExpungeDeletes = o.onlyExpungeDeletes; + this.primaryOnly = o.primaryOnly; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or + * when no indexes have been specified) *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Specify whether the index should be flushed after performing the operation - * (default: true) + * Specify whether the index should be flushed after performing the operation. *

* API name: {@code flush} + *

*/ + @Nonnull public final Builder flush(@Nullable Boolean value) { this.flush = value; return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed) *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * The number of segments the index should be merged into (default: dynamic) + * The number of larger segments into which smaller segments are merged. Set this parameter to 1 to merge all segments into one + * segment. The default behavior is to perform the merge as necessary. *

* API name: {@code max_num_segments} + *

*/ + @Nonnull public final Builder maxNumSegments(@Nullable Long value) { this.maxNumSegments = value; return this; @@ -294,18 +396,45 @@ public final Builder maxNumSegments(@Nullable Long value) { * Specify whether the operation should only expunge deleted documents *

* API name: {@code only_expunge_deletes} + *

*/ + @Nonnull public final Builder onlyExpungeDeletes(@Nullable Boolean value) { this.onlyExpungeDeletes = value; return this; } + /** + * Specify whether the operation should only perform on primary shards. Defaults to false. + *

+ * API name: {@code primary_only} + *

+ */ + @Nonnull + public final Builder primaryOnly(@Nullable Boolean value) { + this.primaryOnly = value; + return this; + } + + /** + * Should the request wait until the force merge is completed. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; + } + /** * Builds a {@link ForcemergeRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ForcemergeRequest build() { _checkSingleUse(); @@ -319,13 +448,8 @@ public ForcemergeRequest build() { * Endpoint "{@code indices.forcemerge}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _index = 1 << 0; @@ -335,47 +459,80 @@ public ForcemergeRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_forcemerge"); - return buf.toString(); + return "/_forcemerge"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_forcemerge"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.flush != null) { - params.put("flush", String.valueOf(request.flush)); - } - if (request.onlyExpungeDeletes != null) { - params.put("only_expunge_deletes", String.valueOf(request.onlyExpungeDeletes)); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.flush != null) { + params.put("flush", String.valueOf(request.flush)); + } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (request.maxNumSegments != null) { params.put("max_num_segments", String.valueOf(request.maxNumSegments)); } + if (request.onlyExpungeDeletes != null) { + params.put("only_expunge_deletes", String.valueOf(request.onlyExpungeDeletes)); + } + if (request.primaryOnly != null) { + params.put("primary_only", String.valueOf(request.primaryOnly)); + } + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + } return params; - }, SimpleEndpoint.emptyMap(), false, ForcemergeResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.flush); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.maxNumSegments); + result = 31 * result + Objects.hashCode(this.onlyExpungeDeletes); + result = 31 * result + Objects.hashCode(this.primaryOnly); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ForcemergeRequest other = (ForcemergeRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.flush, other.flush) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.maxNumSegments, other.maxNumSegments) + && Objects.equals(this.onlyExpungeDeletes, other.onlyExpungeDeletes) + && Objects.equals(this.primaryOnly, other.primaryOnly) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java new file mode 100644 index 0000000000..b6f6159861 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java @@ -0,0 +1,202 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.ShardsOperationResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.forcemerge.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ForcemergeResponse extends ShardsOperationResponseBase + implements + ToCopyableBuilder { + + @Nullable + private final String task; + + // --------------------------------------------------------------------------------------------- + + private ForcemergeResponse(Builder builder) { + super(builder); + this.task = builder.task; + } + + public static ForcemergeResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Task contains a task id returned when wait_for_completion=false, you can use the task_id to get the status + * of the task at _tasks/<task_id>. + *

+ * API name: {@code task} + *

+ */ + @Nullable + public final String task() { + return this.task; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.task != null) { + generator.writeKey("task"); + generator.write(this.task); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ForcemergeResponse}. + */ + public static class Builder extends ShardsOperationResponseBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private String task; + + public Builder() {} + + private Builder(ForcemergeResponse o) { + super(o); + this.task = o.task; + } + + private Builder(Builder o) { + super(o); + this.task = o.task; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Task contains a task id returned when wait_for_completion=false, you can use the task_id to get the + * status of the task at _tasks/<task_id>. + *

+ * API name: {@code task} + *

+ */ + @Nonnull + public final Builder task(@Nullable String value) { + this.task = value; + return this; + } + + /** + * Builds a {@link ForcemergeResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ForcemergeResponse build() { + _checkSingleUse(); + + return new ForcemergeResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ForcemergeResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ForcemergeResponse::setupForcemergeResponseDeserializer + ); + + protected static void setupForcemergeResponseDeserializer(ObjectDeserializer op) { + setupShardsOperationResponseBaseDeserializer(op); + op.add(Builder::task, JsonpDeserializer.stringDeserializer(), "task"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.task); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ForcemergeResponse other = (ForcemergeResponse) o; + return Objects.equals(this.task, other.task); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java index 330af6a6d0..6da869c3fc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,56 +51,50 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: indices.flush.Request +// typedef: indices.get_upgrade.Request /** - * Performs the flush operation on one or more indices. - * + * The _upgrade API is no longer useful and will be removed. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetUpgradeRequest extends RequestBase implements ToCopyableBuilder { -public class FlushRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; - @Nullable - private final Boolean force; - @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; - @Nullable - private final Boolean waitIfOngoing; - // --------------------------------------------------------------------------------------------- - private FlushRequest(Builder builder) { - + private GetUpgradeRequest(Builder builder) { this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.force = builder.force; this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); - this.waitIfOngoing = builder.waitIfOngoing; - } - public static FlushRequest of(Function> fn) { + public static GetUpgradeRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or when + * no indexes have been specified). *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -101,33 +102,21 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether a flush should be forced even if it is not necessarily needed ie. if - * no changes will be committed to the index. This is useful if transaction log - * IDs should be incremented even if no uncommitted changes are present. (This - * setting can be considered as internal) - *

- * API name: {@code force} - */ - @Nullable - public final Boolean force() { - return this.force; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -135,180 +124,175 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * for all indices + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } - /** - * If set to true the flush operation will block until the flush can be executed - * if another flush operation is already executing. The default is true. If set - * to false the flush will be skipped iff if another flush operation is already - * running. - *

- * API name: {@code wait_if_ongoing} - */ - @Nullable - public final Boolean waitIfOngoing() { - return this.waitIfOngoing; + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** - * Builder for {@link FlushRequest}. + * Builder for {@link GetUpgradeRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - - @Nullable - private Boolean force; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable - private Boolean waitIfOngoing; + public Builder() {} + + private Builder(GetUpgradeRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or + * when no indexes have been specified). *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether a flush should be forced even if it is not necessarily needed ie. if - * no changes will be committed to the index. This is useful if transaction log - * IDs should be incremented even if no uncommitted changes are present. (This - * setting can be considered as internal) - *

- * API name: {@code force} - */ - public final Builder force(@Nullable Boolean value) { - this.force = value; - return this; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * for all indices + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * for all indices + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * If set to true the flush operation will block until the flush can be executed - * if another flush operation is already executing. The default is true. If set - * to false the flush will be skipped iff if another flush operation is already - * running. - *

- * API name: {@code wait_if_ongoing} - */ - public final Builder waitIfOngoing(@Nullable Boolean value) { - this.waitIfOngoing = value; - return this; - } - - /** - * Builds a {@link FlushRequest}. + * Builds a {@link GetUpgradeRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ - public FlushRequest build() { + @Override + @Nonnull + public GetUpgradeRequest build() { _checkSingleUse(); - return new FlushRequest(this); + return new GetUpgradeRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Endpoint "{@code indices.flush}". + * Endpoint "{@code indices.get_upgrade}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( // Request method - request -> { - return "POST"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -318,44 +302,55 @@ public FlushRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_flush"); - return buf.toString(); + return "/_upgrade"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_flush"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_upgrade"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.force != null) { - params.put("force", String.valueOf(request.force)); - } - if (request.waitIfOngoing != null) { - params.put("wait_if_ongoing", String.valueOf(request.waitIfOngoing)); - } return params; - }, SimpleEndpoint.emptyMap(), false, - FlushResponse._DESERIALIZER + GetUpgradeResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetUpgradeRequest other = (GetUpgradeRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java new file mode 100644 index 0000000000..14fd2be36f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java @@ -0,0 +1,322 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.get_upgrade.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetUpgradeResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map indices; + + @Nullable + private final Long sizeInBytes; + + @Nullable + private final Long sizeToUpgradeAncientInBytes; + + @Nullable + private final Long sizeToUpgradeInBytes; + + // --------------------------------------------------------------------------------------------- + + private GetUpgradeResponse(Builder builder) { + this.indices = ApiTypeHelper.unmodifiable(builder.indices); + this.sizeInBytes = builder.sizeInBytes; + this.sizeToUpgradeAncientInBytes = builder.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = builder.sizeToUpgradeInBytes; + } + + public static GetUpgradeResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code indices} + */ + @Nonnull + public final Map indices() { + return this.indices; + } + + /** + * API name: {@code size_in_bytes} + */ + @Nullable + public final Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * API name: {@code size_to_upgrade_ancient_in_bytes} + */ + @Nullable + public final Long sizeToUpgradeAncientInBytes() { + return this.sizeToUpgradeAncientInBytes; + } + + /** + * API name: {@code size_to_upgrade_in_bytes} + */ + @Nullable + public final Long sizeToUpgradeInBytes() { + return this.sizeToUpgradeInBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.indices)) { + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.sizeInBytes != null) { + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + } + + if (this.sizeToUpgradeAncientInBytes != null) { + generator.writeKey("size_to_upgrade_ancient_in_bytes"); + generator.write(this.sizeToUpgradeAncientInBytes); + } + + if (this.sizeToUpgradeInBytes != null) { + generator.writeKey("size_to_upgrade_in_bytes"); + generator.write(this.sizeToUpgradeInBytes); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetUpgradeResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map indices; + @Nullable + private Long sizeInBytes; + @Nullable + private Long sizeToUpgradeAncientInBytes; + @Nullable + private Long sizeToUpgradeInBytes; + + public Builder() {} + + private Builder(GetUpgradeResponse o) { + this.indices = _mapCopy(o.indices); + this.sizeInBytes = o.sizeInBytes; + this.sizeToUpgradeAncientInBytes = o.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = o.sizeToUpgradeInBytes; + } + + private Builder(Builder o) { + this.indices = _mapCopy(o.indices); + this.sizeInBytes = o.sizeInBytes; + this.sizeToUpgradeAncientInBytes = o.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = o.sizeToUpgradeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code indices} + * + *

+ * Adds all elements of map to indices. + *

+ */ + @Nonnull + public final Builder indices(Map map) { + this.indices = _mapPutAll(this.indices, map); + return this; + } + + /** + * API name: {@code indices} + * + *

+ * Adds an entry to indices. + *

+ */ + @Nonnull + public final Builder indices(String key, UpgradeStatus value) { + this.indices = _mapPut(this.indices, key, value); + return this; + } + + /** + * API name: {@code indices} + * + *

+ * Adds a value to indices using a builder lambda. + *

+ */ + @Nonnull + public final Builder indices(String key, Function> fn) { + return indices(key, fn.apply(new UpgradeStatus.Builder()).build()); + } + + /** + * API name: {@code size_in_bytes} + */ + @Nonnull + public final Builder sizeInBytes(@Nullable Long value) { + this.sizeInBytes = value; + return this; + } + + /** + * API name: {@code size_to_upgrade_ancient_in_bytes} + */ + @Nonnull + public final Builder sizeToUpgradeAncientInBytes(@Nullable Long value) { + this.sizeToUpgradeAncientInBytes = value; + return this; + } + + /** + * API name: {@code size_to_upgrade_in_bytes} + */ + @Nonnull + public final Builder sizeToUpgradeInBytes(@Nullable Long value) { + this.sizeToUpgradeInBytes = value; + return this; + } + + /** + * Builds a {@link GetUpgradeResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetUpgradeResponse build() { + _checkSingleUse(); + + return new GetUpgradeResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetUpgradeResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetUpgradeResponse::setupGetUpgradeResponseDeserializer + ); + + protected static void setupGetUpgradeResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(UpgradeStatus._DESERIALIZER), "indices"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + op.add(Builder::sizeToUpgradeAncientInBytes, JsonpDeserializer.longDeserializer(), "size_to_upgrade_ancient_in_bytes"); + op.add(Builder::sizeToUpgradeInBytes, JsonpDeserializer.longDeserializer(), "size_to_upgrade_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.indices); + result = 31 * result + Objects.hashCode(this.sizeInBytes); + result = 31 * result + Objects.hashCode(this.sizeToUpgradeAncientInBytes); + result = 31 * result + Objects.hashCode(this.sizeToUpgradeInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetUpgradeResponse other = (GetUpgradeResponse) o; + return Objects.equals(this.indices, other.indices) + && Objects.equals(this.sizeInBytes, other.sizeInBytes) + && Objects.equals(this.sizeToUpgradeAncientInBytes, other.sizeToUpgradeAncientInBytes) + && Objects.equals(this.sizeToUpgradeInBytes, other.sizeToUpgradeInBytes); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java index 29a3f10078..0645cd1493 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java @@ -30,43 +30,58 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.Level; import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch.indices.stats.IndicesStatsMetric; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.Request /** * Provides statistics on operations happening in an index. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesStatsRequest extends RequestBase implements ToCopyableBuilder { -public class IndicesStatsRequest extends RequestBase { + @Nonnull private final List completionFields; + @Nonnull private final List expandWildcards; + @Nonnull private final List fielddataFields; + @Nonnull private final List fields; @Nullable private final Boolean forbidClosedIndices; + @Nonnull private final List groups; @Nullable @@ -75,19 +90,18 @@ public class IndicesStatsRequest extends RequestBase { @Nullable private final Boolean includeUnloadedSegments; + @Nonnull private final List index; @Nullable private final Level level; - private final List metric; - - private final List types; + @Nonnull + private final List metric; // --------------------------------------------------------------------------------------------- private IndicesStatsRequest(Builder builder) { - this.completionFields = ApiTypeHelper.unmodifiable(builder.completionFields); this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.fielddataFields = ApiTypeHelper.unmodifiable(builder.fielddataFields); @@ -99,59 +113,62 @@ private IndicesStatsRequest(Builder builder) { this.index = ApiTypeHelper.unmodifiable(builder.index); this.level = builder.level; this.metric = ApiTypeHelper.unmodifiable(builder.metric); - this.types = ApiTypeHelper.unmodifiable(builder.types); - } - public static IndicesStatsRequest of(Function> fn) { + public static IndicesStatsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * A comma-separated list of fields for fielddata and - * suggest index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data and suggest statistics. *

* API name: {@code completion_fields} + *

*/ + @Nonnull public final List completionFields() { return this.completionFields; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * A comma-separated list of fields for fielddata index metric - * (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data statistics. *

* API name: {@code fielddata_fields} + *

*/ + @Nonnull public final List fielddataFields() { return this.fielddataFields; } /** - * A comma-separated list of fields for fielddata and - * completion index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in the statistics. *

* API name: {@code fields} + *

*/ + @Nonnull public final List fields() { return this.fields; } /** - * If set to false stats will also collected from closed indices if explicitly - * specified or if expand_wildcards expands to closed indices + * If true, statistics are not collected from closed indexes. *

* API name: {@code forbid_closed_indices} + *

*/ @Nullable public final Boolean forbidClosedIndices() { @@ -159,19 +176,22 @@ public final Boolean forbidClosedIndices() { } /** - * A comma-separated list of search groups for search index metric + * Comma-separated list of search groups to include in the search statistics. *

* API name: {@code groups} + *

*/ + @Nonnull public final List groups() { return this.groups; } /** - * Whether to report the aggregated disk usage of each one of the Lucene index - * files (only applies if segment stats are requested) + * If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats + * are requested). *

* API name: {@code include_segment_file_sizes} + *

*/ @Nullable public final Boolean includeSegmentFileSizes() { @@ -179,10 +199,10 @@ public final Boolean includeSegmentFileSizes() { } /** - * If set to true segment stats will include stats for segments that are not - * currently loaded into memory + * If true, the response includes information from segments that are not loaded into memory. *

* API name: {@code include_unloaded_segments} + *

*/ @Nullable public final Boolean includeUnloadedSegments() { @@ -190,19 +210,21 @@ public final Boolean includeUnloadedSegments() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Return stats aggregated at cluster, index or shard level + * Indicates whether statistics are aggregated at the cluster, index, or shard level. *

* API name: {@code level} + *

*/ @Nullable public final Level level() { @@ -213,256 +235,327 @@ public final Level level() { * Limit the information returned the specific metrics. *

* API name: {@code metric} + *

*/ - public final List metric() { + @Nonnull + public final List metric() { return this.metric; } - /** - * A comma-separated list of document types for the indexing index - * metric - *

- * API name: {@code types} - */ - public final List types() { - return this.types; + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link IndicesStatsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List completionFields; - @Nullable private List expandWildcards; - @Nullable private List fielddataFields; - @Nullable private List fields; - @Nullable private Boolean forbidClosedIndices; - @Nullable private List groups; - @Nullable private Boolean includeSegmentFileSizes; - @Nullable private Boolean includeUnloadedSegments; - @Nullable private List index; - @Nullable private Level level; - @Nullable - private List metric; + private List metric; + + public Builder() {} + + private Builder(IndicesStatsRequest o) { + this.completionFields = _listCopy(o.completionFields); + this.expandWildcards = _listCopy(o.expandWildcards); + this.fielddataFields = _listCopy(o.fielddataFields); + this.fields = _listCopy(o.fields); + this.forbidClosedIndices = o.forbidClosedIndices; + this.groups = _listCopy(o.groups); + this.includeSegmentFileSizes = o.includeSegmentFileSizes; + this.includeUnloadedSegments = o.includeUnloadedSegments; + this.index = _listCopy(o.index); + this.level = o.level; + this.metric = _listCopy(o.metric); + } - @Nullable - private List types; + private Builder(Builder o) { + this.completionFields = _listCopy(o.completionFields); + this.expandWildcards = _listCopy(o.expandWildcards); + this.fielddataFields = _listCopy(o.fielddataFields); + this.fields = _listCopy(o.fields); + this.forbidClosedIndices = o.forbidClosedIndices; + this.groups = _listCopy(o.groups); + this.includeSegmentFileSizes = o.includeSegmentFileSizes; + this.includeUnloadedSegments = o.includeUnloadedSegments; + this.index = _listCopy(o.index); + this.level = o.level; + this.metric = _listCopy(o.metric); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * A comma-separated list of fields for fielddata and - * suggest index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data and suggest statistics. *

* API name: {@code completion_fields} + *

+ * *

* Adds all elements of list to completionFields. + *

*/ + @Nonnull public final Builder completionFields(List list) { this.completionFields = _listAddAll(this.completionFields, list); return this; } /** - * A comma-separated list of fields for fielddata and - * suggest index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data and suggest statistics. *

* API name: {@code completion_fields} + *

+ * *

* Adds one or more values to completionFields. + *

*/ + @Nonnull public final Builder completionFields(String value, String... values) { this.completionFields = _listAdd(this.completionFields, value, values); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * A comma-separated list of fields for fielddata index metric - * (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data statistics. *

* API name: {@code fielddata_fields} + *

+ * *

* Adds all elements of list to fielddataFields. + *

*/ + @Nonnull public final Builder fielddataFields(List list) { this.fielddataFields = _listAddAll(this.fielddataFields, list); return this; } /** - * A comma-separated list of fields for fielddata index metric - * (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in field data statistics. *

* API name: {@code fielddata_fields} + *

+ * *

* Adds one or more values to fielddataFields. + *

*/ + @Nonnull public final Builder fielddataFields(String value, String... values) { this.fielddataFields = _listAdd(this.fielddataFields, value, values); return this; } /** - * A comma-separated list of fields for fielddata and - * completion index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in the statistics. *

* API name: {@code fields} + *

+ * *

* Adds all elements of list to fields. + *

*/ + @Nonnull public final Builder fields(List list) { this.fields = _listAddAll(this.fields, list); return this; } /** - * A comma-separated list of fields for fielddata and - * completion index metric (supports wildcards) + * Comma-separated list or wildcard expressions of fields to include in the statistics. *

* API name: {@code fields} + *

+ * *

* Adds one or more values to fields. + *

*/ + @Nonnull public final Builder fields(String value, String... values) { this.fields = _listAdd(this.fields, value, values); return this; } /** - * If set to false stats will also collected from closed indices if explicitly - * specified or if expand_wildcards expands to closed indices + * If true, statistics are not collected from closed indexes. *

* API name: {@code forbid_closed_indices} + *

*/ + @Nonnull public final Builder forbidClosedIndices(@Nullable Boolean value) { this.forbidClosedIndices = value; return this; } /** - * A comma-separated list of search groups for search index metric + * Comma-separated list of search groups to include in the search statistics. *

* API name: {@code groups} + *

+ * *

* Adds all elements of list to groups. + *

*/ + @Nonnull public final Builder groups(List list) { this.groups = _listAddAll(this.groups, list); return this; } /** - * A comma-separated list of search groups for search index metric + * Comma-separated list of search groups to include in the search statistics. *

* API name: {@code groups} + *

+ * *

* Adds one or more values to groups. + *

*/ + @Nonnull public final Builder groups(String value, String... values) { this.groups = _listAdd(this.groups, value, values); return this; } /** - * Whether to report the aggregated disk usage of each one of the Lucene index - * files (only applies if segment stats are requested) + * If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment + * stats are requested). *

* API name: {@code include_segment_file_sizes} + *

*/ + @Nonnull public final Builder includeSegmentFileSizes(@Nullable Boolean value) { this.includeSegmentFileSizes = value; return this; } /** - * If set to true segment stats will include stats for segments that are not - * currently loaded into memory + * If true, the response includes information from segments that are not loaded into memory. *

* API name: {@code include_unloaded_segments} + *

*/ + @Nonnull public final Builder includeUnloadedSegments(@Nullable Boolean value) { this.includeUnloadedSegments = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Return stats aggregated at cluster, index or shard level + * Indicates whether statistics are aggregated at the cluster, index, or shard level. *

* API name: {@code level} + *

*/ + @Nonnull public final Builder level(@Nullable Level value) { this.level = value; return this; @@ -472,10 +565,14 @@ public final Builder level(@Nullable Level value) { * Limit the information returned the specific metrics. *

* API name: {@code metric} + *

+ * *

* Adds all elements of list to metric. + *

*/ - public final Builder metric(List list) { + @Nonnull + public final Builder metric(List list) { this.metric = _listAddAll(this.metric, list); return this; } @@ -484,46 +581,25 @@ public final Builder metric(List list) { * Limit the information returned the specific metrics. *

* API name: {@code metric} + *

+ * *

* Adds one or more values to metric. + *

*/ - public final Builder metric(String value, String... values) { + @Nonnull + public final Builder metric(IndicesStatsMetric value, IndicesStatsMetric... values) { this.metric = _listAdd(this.metric, value, values); return this; } - /** - * A comma-separated list of document types for the indexing index - * metric - *

- * API name: {@code types} - *

- * Adds all elements of list to types. - */ - public final Builder types(List list) { - this.types = _listAddAll(this.types, list); - return this; - } - - /** - * A comma-separated list of document types for the indexing index - * metric - *

- * API name: {@code types} - *

- * Adds one or more values to types. - */ - public final Builder types(String value, String... values) { - this.types = _listAdd(this.types, value, values); - return this; - } - /** * Builds a {@link IndicesStatsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndicesStatsRequest build() { _checkSingleUse(); @@ -537,93 +613,114 @@ public IndicesStatsRequest build() { * Endpoint "{@code indices.stats}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { - final int _metric = 1 << 0; - final int _index = 1 << 1; + final int _index = 1 << 0; + final int _metric = 1 << 1; int propsSet = 0; - if (ApiTypeHelper.isDefined(request.metric())) propsSet |= _metric; if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; + if (ApiTypeHelper.isDefined(request.metric())) propsSet |= _metric; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_stats"); - return buf.toString(); - } - if (propsSet == (_metric)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_stats"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); + return "/_stats"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_stats"); return buf.toString(); } if (propsSet == (_index | _metric)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_stats"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_stats/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); + return buf.toString(); + } + if (propsSet == (_metric)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_stats/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.types)) { - params.put("types", request.types.stream().map(v -> v).collect(Collectors.joining(","))); + if (ApiTypeHelper.isDefined(request.completionFields)) { + params.put("completion_fields", String.join(",", request.completionFields)); } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } - if (request.level != null) { - params.put("level", request.level.jsonValue()); - } - if (ApiTypeHelper.isDefined(request.completionFields)) { - params.put("completion_fields", request.completionFields.stream().map(v -> v).collect(Collectors.joining(","))); - } if (ApiTypeHelper.isDefined(request.fielddataFields)) { - params.put("fielddata_fields", request.fielddataFields.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (ApiTypeHelper.isDefined(request.groups)) { - params.put("groups", request.groups.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (request.includeUnloadedSegments != null) { - params.put("include_unloaded_segments", String.valueOf(request.includeUnloadedSegments)); + params.put("fielddata_fields", String.join(",", request.fielddataFields)); } if (ApiTypeHelper.isDefined(request.fields)) { - params.put("fields", request.fields.stream().map(v -> v).collect(Collectors.joining(","))); + params.put("fields", String.join(",", request.fields)); } if (request.forbidClosedIndices != null) { params.put("forbid_closed_indices", String.valueOf(request.forbidClosedIndices)); } + if (ApiTypeHelper.isDefined(request.groups)) { + params.put("groups", String.join(",", request.groups)); + } if (request.includeSegmentFileSizes != null) { params.put("include_segment_file_sizes", String.valueOf(request.includeSegmentFileSizes)); } + if (request.includeUnloadedSegments != null) { + params.put("include_unloaded_segments", String.valueOf(request.includeUnloadedSegments)); + } + if (request.level != null) { + params.put("level", request.level.jsonValue()); + } return params; - }, SimpleEndpoint.emptyMap(), false, IndicesStatsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.completionFields); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.fielddataFields); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.forbidClosedIndices); + result = 31 * result + Objects.hashCode(this.groups); + result = 31 * result + Objects.hashCode(this.includeSegmentFileSizes); + result = 31 * result + Objects.hashCode(this.includeUnloadedSegments); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.level); + result = 31 * result + Objects.hashCode(this.metric); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesStatsRequest other = (IndicesStatsRequest) o; + return Objects.equals(this.completionFields, other.completionFields) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.fielddataFields, other.fielddataFields) + && Objects.equals(this.fields, other.fields) + && Objects.equals(this.forbidClosedIndices, other.forbidClosedIndices) + && Objects.equals(this.groups, other.groups) + && Objects.equals(this.includeSegmentFileSizes, other.includeSegmentFileSizes) + && Objects.equals(this.includeUnloadedSegments, other.includeUnloadedSegments) + && Objects.equals(this.index, other.index) + && Objects.equals(this.level, other.level) + && Objects.equals(this.metric, other.metric); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java index e2f40cb537..57d25b5705 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/IndicesStatsResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,38 +50,53 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch.indices.stats.AllIndicesStats; import org.opensearch.client.opensearch.indices.stats.IndicesStats; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.Response @JsonpDeserializable -public class IndicesStatsResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesStatsResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final AllIndicesStats all; + + @Nonnull private final Map indices; + @Nonnull private final ShardStatistics shards; - private final IndicesStats all; - // --------------------------------------------------------------------------------------------- private IndicesStatsResponse(Builder builder) { - + this.all = ApiTypeHelper.requireNonNull(builder.all, this, "all"); this.indices = ApiTypeHelper.unmodifiable(builder.indices); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - this.all = ApiTypeHelper.requireNonNull(builder.all, this, "all"); - } - public static IndicesStatsResponse of(Function> fn) { + public static IndicesStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - API name: {@code _all} + */ + @Nonnull + public final AllIndicesStats all() { + return this.all; + } + /** * API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -82,20 +104,15 @@ public final Map indices() { /** * Required - API name: {@code _shards} */ + @Nonnull public final ShardStatistics shards() { return this.shards; } - /** - * Required - API name: {@code _all} - */ - public final IndicesStats all() { - return this.all; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -103,6 +120,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("_all"); + this.all.serialize(generator, mapper); if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); @@ -110,38 +129,81 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.indices.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + generator.writeKey("_shards"); this.shards.serialize(generator, mapper); + } - generator.writeKey("_all"); - this.all.serialize(generator, mapper); + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link IndicesStatsResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private AllIndicesStats all; @Nullable private Map indices; - private ShardStatistics shards; - private IndicesStats all; + public Builder() {} + + private Builder(IndicesStatsResponse o) { + this.all = o.all; + this.indices = _mapCopy(o.indices); + this.shards = o.shards; + } + + private Builder(Builder o) { + this.all = o.all; + this.indices = _mapCopy(o.indices); + this.shards = o.shards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code _all} + */ + @Nonnull + public final Builder all(AllIndicesStats value) { + this.all = value; + return this; + } + + /** + * Required - API name: {@code _all} + */ + @Nonnull + public final Builder all(Function> fn) { + return all(fn.apply(new AllIndicesStats.Builder()).build()); + } /** * API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -149,9 +211,12 @@ public final Builder indices(Map map) { /** * API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, IndicesStats value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -159,9 +224,12 @@ public final Builder indices(String key, IndicesStats value) { /** * API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new IndicesStats.Builder()).build()); } @@ -169,6 +237,7 @@ public final Builder indices(String key, Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - /** - * Required - API name: {@code _all} - */ - public final Builder all(IndicesStats value) { - this.all = value; - return this; - } - - /** - * Required - API name: {@code _all} - */ - public final Builder all(Function> fn) { - return this.all(fn.apply(new IndicesStats.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } /** * Builds a {@link IndicesStatsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndicesStatsResponse build() { _checkSingleUse(); @@ -220,11 +276,25 @@ public IndicesStatsResponse build() { ); protected static void setupIndicesStatsResponseDeserializer(ObjectDeserializer op) { - + op.add(Builder::all, AllIndicesStats._DESERIALIZER, "_all"); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(IndicesStats._DESERIALIZER), "indices"); op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - op.add(Builder::all, IndicesStats._DESERIALIZER, "_all"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.all.hashCode(); + result = 31 * result + Objects.hashCode(this.indices); + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesStatsResponse other = (IndicesStatsResponse) o; + return this.all.equals(other.all) && Objects.equals(this.indices, other.indices) && this.shards.equals(other.shards); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenRequest.java new file mode 100644 index 0000000000..1075d20220 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenRequest.java @@ -0,0 +1,640 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.ExpandWildcard; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch._types.WaitForActiveShards; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.open.Request + +/** + * Opens an index. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Boolean allowNoIndices; + + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull + private final List expandWildcards; + + @Nullable + private final Boolean ignoreUnavailable; + + @Nonnull + private final List index; + + @Deprecated + @Nullable + private final Time masterTimeout; + + @Nullable + private final Time taskExecutionTimeout; + + @Nullable + private final Time timeout; + + @Nullable + private final WaitForActiveShards waitForActiveShards; + + @Nullable + private final Boolean waitForCompletion; + + // --------------------------------------------------------------------------------------------- + + private OpenRequest(Builder builder) { + this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.ignoreUnavailable = builder.ignoreUnavailable; + this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); + this.masterTimeout = builder.masterTimeout; + this.taskExecutionTimeout = builder.taskExecutionTimeout; + this.timeout = builder.timeout; + this.waitForActiveShards = builder.waitForActiveShards; + this.waitForCompletion = builder.waitForCompletion; + } + + public static OpenRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. + *

+ * API name: {@code allow_no_indices} + *

+ */ + @Nullable + public final Boolean allowNoIndices() { + return this.allowNoIndices; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ */ + @Nonnull + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. + *

+ * API name: {@code ignore_unavailable} + *

+ */ + @Nullable + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; + } + + /** + * Required - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). + * By default, you must explicitly name the indexes you using to limit the request. To limit a request using _all, + * *, or other wildcard expressions, change the action.destructive_requires_name setting to false. You can + * update this setting in the opensearch.yml file or using the cluster update settings API. + *

+ * API name: {@code index} + *

+ */ + @Nonnull + public final List index() { + return this.index; + } + + /** + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. + *

+ * API name: {@code master_timeout} + *

+ */ + @Deprecated + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nullable + public final Time taskExecutionTimeout() { + return this.taskExecutionTimeout; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + *

+ */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer + * up to the total number of shards in the index (number_of_replicas+1). + *

+ * API name: {@code wait_for_active_shards} + *

+ */ + @Nullable + public final WaitForActiveShards waitForActiveShards() { + return this.waitForActiveShards; + } + + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link OpenRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean allowNoIndices; + @Nullable + private Time clusterManagerTimeout; + @Nullable + private List expandWildcards; + @Nullable + private Boolean ignoreUnavailable; + private List index; + @Nullable + private Time masterTimeout; + @Nullable + private Time taskExecutionTimeout; + @Nullable + private Time timeout; + @Nullable + private WaitForActiveShards waitForActiveShards; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(OpenRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. + *

+ * API name: {@code allow_no_indices} + *

+ */ + @Nonnull + public final Builder allowNoIndices(@Nullable Boolean value) { + this.allowNoIndices = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ * + *

+ * Adds all elements of list to expandWildcards. + *

+ */ + @Nonnull + public final Builder expandWildcards(List list) { + this.expandWildcards = _listAddAll(this.expandWildcards, list); + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. + *

+ * API name: {@code expand_wildcards} + *

+ * + *

+ * Adds one or more values to expandWildcards. + *

+ */ + @Nonnull + public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { + this.expandWildcards = _listAdd(this.expandWildcards, value, values); + return this; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. + *

+ * API name: {@code ignore_unavailable} + *

+ */ + @Nonnull + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; + } + + /** + * Required - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards + * (*). By default, you must explicitly name the indexes you using to limit the request. To limit a request using + * _all, *, or other wildcard expressions, change the action.destructive_requires_name + * setting to false. You can update this setting in the opensearch.yml file or using the cluster update settings API. + *

+ * API name: {@code index} + *

+ * + *

+ * Adds all elements of list to index. + *

+ */ + @Nonnull + public final Builder index(List list) { + this.index = _listAddAll(this.index, list); + return this; + } + + /** + * Required - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards + * (*). By default, you must explicitly name the indexes you using to limit the request. To limit a request using + * _all, *, or other wildcard expressions, change the action.destructive_requires_name + * setting to false. You can update this setting in the opensearch.yml file or using the cluster update settings API. + *

+ * API name: {@code index} + *

+ * + *

+ * Adds one or more values to index. + *

+ */ + @Nonnull + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); + return this; + } + + /** + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. + *

+ * API name: {@code master_timeout} + *

+ */ + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. + *

+ * API name: {@code master_timeout} + *

+ */ + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(@Nullable Time value) { + this.taskExecutionTimeout = value; + return this; + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(Function> fn) { + return taskExecutionTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + *

+ */ + @Nonnull + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + *

+ */ + @Nonnull + public final Builder timeout(Function> fn) { + return timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). + *

+ * API name: {@code wait_for_active_shards} + *

+ */ + @Nonnull + public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { + this.waitForActiveShards = value; + return this; + } + + /** + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). + *

+ * API name: {@code wait_for_active_shards} + *

+ */ + @Nonnull + public final Builder waitForActiveShards(Function> fn) { + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + } + + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; + } + + /** + * Builds a {@link OpenRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public OpenRequest build() { + _checkSingleUse(); + + return new OpenRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.open}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_open"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + } + if (request.ignoreUnavailable != null) { + params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); + } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.taskExecutionTimeout != null) { + params.put("task_execution_timeout", request.taskExecutionTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + if (request.waitForActiveShards != null) { + params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); + } + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + } + return params; + }, + SimpleEndpoint.emptyMap(), + false, + OpenResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.taskExecutionTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + OpenRequest other = (OpenRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.taskExecutionTimeout, other.taskExecutionTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenResponse.java new file mode 100644 index 0000000000..d35acf3668 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenResponse.java @@ -0,0 +1,306 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.open.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Boolean acknowledged; + + @Nonnull + private final Map metadata; + + @Nullable + private final Boolean shardsAcknowledged; + + @Nullable + private final String task; + + // --------------------------------------------------------------------------------------------- + + private OpenResponse(Builder builder) { + this.acknowledged = builder.acknowledged; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + this.shardsAcknowledged = builder.shardsAcknowledged; + this.task = builder.task; + } + + public static OpenResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code acknowledged} + */ + @Nullable + public final Boolean acknowledged() { + return this.acknowledged; + } + + @Nonnull + public final Map metadata() { + return this.metadata; + } + + /** + * API name: {@code shards_acknowledged} + */ + @Nullable + public final Boolean shardsAcknowledged() { + return this.shardsAcknowledged; + } + + /** + * API name: {@code task} + */ + @Nullable + public final String task() { + return this.task; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + if (this.acknowledged != null) { + generator.writeKey("acknowledged"); + generator.write(this.acknowledged); + } + + if (this.shardsAcknowledged != null) { + generator.writeKey("shards_acknowledged"); + generator.write(this.shardsAcknowledged); + } + + if (this.task != null) { + generator.writeKey("task"); + generator.write(this.task); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link OpenResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean acknowledged; + @Nullable + private Map metadata; + @Nullable + private Boolean shardsAcknowledged; + @Nullable + private String task; + + public Builder() {} + + private Builder(OpenResponse o) { + this.acknowledged = o.acknowledged; + this.metadata = _mapCopy(o.metadata); + this.shardsAcknowledged = o.shardsAcknowledged; + this.task = o.task; + } + + private Builder(Builder o) { + this.acknowledged = o.acknowledged; + this.metadata = _mapCopy(o.metadata); + this.shardsAcknowledged = o.shardsAcknowledged; + this.task = o.task; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code acknowledged} + */ + @Nonnull + public final Builder acknowledged(@Nullable Boolean value) { + this.acknowledged = value; + return this; + } + + /** + * + *

+ * Adds all elements of map to metadata. + *

+ */ + @Nonnull + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * + *

+ * Adds an entry to metadata. + *

+ */ + @Nonnull + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * API name: {@code shards_acknowledged} + */ + @Nonnull + public final Builder shardsAcknowledged(@Nullable Boolean value) { + this.shardsAcknowledged = value; + return this; + } + + /** + * API name: {@code task} + */ + @Nonnull + public final Builder task(@Nullable String value) { + this.task = value; + return this; + } + + /** + * Builds a {@link OpenResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public OpenResponse build() { + _checkSingleUse(); + + return new OpenResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link OpenResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + OpenResponse::setupOpenResponseDeserializer + ); + + protected static void setupOpenResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); + op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + op.add(Builder::task, JsonpDeserializer.stringDeserializer(), "task"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.acknowledged); + result = 31 * result + Objects.hashCode(this.metadata); + result = 31 * result + Objects.hashCode(this.shardsAcknowledged); + result = 31 * result + Objects.hashCode(this.task); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + OpenResponse other = (OpenResponse) o; + return Objects.equals(this.acknowledged, other.acknowledged) + && Objects.equals(this.metadata, other.metadata) + && Objects.equals(this.shardsAcknowledged, other.shardsAcknowledged) + && Objects.equals(this.task, other.task); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java index 6ef9e102c2..e59cabf2d3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java @@ -130,6 +130,44 @@ public final CompletableFuture clearCache() throws IOExcepti return clearCache(new ClearCacheRequest.Builder().build()); } + // ----- Endpoint: indices.clone + + /** + * Clones an index. + */ + public CompletableFuture clone(CloneIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CloneIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones an index. + * + * @param fn a function that initializes a builder to create the {@link CloneIndexRequest} + */ + public final CompletableFuture clone(Function> fn) + throws IOException, OpenSearchException { + return clone(fn.apply(new CloneIndexRequest.Builder()).build()); + } + + // ----- Endpoint: indices.close + + /** + * Closes an index. + */ + public CompletableFuture close(CloseIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CloseIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Closes an index. + * + * @param fn a function that initializes a builder to create the {@link CloseIndexRequest} + */ + public final CompletableFuture close(Function> fn) + throws IOException, OpenSearchException { + return close(fn.apply(new CloseIndexRequest.Builder()).build()); + } + // ----- Endpoint: indices.create /** @@ -378,6 +416,58 @@ public final CompletableFuture existsTemplate( return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.flush + + /** + * Performs the flush operation on one or more indexes. + */ + public CompletableFuture flush(FlushRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, FlushRequest._ENDPOINT, this.transportOptions); + } + + /** + * Performs the flush operation on one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link FlushRequest} + */ + public final CompletableFuture flush(Function> fn) throws IOException, + OpenSearchException { + return flush(fn.apply(new FlushRequest.Builder()).build()); + } + + /** + * Performs the flush operation on one or more indexes. + */ + public final CompletableFuture flush() throws IOException, OpenSearchException { + return flush(new FlushRequest.Builder().build()); + } + + // ----- Endpoint: indices.forcemerge + + /** + * Performs the force merge operation on one or more indexes. + */ + public CompletableFuture forcemerge(ForcemergeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ForcemergeRequest._ENDPOINT, this.transportOptions); + } + + /** + * Performs the force merge operation on one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link ForcemergeRequest} + */ + public final CompletableFuture forcemerge(Function> fn) + throws IOException, OpenSearchException { + return forcemerge(fn.apply(new ForcemergeRequest.Builder()).build()); + } + + /** + * Performs the force merge operation on one or more indexes. + */ + public final CompletableFuture forcemerge() throws IOException, OpenSearchException { + return forcemerge(new ForcemergeRequest.Builder().build()); + } + // ----- Endpoint: indices.get /** @@ -559,6 +649,54 @@ public final CompletableFuture getTemplate() throws IOExcep return getTemplate(new GetTemplateRequest.Builder().build()); } + // ----- Endpoint: indices.get_upgrade + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public CompletableFuture getUpgrade(GetUpgradeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetUpgradeRequest._ENDPOINT, this.transportOptions); + } + + /** + * The _upgrade API is no longer useful and will be removed. + * + * @param fn a function that initializes a builder to create the {@link GetUpgradeRequest} + */ + @Deprecated + public final CompletableFuture getUpgrade(Function> fn) + throws IOException, OpenSearchException { + return getUpgrade(fn.apply(new GetUpgradeRequest.Builder()).build()); + } + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public final CompletableFuture getUpgrade() throws IOException, OpenSearchException { + return getUpgrade(new GetUpgradeRequest.Builder().build()); + } + + // ----- Endpoint: indices.open + + /** + * Opens an index. + */ + public CompletableFuture open(OpenRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, OpenRequest._ENDPOINT, this.transportOptions); + } + + /** + * Opens an index. + * + * @param fn a function that initializes a builder to create the {@link OpenRequest} + */ + public final CompletableFuture open(Function> fn) throws IOException, + OpenSearchException { + return open(fn.apply(new OpenRequest.Builder()).build()); + } + // ----- Endpoint: indices.put_alias /** @@ -666,6 +804,169 @@ public final CompletableFuture putTemplate( return putTemplate(fn.apply(new PutTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.recovery + + /** + * Returns information about ongoing index shard recoveries. + */ + public CompletableFuture recovery(RecoveryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RecoveryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about ongoing index shard recoveries. + * + * @param fn a function that initializes a builder to create the {@link RecoveryRequest} + */ + public final CompletableFuture recovery(Function> fn) + throws IOException, OpenSearchException { + return recovery(fn.apply(new RecoveryRequest.Builder()).build()); + } + + /** + * Returns information about ongoing index shard recoveries. + */ + public final CompletableFuture recovery() throws IOException, OpenSearchException { + return recovery(new RecoveryRequest.Builder().build()); + } + + // ----- Endpoint: indices.refresh + + /** + * Performs the refresh operation in one or more indexes. + */ + public CompletableFuture refresh(RefreshRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RefreshRequest._ENDPOINT, this.transportOptions); + } + + /** + * Performs the refresh operation in one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link RefreshRequest} + */ + public final CompletableFuture refresh(Function> fn) + throws IOException, OpenSearchException { + return refresh(fn.apply(new RefreshRequest.Builder()).build()); + } + + /** + * Performs the refresh operation in one or more indexes. + */ + public final CompletableFuture refresh() throws IOException, OpenSearchException { + return refresh(new RefreshRequest.Builder().build()); + } + + // ----- Endpoint: indices.resolve_index + + /** + * Returns information about any matching indexes, aliases, and data streams. + */ + public CompletableFuture resolveIndex(ResolveIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ResolveIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about any matching indexes, aliases, and data streams. + * + * @param fn a function that initializes a builder to create the {@link ResolveIndexRequest} + */ + public final CompletableFuture resolveIndex( + Function> fn + ) throws IOException, OpenSearchException { + return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); + } + + // ----- Endpoint: indices.rollover + + /** + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. + */ + public CompletableFuture rollover(RolloverRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RolloverRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. + * + * @param fn a function that initializes a builder to create the {@link RolloverRequest} + */ + public final CompletableFuture rollover(Function> fn) + throws IOException, OpenSearchException { + return rollover(fn.apply(new RolloverRequest.Builder()).build()); + } + + // ----- Endpoint: indices.segments + + /** + * Provides low-level information about segments in a Lucene index. + */ + public CompletableFuture segments(SegmentsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, SegmentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides low-level information about segments in a Lucene index. + * + * @param fn a function that initializes a builder to create the {@link SegmentsRequest} + */ + public final CompletableFuture segments(Function> fn) + throws IOException, OpenSearchException { + return segments(fn.apply(new SegmentsRequest.Builder()).build()); + } + + /** + * Provides low-level information about segments in a Lucene index. + */ + public final CompletableFuture segments() throws IOException, OpenSearchException { + return segments(new SegmentsRequest.Builder().build()); + } + + // ----- Endpoint: indices.shard_stores + + /** + * Provides store information for shard copies of indexes. + */ + public CompletableFuture shardStores(ShardStoresRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ShardStoresRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides store information for shard copies of indexes. + * + * @param fn a function that initializes a builder to create the {@link ShardStoresRequest} + */ + public final CompletableFuture shardStores( + Function> fn + ) throws IOException, OpenSearchException { + return shardStores(fn.apply(new ShardStoresRequest.Builder()).build()); + } + + /** + * Provides store information for shard copies of indexes. + */ + public final CompletableFuture shardStores() throws IOException, OpenSearchException { + return shardStores(new ShardStoresRequest.Builder().build()); + } + + // ----- Endpoint: indices.shrink + + /** + * Allow to shrink an existing index into a new index with fewer primary shards. + */ + public CompletableFuture shrink(ShrinkRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ShrinkRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allow to shrink an existing index into a new index with fewer primary shards. + * + * @param fn a function that initializes a builder to create the {@link ShrinkRequest} + */ + public final CompletableFuture shrink(Function> fn) + throws IOException, OpenSearchException { + return shrink(fn.apply(new ShrinkRequest.Builder()).build()); + } + // ----- Endpoint: indices.simulate_index_template /** @@ -708,6 +1009,51 @@ public final CompletableFuture simulateTemplate( return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.split + + /** + * Allows you to split an existing index into a new index with more primary shards. + */ + public CompletableFuture split(SplitRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, SplitRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allows you to split an existing index into a new index with more primary shards. + * + * @param fn a function that initializes a builder to create the {@link SplitRequest} + */ + public final CompletableFuture split(Function> fn) throws IOException, + OpenSearchException { + return split(fn.apply(new SplitRequest.Builder()).build()); + } + + // ----- Endpoint: indices.stats + + /** + * Provides statistics on operations happening in an index. + */ + public CompletableFuture stats(IndicesStatsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, IndicesStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides statistics on operations happening in an index. + * + * @param fn a function that initializes a builder to create the {@link IndicesStatsRequest} + */ + public final CompletableFuture stats(Function> fn) + throws IOException, OpenSearchException { + return stats(fn.apply(new IndicesStatsRequest.Builder()).build()); + } + + /** + * Provides statistics on operations happening in an index. + */ + public final CompletableFuture stats() throws IOException, OpenSearchException { + return stats(new IndicesStatsRequest.Builder().build()); + } + // ----- Endpoint: indices.update_aliases /** @@ -734,4 +1080,60 @@ public final CompletableFuture updateAliases( public final CompletableFuture updateAliases() throws IOException, OpenSearchException { return updateAliases(new UpdateAliasesRequest.Builder().build()); } + + // ----- Endpoint: indices.upgrade + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public CompletableFuture upgrade(UpgradeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UpgradeRequest._ENDPOINT, this.transportOptions); + } + + /** + * The _upgrade API is no longer useful and will be removed. + * + * @param fn a function that initializes a builder to create the {@link UpgradeRequest} + */ + @Deprecated + public final CompletableFuture upgrade(Function> fn) + throws IOException, OpenSearchException { + return upgrade(fn.apply(new UpgradeRequest.Builder()).build()); + } + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public final CompletableFuture upgrade() throws IOException, OpenSearchException { + return upgrade(new UpgradeRequest.Builder().build()); + } + + // ----- Endpoint: indices.validate_query + + /** + * Allows a user to validate a potentially expensive query without executing it. + */ + public CompletableFuture validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ValidateQueryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allows a user to validate a potentially expensive query without executing it. + * + * @param fn a function that initializes a builder to create the {@link ValidateQueryRequest} + */ + public final CompletableFuture validateQuery( + Function> fn + ) throws IOException, OpenSearchException { + return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); + } + + /** + * Allows a user to validate a potentially expensive query without executing it. + */ + public final CompletableFuture validateQuery() throws IOException, OpenSearchException { + return validateQuery(new ValidateQueryRequest.Builder().build()); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java index 129c1e0e6a..6bce3867f1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java @@ -129,6 +129,44 @@ public final ClearCacheResponse clearCache() throws IOException, OpenSearchExcep return clearCache(new ClearCacheRequest.Builder().build()); } + // ----- Endpoint: indices.clone + + /** + * Clones an index. + */ + public CloneIndexResponse clone(CloneIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CloneIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones an index. + * + * @param fn a function that initializes a builder to create the {@link CloneIndexRequest} + */ + public final CloneIndexResponse clone(Function> fn) throws IOException, + OpenSearchException { + return clone(fn.apply(new CloneIndexRequest.Builder()).build()); + } + + // ----- Endpoint: indices.close + + /** + * Closes an index. + */ + public CloseIndexResponse close(CloseIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CloseIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Closes an index. + * + * @param fn a function that initializes a builder to create the {@link CloseIndexRequest} + */ + public final CloseIndexResponse close(Function> fn) throws IOException, + OpenSearchException { + return close(fn.apply(new CloseIndexRequest.Builder()).build()); + } + // ----- Endpoint: indices.create /** @@ -369,6 +407,58 @@ public final BooleanResponse existsTemplate(Function> fn) throws IOException, + OpenSearchException { + return flush(fn.apply(new FlushRequest.Builder()).build()); + } + + /** + * Performs the flush operation on one or more indexes. + */ + public final FlushResponse flush() throws IOException, OpenSearchException { + return flush(new FlushRequest.Builder().build()); + } + + // ----- Endpoint: indices.forcemerge + + /** + * Performs the force merge operation on one or more indexes. + */ + public ForcemergeResponse forcemerge(ForcemergeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ForcemergeRequest._ENDPOINT, this.transportOptions); + } + + /** + * Performs the force merge operation on one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link ForcemergeRequest} + */ + public final ForcemergeResponse forcemerge(Function> fn) throws IOException, + OpenSearchException { + return forcemerge(fn.apply(new ForcemergeRequest.Builder()).build()); + } + + /** + * Performs the force merge operation on one or more indexes. + */ + public final ForcemergeResponse forcemerge() throws IOException, OpenSearchException { + return forcemerge(new ForcemergeRequest.Builder().build()); + } + // ----- Endpoint: indices.get /** @@ -546,6 +636,53 @@ public final GetTemplateResponse getTemplate() throws IOException, OpenSearchExc return getTemplate(new GetTemplateRequest.Builder().build()); } + // ----- Endpoint: indices.get_upgrade + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public GetUpgradeResponse getUpgrade(GetUpgradeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetUpgradeRequest._ENDPOINT, this.transportOptions); + } + + /** + * The _upgrade API is no longer useful and will be removed. + * + * @param fn a function that initializes a builder to create the {@link GetUpgradeRequest} + */ + @Deprecated + public final GetUpgradeResponse getUpgrade(Function> fn) throws IOException, + OpenSearchException { + return getUpgrade(fn.apply(new GetUpgradeRequest.Builder()).build()); + } + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public final GetUpgradeResponse getUpgrade() throws IOException, OpenSearchException { + return getUpgrade(new GetUpgradeRequest.Builder().build()); + } + + // ----- Endpoint: indices.open + + /** + * Opens an index. + */ + public OpenResponse open(OpenRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, OpenRequest._ENDPOINT, this.transportOptions); + } + + /** + * Opens an index. + * + * @param fn a function that initializes a builder to create the {@link OpenRequest} + */ + public final OpenResponse open(Function> fn) throws IOException, OpenSearchException { + return open(fn.apply(new OpenRequest.Builder()).build()); + } + // ----- Endpoint: indices.put_alias /** @@ -650,6 +787,167 @@ public final PutTemplateResponse putTemplate(Function> fn) throws IOException, + OpenSearchException { + return recovery(fn.apply(new RecoveryRequest.Builder()).build()); + } + + /** + * Returns information about ongoing index shard recoveries. + */ + public final RecoveryResponse recovery() throws IOException, OpenSearchException { + return recovery(new RecoveryRequest.Builder().build()); + } + + // ----- Endpoint: indices.refresh + + /** + * Performs the refresh operation in one or more indexes. + */ + public RefreshResponse refresh(RefreshRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RefreshRequest._ENDPOINT, this.transportOptions); + } + + /** + * Performs the refresh operation in one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link RefreshRequest} + */ + public final RefreshResponse refresh(Function> fn) throws IOException, + OpenSearchException { + return refresh(fn.apply(new RefreshRequest.Builder()).build()); + } + + /** + * Performs the refresh operation in one or more indexes. + */ + public final RefreshResponse refresh() throws IOException, OpenSearchException { + return refresh(new RefreshRequest.Builder().build()); + } + + // ----- Endpoint: indices.resolve_index + + /** + * Returns information about any matching indexes, aliases, and data streams. + */ + public ResolveIndexResponse resolveIndex(ResolveIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ResolveIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about any matching indexes, aliases, and data streams. + * + * @param fn a function that initializes a builder to create the {@link ResolveIndexRequest} + */ + public final ResolveIndexResponse resolveIndex(Function> fn) + throws IOException, OpenSearchException { + return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); + } + + // ----- Endpoint: indices.rollover + + /** + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. + */ + public RolloverResponse rollover(RolloverRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RolloverRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. + * + * @param fn a function that initializes a builder to create the {@link RolloverRequest} + */ + public final RolloverResponse rollover(Function> fn) throws IOException, + OpenSearchException { + return rollover(fn.apply(new RolloverRequest.Builder()).build()); + } + + // ----- Endpoint: indices.segments + + /** + * Provides low-level information about segments in a Lucene index. + */ + public SegmentsResponse segments(SegmentsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, SegmentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides low-level information about segments in a Lucene index. + * + * @param fn a function that initializes a builder to create the {@link SegmentsRequest} + */ + public final SegmentsResponse segments(Function> fn) throws IOException, + OpenSearchException { + return segments(fn.apply(new SegmentsRequest.Builder()).build()); + } + + /** + * Provides low-level information about segments in a Lucene index. + */ + public final SegmentsResponse segments() throws IOException, OpenSearchException { + return segments(new SegmentsRequest.Builder().build()); + } + + // ----- Endpoint: indices.shard_stores + + /** + * Provides store information for shard copies of indexes. + */ + public ShardStoresResponse shardStores(ShardStoresRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ShardStoresRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides store information for shard copies of indexes. + * + * @param fn a function that initializes a builder to create the {@link ShardStoresRequest} + */ + public final ShardStoresResponse shardStores(Function> fn) + throws IOException, OpenSearchException { + return shardStores(fn.apply(new ShardStoresRequest.Builder()).build()); + } + + /** + * Provides store information for shard copies of indexes. + */ + public final ShardStoresResponse shardStores() throws IOException, OpenSearchException { + return shardStores(new ShardStoresRequest.Builder().build()); + } + + // ----- Endpoint: indices.shrink + + /** + * Allow to shrink an existing index into a new index with fewer primary shards. + */ + public ShrinkResponse shrink(ShrinkRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ShrinkRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allow to shrink an existing index into a new index with fewer primary shards. + * + * @param fn a function that initializes a builder to create the {@link ShrinkRequest} + */ + public final ShrinkResponse shrink(Function> fn) throws IOException, + OpenSearchException { + return shrink(fn.apply(new ShrinkRequest.Builder()).build()); + } + // ----- Endpoint: indices.simulate_index_template /** @@ -691,6 +989,51 @@ public final SimulateTemplateResponse simulateTemplate( return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.split + + /** + * Allows you to split an existing index into a new index with more primary shards. + */ + public SplitResponse split(SplitRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, SplitRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allows you to split an existing index into a new index with more primary shards. + * + * @param fn a function that initializes a builder to create the {@link SplitRequest} + */ + public final SplitResponse split(Function> fn) throws IOException, + OpenSearchException { + return split(fn.apply(new SplitRequest.Builder()).build()); + } + + // ----- Endpoint: indices.stats + + /** + * Provides statistics on operations happening in an index. + */ + public IndicesStatsResponse stats(IndicesStatsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, IndicesStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides statistics on operations happening in an index. + * + * @param fn a function that initializes a builder to create the {@link IndicesStatsRequest} + */ + public final IndicesStatsResponse stats(Function> fn) + throws IOException, OpenSearchException { + return stats(fn.apply(new IndicesStatsRequest.Builder()).build()); + } + + /** + * Provides statistics on operations happening in an index. + */ + public final IndicesStatsResponse stats() throws IOException, OpenSearchException { + return stats(new IndicesStatsRequest.Builder().build()); + } + // ----- Endpoint: indices.update_aliases /** @@ -716,4 +1059,59 @@ public final UpdateAliasesResponse updateAliases(Function_upgrade API is no longer useful and will be removed. + */ + @Deprecated + public UpgradeResponse upgrade(UpgradeRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpgradeRequest._ENDPOINT, this.transportOptions); + } + + /** + * The _upgrade API is no longer useful and will be removed. + * + * @param fn a function that initializes a builder to create the {@link UpgradeRequest} + */ + @Deprecated + public final UpgradeResponse upgrade(Function> fn) throws IOException, + OpenSearchException { + return upgrade(fn.apply(new UpgradeRequest.Builder()).build()); + } + + /** + * The _upgrade API is no longer useful and will be removed. + */ + @Deprecated + public final UpgradeResponse upgrade() throws IOException, OpenSearchException { + return upgrade(new UpgradeRequest.Builder().build()); + } + + // ----- Endpoint: indices.validate_query + + /** + * Allows a user to validate a potentially expensive query without executing it. + */ + public ValidateQueryResponse validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ValidateQueryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Allows a user to validate a potentially expensive query without executing it. + * + * @param fn a function that initializes a builder to create the {@link ValidateQueryRequest} + */ + public final ValidateQueryResponse validateQuery(Function> fn) + throws IOException, OpenSearchException { + return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); + } + + /** + * Allows a user to validate a potentially expensive query without executing it. + */ + public final ValidateQueryResponse validateQuery() throws IOException, OpenSearchException { + return validateQuery(new ValidateQueryRequest.Builder().build()); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java index 16e50ced97..59dafdeb9e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryRequest.java @@ -30,56 +30,64 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.Request /** * Returns information about ongoing index shard recoveries. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryRequest extends RequestBase implements ToCopyableBuilder { -public class RecoveryRequest extends RequestBase { @Nullable private final Boolean activeOnly; @Nullable private final Boolean detailed; + @Nonnull private final List index; // --------------------------------------------------------------------------------------------- private RecoveryRequest(Builder builder) { - this.activeOnly = builder.activeOnly; this.detailed = builder.detailed; this.index = ApiTypeHelper.unmodifiable(builder.index); - } - public static RecoveryRequest of(Function> fn) { + public static RecoveryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Display only those recoveries that are currently on-going + * If true, the response only includes ongoing shard recoveries. *

* API name: {@code active_only} + *

*/ @Nullable public final Boolean activeOnly() { @@ -87,9 +95,10 @@ public final Boolean activeOnly() { } /** - * Whether to display detailed information about shard recovery + * If true, the response includes detailed information about shard recoveries. *

* API name: {@code detailed} + *

*/ @Nullable public final Boolean detailed() { @@ -97,72 +106,114 @@ public final Boolean detailed() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean activeOnly; - @Nullable private Boolean detailed; - @Nullable private List index; + public Builder() {} + + private Builder(RecoveryRequest o) { + this.activeOnly = o.activeOnly; + this.detailed = o.detailed; + this.index = _listCopy(o.index); + } + + private Builder(Builder o) { + this.activeOnly = o.activeOnly; + this.detailed = o.detailed; + this.index = _listCopy(o.index); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Display only those recoveries that are currently on-going + * If true, the response only includes ongoing shard recoveries. *

* API name: {@code active_only} + *

*/ + @Nonnull public final Builder activeOnly(@Nullable Boolean value) { this.activeOnly = value; return this; } /** - * Whether to display detailed information about shard recovery + * If true, the response includes detailed information about shard recoveries. *

* API name: {@code detailed} + *

*/ + @Nonnull public final Builder detailed(@Nullable Boolean value) { this.detailed = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; @@ -171,9 +222,10 @@ public final Builder index(String value, String... values) { /** * Builds a {@link RecoveryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RecoveryRequest build() { _checkSingleUse(); @@ -187,13 +239,8 @@ public RecoveryRequest build() { * Endpoint "{@code indices.recovery}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -203,35 +250,50 @@ public RecoveryRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_recovery"); - return buf.toString(); + return "/_recovery"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_recovery"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.detailed != null) { - params.put("detailed", String.valueOf(request.detailed)); - } if (request.activeOnly != null) { params.put("active_only", String.valueOf(request.activeOnly)); } + if (request.detailed != null) { + params.put("detailed", String.valueOf(request.detailed)); + } return params; - }, SimpleEndpoint.emptyMap(), false, RecoveryResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.activeOnly); + result = 31 * result + Objects.hashCode(this.detailed); + result = 31 * result + Objects.hashCode(this.index); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryRequest other = (RecoveryRequest) o; + return Objects.equals(this.activeOnly, other.activeOnly) + && Objects.equals(this.detailed, other.detailed) + && Objects.equals(this.index, other.index); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java index ec15818d08..9ccc17e384 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RecoveryResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -44,15 +50,15 @@ // typedef: indices.recovery.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class RecoveryResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private RecoveryResponse(Builder builder) { super(builder); - } - public static RecoveryResponse of(Function> fn) { + public static RecoveryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -61,11 +67,11 @@ public static RecoveryResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -73,8 +79,7 @@ protected Builder self() { /** * Builds a {@link RecoveryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public RecoveryResponse build() { _checkSingleUse(); @@ -96,8 +101,6 @@ public RecoveryResponse build() { ); protected static void setupRecoveryResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), RecoveryStatus._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), RecoveryStatus._DESERIALIZER); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshRequest.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshRequest.java index 4f87dd0d4d..8e7cdf9400 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,48 +51,50 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.refresh.Request /** - * Performs the refresh operation in one or more indices. - * + * Performs the refresh operation in one or more indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RefreshRequest extends RequestBase implements ToCopyableBuilder { -public class RefreshRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; // --------------------------------------------------------------------------------------------- private RefreshRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); - } - public static RefreshRequest of(Function> fn) { + public static RefreshRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -93,20 +102,23 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -114,104 +126,155 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RefreshRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; + public Builder() {} + + private Builder(RefreshRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; @@ -220,9 +283,10 @@ public final Builder index(String value, String... values) { /** * Builds a {@link RefreshRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RefreshRequest build() { _checkSingleUse(); @@ -236,13 +300,8 @@ public RefreshRequest build() { * Endpoint "{@code indices.refresh}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _index = 1 << 0; @@ -252,38 +311,55 @@ public RefreshRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_refresh"); - return buf.toString(); + return "/_refresh"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_refresh"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } return params; - }, SimpleEndpoint.emptyMap(), false, RefreshResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RefreshRequest other = (RefreshRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshResponse.java index 6d14ef7f8f..ddde887294 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RefreshResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RefreshResponse.java @@ -30,39 +30,78 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.ShardsOperationResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.refresh.Response @JsonpDeserializable -public class RefreshResponse extends ShardsOperationResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RefreshResponse extends ShardsOperationResponseBase implements ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private RefreshResponse(Builder builder) { super(builder); - } - public static RefreshResponse of(Function> fn) { + public static RefreshResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RefreshResponse}. */ + public static class Builder extends ShardsOperationResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(RefreshResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends ShardsOperationResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +109,10 @@ protected Builder self() { /** * Builds a {@link RefreshResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RefreshResponse build() { _checkSingleUse(); @@ -91,8 +131,22 @@ public RefreshResponse build() { ); protected static void setupRefreshResponseDeserializer(ObjectDeserializer op) { - ShardsOperationResponseBase.setupShardsOperationResponseBaseDeserializer(op); + setupShardsOperationResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java similarity index 54% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java index 743b65bd5c..9b32844ca6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,110 +51,165 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.resolve_index.Request /** - * Returns information about any matching indices, aliases, and data streams - * + * Returns information about any matching indexes, aliases, and data streams. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResolveIndexRequest extends RequestBase implements ToCopyableBuilder { -public class ResolveIndexRequest extends RequestBase { + @Nonnull private final List expandWildcards; + @Nonnull private final List name; // --------------------------------------------------------------------------------------------- private ResolveIndexRequest(Builder builder) { - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - } - public static ResolveIndexRequest of(Function> fn) { + public static ResolveIndexRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Required - A comma-separated list of names or wildcard expressions + * Required - Comma-separated name(s) or index pattern(s) of the indexes, aliases, and data streams to resolve. Resources on remote + * clusters can be specified using the <cluster>:<name> syntax. *

* API name: {@code name} + *

*/ + @Nonnull public final List name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ResolveIndexRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List expandWildcards; - private List name; + public Builder() {} + + private Builder(ResolveIndexRequest o) { + this.expandWildcards = _listCopy(o.expandWildcards); + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.expandWildcards = _listCopy(o.expandWildcards); + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Required - A comma-separated list of names or wildcard expressions + * Required - Comma-separated name(s) or index pattern(s) of the indexes, aliases, and data streams to resolve. Resources on remote + * clusters can be specified using the <cluster>:<name> syntax. *

* API name: {@code name} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; } /** - * Required - A comma-separated list of names or wildcard expressions + * Required - Comma-separated name(s) or index pattern(s) of the indexes, aliases, and data streams to resolve. Resources on remote + * clusters can be specified using the <cluster>:<name> syntax. *

* API name: {@code name} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -156,9 +218,10 @@ public final Builder name(String value, String... values) { /** * Builds a {@link ResolveIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ResolveIndexRequest build() { _checkSingleUse(); @@ -172,33 +235,15 @@ public ResolveIndexRequest build() { * Endpoint "{@code indices.resolve_index}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_resolve"); - buf.append("/index"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_resolve/index/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); @@ -206,10 +251,25 @@ public ResolveIndexRequest build() { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } return params; - }, SimpleEndpoint.emptyMap(), false, ResolveIndexResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + this.name.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResolveIndexRequest other = (ResolveIndexRequest) o; + return Objects.equals(this.expandWildcards, other.expandWildcards) && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java index 3d42e6eaaa..599e61b39c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ResolveIndexResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,49 +48,69 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch.indices.resolve_index.ResolveIndexAliasItem; +import org.opensearch.client.opensearch.indices.resolve_index.ResolveIndexDataStreamsItem; import org.opensearch.client.opensearch.indices.resolve_index.ResolveIndexItem; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.resolve_index.Response @JsonpDeserializable -public class ResolveIndexResponse implements PlainJsonSerializable { - private final List indices; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResolveIndexResponse implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final List aliases; + @Nonnull + private final List dataStreams; + + @Nonnull + private final List indices; + // --------------------------------------------------------------------------------------------- private ResolveIndexResponse(Builder builder) { - - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); - + this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); + this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); } - public static ResolveIndexResponse of(Function> fn) { + public static ResolveIndexResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code indices} + * Required - API name: {@code aliases} */ - public final List indices() { - return this.indices; + @Nonnull + public final List aliases() { + return this.aliases; } /** - * Required - API name: {@code aliases} + * Required - API name: {@code data_streams} */ - public final List aliases() { - return this.aliases; + @Nonnull + public final List dataStreams() { + return this.dataStreams; + } + + /** + * Required - API name: {@code indices} + */ + @Nonnull + public final List indices() { + return this.indices; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -92,75 +118,77 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (ResolveIndexItem item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("aliases"); + generator.writeStartArray(); + for (ResolveIndexAliasItem item0 : this.aliases) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartArray(); - for (ResolveIndexAliasItem item0 : this.aliases) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("data_streams"); + generator.writeStartArray(); + for (ResolveIndexDataStreamsItem item0 : this.dataStreams) { + item0.serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("indices"); + generator.writeStartArray(); + for (ResolveIndexItem item0 : this.indices) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ResolveIndexResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List aliases; + private List dataStreams; private List indices; - private List aliases; + public Builder() {} - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; + private Builder(ResolveIndexResponse o) { + this.aliases = _listCopy(o.aliases); + this.dataStreams = _listCopy(o.dataStreams); + this.indices = _listCopy(o.indices); } - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(ResolveIndexItem value, ResolveIndexItem... values) { - this.indices = _listAdd(this.indices, value, values); - return this; + private Builder(Builder o) { + this.aliases = _listCopy(o.aliases); + this.dataStreams = _listCopy(o.dataStreams); + this.indices = _listCopy(o.indices); } - /** - * Required - API name: {@code indices} - *

- * Adds a value to indices using a builder lambda. - */ - public final Builder indices(Function> fn) { - return indices(fn.apply(new ResolveIndexItem.Builder()).build()); + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code aliases} + * *

* Adds all elements of list to aliases. + *

*/ + @Nonnull public final Builder aliases(List list) { this.aliases = _listAddAll(this.aliases, list); return this; @@ -168,9 +196,12 @@ public final Builder aliases(List list) { /** * Required - API name: {@code aliases} + * *

* Adds one or more values to aliases. + *

*/ + @Nonnull public final Builder aliases(ResolveIndexAliasItem value, ResolveIndexAliasItem... values) { this.aliases = _listAdd(this.aliases, value, values); return this; @@ -178,19 +209,99 @@ public final Builder aliases(ResolveIndexAliasItem value, ResolveIndexAliasItem. /** * Required - API name: {@code aliases} + * *

* Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(Function> fn) { return aliases(fn.apply(new ResolveIndexAliasItem.Builder()).build()); } + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds all elements of list to dataStreams. + *

+ */ + @Nonnull + public final Builder dataStreams(List list) { + this.dataStreams = _listAddAll(this.dataStreams, list); + return this; + } + + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds one or more values to dataStreams. + *

+ */ + @Nonnull + public final Builder dataStreams(ResolveIndexDataStreamsItem value, ResolveIndexDataStreamsItem... values) { + this.dataStreams = _listAdd(this.dataStreams, value, values); + return this; + } + + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds a value to dataStreams using a builder lambda. + *

+ */ + @Nonnull + public final Builder dataStreams(Function> fn) { + return dataStreams(fn.apply(new ResolveIndexDataStreamsItem.Builder()).build()); + } + + /** + * Required - API name: {@code indices} + * + *

+ * Adds all elements of list to indices. + *

+ */ + @Nonnull + public final Builder indices(List list) { + this.indices = _listAddAll(this.indices, list); + return this; + } + + /** + * Required - API name: {@code indices} + * + *

+ * Adds one or more values to indices. + *

+ */ + @Nonnull + public final Builder indices(ResolveIndexItem value, ResolveIndexItem... values) { + this.indices = _listAdd(this.indices, value, values); + return this; + } + + /** + * Required - API name: {@code indices} + * + *

+ * Adds a value to indices using a builder lambda. + *

+ */ + @Nonnull + public final Builder indices(Function> fn) { + return indices(fn.apply(new ResolveIndexItem.Builder()).build()); + } + /** * Builds a {@link ResolveIndexResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ResolveIndexResponse build() { _checkSingleUse(); @@ -209,10 +320,25 @@ public ResolveIndexResponse build() { ); protected static void setupResolveIndexResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(ResolveIndexItem._DESERIALIZER), "indices"); op.add(Builder::aliases, JsonpDeserializer.arrayDeserializer(ResolveIndexAliasItem._DESERIALIZER), "aliases"); + op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(ResolveIndexDataStreamsItem._DESERIALIZER), "data_streams"); + op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(ResolveIndexItem._DESERIALIZER), "indices"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.aliases.hashCode(); + result = 31 * result + this.dataStreams.hashCode(); + result = 31 * result + this.indices.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResolveIndexResponse other = (ResolveIndexResponse) o; + return this.aliases.equals(other.aliases) && this.dataStreams.equals(other.dataStreams) && this.indices.equals(other.indices); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverRequest.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverRequest.java index d85cbd61ce..2c25f2c99e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -48,27 +55,37 @@ import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch._types.WaitForActiveShards; -import org.opensearch.client.opensearch.indices.rollover.IndexRolloverMapping; +import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.opensearch.indices.rollover.RolloverConditions; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.rollover.Request /** - * Updates an alias to point to a new index when the existing index is - * considered to be too large or too old. - * + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. */ @JsonpDeserializable -public class RolloverRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RolloverRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final String alias; + @Nonnull private final Map aliases; + @Nullable + private final Time clusterManagerTimeout; + @Nullable private final RolloverConditions conditions; @@ -76,18 +93,16 @@ public class RolloverRequest extends RequestBase implements PlainJsonSerializabl private final Boolean dryRun; @Nullable - private final IndexRolloverMapping mappings; + private final TypeMapping mappings; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final String newIndex; + @Nonnull private final Map settings; @Nullable @@ -99,41 +114,56 @@ public class RolloverRequest extends RequestBase implements PlainJsonSerializabl // --------------------------------------------------------------------------------------------- private RolloverRequest(Builder builder) { - this.alias = ApiTypeHelper.requireNonNull(builder.alias, this, "alias"); this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.conditions = builder.conditions; this.dryRun = builder.dryRun; this.mappings = builder.mappings; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.newIndex = builder.newIndex; this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; - } - public static RolloverRequest of(Function> fn) { + public static RolloverRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - The name of the alias to rollover + * Required - Name of the data stream or index alias to roll over. *

* API name: {@code alias} + *

*/ + @Nonnull public final String alias() { return this.alias; } /** + * Aliases for the target index. Data streams do not support this parameter. + *

* API name: {@code aliases} + *

*/ + @Nonnull public final Map aliases() { return this.aliases; } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * API name: {@code conditions} */ @@ -143,10 +173,10 @@ public final RolloverConditions conditions() { } /** - * If set to true the rollover action will only be validated but not actually - * performed even if a condition matches. The default is false + * If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. *

* API name: {@code dry_run} + *

*/ @Nullable public final Boolean dryRun() { @@ -157,14 +187,16 @@ public final Boolean dryRun() { * API name: {@code mappings} */ @Nullable - public final IndexRolloverMapping mappings() { + public final TypeMapping mappings() { return this.mappings; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -173,19 +205,10 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * The name of the rollover index + * Name of the index to create. Supports date math. Data streams do not support this parameter. *

* API name: {@code new_index} + *

*/ @Nullable public final String newIndex() { @@ -193,16 +216,21 @@ public final String newIndex() { } /** + * Configuration options for the index. Data streams do not support this parameter. + *

* API name: {@code settings} + *

*/ + @Nonnull public final Map settings() { return this.settings; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -210,10 +238,11 @@ public final Time timeout() { } /** - * Set the number of active shards to wait for on the newly created rollover - * index before the operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the + * total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { @@ -223,6 +252,7 @@ public final WaitForActiveShards waitForActiveShards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -230,124 +260,197 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartObject(); for (Map.Entry item0 : this.aliases.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.conditions != null) { generator.writeKey("conditions"); this.conditions.serialize(generator, mapper); - } + if (this.mappings != null) { generator.writeKey("mappings"); this.mappings.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link RolloverRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String alias; - @Nullable private Map aliases; - + @Nullable + private Time clusterManagerTimeout; @Nullable private RolloverConditions conditions; - @Nullable private Boolean dryRun; - @Nullable - private IndexRolloverMapping mappings; - - @Deprecated + private TypeMapping mappings; @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private String newIndex; - @Nullable private Map settings; - @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; + public Builder() {} + + private Builder(RolloverRequest o) { + this.alias = o.alias; + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.conditions = o.conditions; + this.dryRun = o.dryRun; + this.mappings = o.mappings; + this.masterTimeout = o.masterTimeout; + this.newIndex = o.newIndex; + this.settings = _mapCopy(o.settings); + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + } + + private Builder(Builder o) { + this.alias = o.alias; + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.conditions = o.conditions; + this.dryRun = o.dryRun; + this.mappings = o.mappings; + this.masterTimeout = o.masterTimeout; + this.newIndex = o.newIndex; + this.settings = _mapCopy(o.settings); + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - The name of the alias to rollover + * Required - Name of the data stream or index alias to roll over. *

* API name: {@code alias} + *

*/ + @Nonnull public final Builder alias(String value) { this.alias = value; return this; } /** + * Aliases for the target index. Data streams do not support this parameter. + *

* API name: {@code aliases} + *

+ * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; } /** + * Aliases for the target index. Data streams do not support this parameter. + *

* API name: {@code aliases} + *

+ * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; } /** + * Aliases for the target index. Data streams do not support this parameter. + *

* API name: {@code aliases} + *

+ * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code conditions} */ + @Nonnull public final Builder conditions(@Nullable RolloverConditions value) { this.conditions = value; return this; @@ -356,16 +459,18 @@ public final Builder conditions(@Nullable RolloverConditions value) { /** * API name: {@code conditions} */ + @Nonnull public final Builder conditions(Function> fn) { - return this.conditions(fn.apply(new RolloverConditions.Builder()).build()); + return conditions(fn.apply(new RolloverConditions.Builder()).build()); } /** - * If set to true the rollover action will only be validated but not actually - * performed even if a condition matches. The default is false + * If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. *

* API name: {@code dry_run} + *

*/ + @Nonnull public final Builder dryRun(@Nullable Boolean value) { this.dryRun = value; return this; @@ -374,7 +479,8 @@ public final Builder dryRun(@Nullable Boolean value) { /** * API name: {@code mappings} */ - public final Builder mappings(@Nullable IndexRolloverMapping value) { + @Nonnull + public final Builder mappings(@Nullable TypeMapping value) { this.mappings = value; return this; } @@ -382,126 +488,137 @@ public final Builder mappings(@Nullable IndexRolloverMapping value) { /** * API name: {@code mappings} */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new IndexRolloverMapping.Builder()).build()); + @Nonnull + public final Builder mappings(Function> fn) { + return mappings(fn.apply(new TypeMapping.Builder()).build()); } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * The name of the rollover index + * Name of the index to create. Supports date math. Data streams do not support this parameter. *

* API name: {@code new_index} + *

*/ + @Nonnull public final Builder newIndex(@Nullable String value) { this.newIndex = value; return this; } /** + * Configuration options for the index. Data streams do not support this parameter. + *

* API name: {@code settings} + *

+ * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; } /** + * Configuration options for the index. Data streams do not support this parameter. + *

* API name: {@code settings} + *

+ * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Set the number of active shards to wait for on the newly created rollover - * index before the operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the + * total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * Set the number of active shards to wait for on the newly created rollover - * index before the operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the + * total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); } /** * Builds a {@link RolloverRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RolloverRequest build() { _checkSingleUse(); @@ -520,12 +637,10 @@ public RolloverRequest build() { ); protected static void setupRolloverRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); op.add(Builder::conditions, RolloverConditions._DESERIALIZER, "conditions"); - op.add(Builder::mappings, IndexRolloverMapping._DESERIALIZER, "mappings"); + op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); - } // --------------------------------------------------------------------------------------------- @@ -534,22 +649,17 @@ protected static void setupRolloverRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _newIndex = 1 << 0; - final int _alias = 1 << 1; + final int _alias = 1 << 0; + final int _newIndex = 1 << 1; int propsSet = 0; - if (request.newIndex() != null) propsSet |= _newIndex; propsSet |= _alias; + if (request.newIndex() != null) propsSet |= _newIndex; if (propsSet == (_alias)) { StringBuilder buf = new StringBuilder(); @@ -562,38 +672,70 @@ protected static void setupRolloverRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); - } if (request.dryRun != null) { params.put("dry_run", String.valueOf(request.dryRun)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } + if (request.waitForActiveShards != null) { + params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), true, RolloverResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.alias.hashCode(); + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.conditions); + result = 31 * result + Objects.hashCode(this.dryRun); + result = 31 * result + Objects.hashCode(this.mappings); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.newIndex); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RolloverRequest other = (RolloverRequest) o; + return this.alias.equals(other.alias) + && Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.conditions, other.conditions) + && Objects.equals(this.dryRun, other.dryRun) + && Objects.equals(this.mappings, other.mappings) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.newIndex, other.newIndex) + && Objects.equals(this.settings, other.settings) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverResponse.java index 6cf397d85c..b426a6830f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/RolloverResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/RolloverResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,18 +48,25 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.rollover.Response @JsonpDeserializable -public class RolloverResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RolloverResponse extends AcknowledgedResponseBase implements ToCopyableBuilder { + + @Nonnull private final Map conditions; private final boolean dryRun; + @Nonnull private final String newIndex; + @Nonnull private final String oldIndex; private final boolean rolledOver; @@ -64,23 +77,22 @@ public class RolloverResponse extends AcknowledgedResponseBase { private RolloverResponse(Builder builder) { super(builder); - this.conditions = ApiTypeHelper.unmodifiableRequired(builder.conditions, this, "conditions"); this.dryRun = ApiTypeHelper.requireNonNull(builder.dryRun, this, "dryRun"); this.newIndex = ApiTypeHelper.requireNonNull(builder.newIndex, this, "newIndex"); this.oldIndex = ApiTypeHelper.requireNonNull(builder.oldIndex, this, "oldIndex"); this.rolledOver = ApiTypeHelper.requireNonNull(builder.rolledOver, this, "rolledOver"); this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - } - public static RolloverResponse of(Function> fn) { + public static RolloverResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code conditions} */ + @Nonnull public final Map conditions() { return this.conditions; } @@ -95,6 +107,7 @@ public final boolean dryRun() { /** * Required - API name: {@code new_index} */ + @Nonnull public final String newIndex() { return this.newIndex; } @@ -102,6 +115,7 @@ public final String newIndex() { /** * Required - API name: {@code old_index} */ + @Nonnull public final String oldIndex() { return this.oldIndex; } @@ -121,19 +135,15 @@ public final boolean shardsAcknowledged() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.conditions)) { - generator.writeKey("conditions"); - generator.writeStartObject(); - for (Map.Entry item0 : this.conditions.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("conditions"); + generator.writeStartObject(); + for (Map.Entry item0 : this.conditions.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } + generator.writeEnd(); + generator.writeKey("dry_run"); generator.write(this.dryRun); @@ -148,33 +158,76 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("shards_acknowledged"); generator.write(this.shardsAcknowledged); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RolloverResponse}. */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { private Map conditions; - private Boolean dryRun; - private String newIndex; - private String oldIndex; - private Boolean rolledOver; - private Boolean shardsAcknowledged; + public Builder() {} + + private Builder(RolloverResponse o) { + super(o); + this.conditions = _mapCopy(o.conditions); + this.dryRun = o.dryRun; + this.newIndex = o.newIndex; + this.oldIndex = o.oldIndex; + this.rolledOver = o.rolledOver; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + private Builder(Builder o) { + super(o); + this.conditions = _mapCopy(o.conditions); + this.dryRun = o.dryRun; + this.newIndex = o.newIndex; + this.oldIndex = o.oldIndex; + this.rolledOver = o.rolledOver; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code conditions} + * *

- * Adds all entries of map to conditions. + * Adds all elements of map to conditions. + *

*/ + @Nonnull public final Builder conditions(Map map) { this.conditions = _mapPutAll(this.conditions, map); return this; @@ -182,9 +235,12 @@ public final Builder conditions(Map map) { /** * Required - API name: {@code conditions} + * *

* Adds an entry to conditions. + *

*/ + @Nonnull public final Builder conditions(String key, Boolean value) { this.conditions = _mapPut(this.conditions, key, value); return this; @@ -193,6 +249,7 @@ public final Builder conditions(String key, Boolean value) { /** * Required - API name: {@code dry_run} */ + @Nonnull public final Builder dryRun(boolean value) { this.dryRun = value; return this; @@ -201,6 +258,7 @@ public final Builder dryRun(boolean value) { /** * Required - API name: {@code new_index} */ + @Nonnull public final Builder newIndex(String value) { this.newIndex = value; return this; @@ -209,6 +267,7 @@ public final Builder newIndex(String value) { /** * Required - API name: {@code old_index} */ + @Nonnull public final Builder oldIndex(String value) { this.oldIndex = value; return this; @@ -217,6 +276,7 @@ public final Builder oldIndex(String value) { /** * Required - API name: {@code rolled_over} */ + @Nonnull public final Builder rolledOver(boolean value) { this.rolledOver = value; return this; @@ -225,22 +285,19 @@ public final Builder rolledOver(boolean value) { /** * Required - API name: {@code shards_acknowledged} */ + @Nonnull public final Builder shardsAcknowledged(boolean value) { this.shardsAcknowledged = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link RolloverResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RolloverResponse build() { _checkSingleUse(); @@ -259,14 +316,40 @@ public RolloverResponse build() { ); protected static void setupRolloverResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::conditions, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.booleanDeserializer()), "conditions"); op.add(Builder::dryRun, JsonpDeserializer.booleanDeserializer(), "dry_run"); op.add(Builder::newIndex, JsonpDeserializer.stringDeserializer(), "new_index"); op.add(Builder::oldIndex, JsonpDeserializer.stringDeserializer(), "old_index"); op.add(Builder::rolledOver, JsonpDeserializer.booleanDeserializer(), "rolled_over"); op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.conditions.hashCode(); + result = 31 * result + Boolean.hashCode(this.dryRun); + result = 31 * result + this.newIndex.hashCode(); + result = 31 * result + this.oldIndex.hashCode(); + result = 31 * result + Boolean.hashCode(this.rolledOver); + result = 31 * result + Boolean.hashCode(this.shardsAcknowledged); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RolloverResponse other = (RolloverResponse) o; + return this.conditions.equals(other.conditions) + && this.dryRun == other.dryRun + && this.newIndex.equals(other.newIndex) + && this.oldIndex.equals(other.oldIndex) + && this.rolledOver == other.rolledOver + && this.shardsAcknowledged == other.shardsAcknowledged; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java index 59c539a754..55918d3208 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,25 +51,29 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.Request /** * Provides low-level information about segments in a Lucene index. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SegmentsRequest extends RequestBase implements ToCopyableBuilder { -public class SegmentsRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -71,25 +82,23 @@ public class SegmentsRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private SegmentsRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.verbose = builder.verbose; - } - public static SegmentsRequest of(Function> fn) { + public static SegmentsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -97,20 +106,23 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -118,19 +130,22 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Includes detailed memory usage by Lucene. + * If true, the request returns a verbose response. *

* API name: {@code verbose} + *

*/ @Nullable public final Boolean verbose() { @@ -139,106 +154,158 @@ public final Boolean verbose() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SegmentsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Boolean verbose; + public Builder() {} + + private Builder(SegmentsRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.verbose = o.verbose; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.verbose = o.verbose; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Includes detailed memory usage by Lucene. + * If true, the request returns a verbose response. *

* API name: {@code verbose} + *

*/ + @Nonnull public final Builder verbose(@Nullable Boolean value) { this.verbose = value; return this; @@ -247,9 +314,10 @@ public final Builder verbose(@Nullable Boolean value) { /** * Builds a {@link SegmentsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SegmentsRequest build() { _checkSingleUse(); @@ -263,13 +331,8 @@ public SegmentsRequest build() { * Endpoint "{@code indices.segments}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -279,41 +342,60 @@ public SegmentsRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_segments"); - return buf.toString(); + return "/_segments"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_segments"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (request.verbose != null) { params.put("verbose", String.valueOf(request.verbose)); } return params; - }, SimpleEndpoint.emptyMap(), false, SegmentsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.verbose); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SegmentsRequest other = (SegmentsRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.verbose, other.verbose); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java index a9bef40235..918ecb4f72 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SegmentsResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,33 +50,38 @@ import org.opensearch.client.opensearch._types.ShardStatistics; import org.opensearch.client.opensearch.indices.segments.IndexSegment; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.Response @JsonpDeserializable -public class SegmentsResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SegmentsResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map indices; + @Nonnull private final ShardStatistics shards; // --------------------------------------------------------------------------------------------- private SegmentsResponse(Builder builder) { - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - } - public static SegmentsResponse of(Function> fn) { + public static SegmentsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -78,6 +89,7 @@ public final Map indices() { /** * Required - API name: {@code _shards} */ + @Nonnull public final ShardStatistics shards() { return this.shards; } @@ -85,6 +97,7 @@ public final ShardStatistics shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -92,39 +105,64 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartObject(); - for (Map.Entry item0 : this.indices.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("_shards"); this.shards.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SegmentsResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map indices; - private ShardStatistics shards; + public Builder() {} + + private Builder(SegmentsResponse o) { + this.indices = _mapCopy(o.indices); + this.shards = o.shards; + } + + private Builder(Builder o) { + this.indices = _mapCopy(o.indices); + this.shards = o.shards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -132,9 +170,12 @@ public final Builder indices(Map map) { /** * Required - API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, IndexSegment value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -142,9 +183,12 @@ public final Builder indices(String key, IndexSegment value) { /** * Required - API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new IndexSegment.Builder()).build()); } @@ -152,6 +196,7 @@ public final Builder indices(String key, Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } /** * Builds a {@link SegmentsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SegmentsResponse build() { _checkSingleUse(); @@ -188,10 +235,23 @@ public SegmentsResponse build() { ); protected static void setupSegmentsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(IndexSegment._DESERIALIZER), "indices"); op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.indices.hashCode(); + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SegmentsResponse other = (SegmentsResponse) o; + return this.indices.equals(other.indices) && this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java index e43950f0ac..e4ae7cac8c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -45,51 +52,54 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.Request /** - * Provides store information for shard copies of indices. - * + * Provides store information for shard copies of indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardStoresRequest extends RequestBase implements ToCopyableBuilder { -public class ShardStoresRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; + @Nonnull private final List status; // --------------------------------------------------------------------------------------------- private ShardStoresRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.status = ApiTypeHelper.unmodifiable(builder.status); - } - public static ShardStoresRequest of(Function> fn) { + public static ShardStoresRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * If false, the request returns an error if any wildcard expression, index - * alias, or _all value targets only missing or closed indices. This behavior - * applies even if the request targets other open indices. + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -97,20 +107,22 @@ public final Boolean allowNoIndices() { } /** - * Type of index that wildcard patterns can match. If the request can target - * data streams, this argument determines whether wildcard expressions match - * hidden data streams. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * If true, missing or closed indices are not included in the response. + * If true, missing or closed indexes are not included in the response. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -118,10 +130,12 @@ public final Boolean ignoreUnavailable() { } /** - * List of data streams, indices, and aliases used to limit the request. + * List of data streams, indexes, and aliases used to limit the request. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } @@ -130,102 +144,151 @@ public final List index() { * List of shard health statuses used to limit the request. *

* API name: {@code status} + *

*/ + @Nonnull public final List status() { return this.status; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardStoresRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private List status; + public Builder() {} + + private Builder(ShardStoresRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.status = _listCopy(o.status); + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.status = _listCopy(o.status); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * If false, the request returns an error if any wildcard expression, index - * alias, or _all value targets only missing or closed indices. This behavior - * applies even if the request targets other open indices. + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Type of index that wildcard patterns can match. If the request can target - * data streams, this argument determines whether wildcard expressions match - * hidden data streams. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Type of index that wildcard patterns can match. If the request can target - * data streams, this argument determines whether wildcard expressions match - * hidden data streams. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * If true, missing or closed indices are not included in the response. + * If true, missing or closed indexes are not included in the response. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * List of data streams, indices, and aliases used to limit the request. + * List of data streams, indexes, and aliases used to limit the request. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * List of data streams, indices, and aliases used to limit the request. + * List of data streams, indexes, and aliases used to limit the request. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; @@ -235,9 +298,13 @@ public final Builder index(String value, String... values) { * List of shard health statuses used to limit the request. *

* API name: {@code status} + *

+ * *

* Adds all elements of list to status. + *

*/ + @Nonnull public final Builder status(List list) { this.status = _listAddAll(this.status, list); return this; @@ -247,9 +314,13 @@ public final Builder status(List list) { * List of shard health statuses used to limit the request. *

* API name: {@code status} + *

+ * *

* Adds one or more values to status. + *

*/ + @Nonnull public final Builder status(ShardStoreStatus value, ShardStoreStatus... values) { this.status = _listAdd(this.status, value, values); return this; @@ -258,9 +329,10 @@ public final Builder status(ShardStoreStatus value, ShardStoreStatus... values) /** * Builds a {@link ShardStoresRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardStoresRequest build() { _checkSingleUse(); @@ -274,13 +346,8 @@ public ShardStoresRequest build() { * Endpoint "{@code indices.shard_stores}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -290,41 +357,60 @@ public ShardStoresRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_shard_stores"); - return buf.toString(); + return "/_shard_stores"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_shard_stores"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (ApiTypeHelper.isDefined(request.status)) { params.put("status", request.status.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } return params; - }, SimpleEndpoint.emptyMap(), false, ShardStoresResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.status); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardStoresRequest other = (ShardStoresRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.status, other.status); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java index 4466c02edd..92ed058ec7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShardStoresResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,30 +49,34 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch.indices.shard_stores.IndicesShardStores; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.Response @JsonpDeserializable -public class ShardStoresResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardStoresResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map indices; // --------------------------------------------------------------------------------------------- private ShardStoresResponse(Builder builder) { - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - } - public static ShardStoresResponse of(Function> fn) { + public static ShardStoresResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -74,6 +84,7 @@ public final Map indices() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,35 +92,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartObject(); - for (Map.Entry item0 : this.indices.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardStoresResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map indices; + public Builder() {} + + private Builder(ShardStoresResponse o) { + this.indices = _mapCopy(o.indices); + } + + private Builder(Builder o) { + this.indices = _mapCopy(o.indices); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -117,9 +151,12 @@ public final Builder indices(Map map) { /** * Required - API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, IndicesShardStores value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -127,9 +164,12 @@ public final Builder indices(String key, IndicesShardStores value) { /** * Required - API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new IndicesShardStores.Builder()).build()); } @@ -137,9 +177,10 @@ public final Builder indices(String key, Function op) { - op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(IndicesShardStores._DESERIALIZER), "indices"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.indices.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardStoresResponse other = (ShardStoresResponse) o; + return this.indices.equals(other.indices); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java index c7e8c51770..b433e14305 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -51,77 +58,124 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shrink.Request /** * Allow to shrink an existing index into a new index with fewer primary shards. - * */ @JsonpDeserializable -public class ShrinkRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShrinkRequest extends RequestBase implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map aliases; + @Nullable + private final Time clusterManagerTimeout; + + @Nullable + private final Boolean copySettings; + + @Nonnull private final String index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final Map settings; + @Nonnull private final String target; + @Nullable + private final Time taskExecutionTimeout; + @Nullable private final Time timeout; @Nullable private final WaitForActiveShards waitForActiveShards; + @Nullable + private final Boolean waitForCompletion; + // --------------------------------------------------------------------------------------------- private ShrinkRequest(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.copySettings = builder.copySettings; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); + this.taskExecutionTimeout = builder.taskExecutionTimeout; this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; - + this.waitForCompletion = builder.waitForCompletion; } - public static ShrinkRequest of(Function> fn) { + public static ShrinkRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * The key is the alias name. Index alias names support date math. + *

* API name: {@code aliases} + *

*/ + @Nonnull public final Map aliases() { return this.aliases; } /** - * Required - The name of the source index to shrink + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * whether or not to copy settings from the source index. + *

+ * API name: {@code copy_settings} + *

+ */ + @Nullable + public final Boolean copySettings() { + return this.copySettings; + } + + /** + * Required - Name of the source index to shrink. *

* API name: {@code index} + *

*/ + @Nonnull public final String index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -130,35 +184,43 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager + * Configuration options for the target index. *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** * API name: {@code settings} + *

*/ + @Nonnull public final Map settings() { return this.settings; } /** - * Required - The name of the target index to shrink into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final String target() { return this.target; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nullable + public final Time taskExecutionTimeout() { + return this.taskExecutionTimeout; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -166,19 +228,32 @@ public final Time timeout() { } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer + * up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { return this.waitForActiveShards; } + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -186,217 +261,355 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartObject(); for (Map.Entry item0 : this.aliases.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ShrinkRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Map aliases; - + @Nullable + private Time clusterManagerTimeout; + @Nullable + private Boolean copySettings; private String index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Map settings; - private String target; - + @Nullable + private Time taskExecutionTimeout; @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(ShrinkRequest o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.copySettings = o.copySettings; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.copySettings = o.copySettings; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** + * The key is the alias name. Index alias names support date math. + *

* API name: {@code aliases} + *

+ * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; } /** + * The key is the alias name. Index alias names support date math. + *

* API name: {@code aliases} + *

+ * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; } /** + * The key is the alias name. Index alias names support date math. + *

* API name: {@code aliases} + *

+ * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } /** - * Required - The name of the source index to shrink + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code index} + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder index(String value) { - this.index = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * whether or not to copy settings from the source index. + *

+ * API name: {@code copy_settings} + *

+ */ + @Nonnull + public final Builder copySettings(@Nullable Boolean value) { + this.copySettings = value; return this; } /** - * Specify timeout for connection to master + * Required - Name of the source index to shrink. *

- * API name: {@code master_timeout} + * API name: {@code index} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder index(String value) { + this.index = value; + return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** + * Configuration options for the target index. + *

* API name: {@code settings} + *

+ * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; } /** + * Configuration options for the target index. + *

* API name: {@code settings} + *

+ * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; } /** - * Required - The name of the target index to shrink into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final Builder target(String value) { this.target = value; return this; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(@Nullable Time value) { + this.taskExecutionTimeout = value; + return this; + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(Function> fn) { + return taskExecutionTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + } + + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; } /** * Builds a {@link ShrinkRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShrinkRequest build() { _checkSingleUse(); @@ -415,10 +628,8 @@ public ShrinkRequest build() { ); protected static void setupShrinkRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); - } // --------------------------------------------------------------------------------------------- @@ -427,56 +638,80 @@ protected static void setupShrinkRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _index = 1 << 0; - final int _target = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _target; - - if (propsSet == (_index | _target)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_shrink"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.target, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(request.index, buf); + buf.append("/_shrink/"); + SimpleEndpoint.pathEncode(request.target, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } + if (request.copySettings != null) { + params.put("copy_settings", String.valueOf(request.copySettings)); + } if (request.masterTimeout != null) { params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.clusterManagerTimeout != null) { - params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + if (request.taskExecutionTimeout != null) { + params.put("task_execution_timeout", request.taskExecutionTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); } if (request.waitForActiveShards != null) { params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); } return params; - }, SimpleEndpoint.emptyMap(), true, ShrinkResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.copySettings); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + this.target.hashCode(); + result = 31 * result + Objects.hashCode(this.taskExecutionTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShrinkRequest other = (ShrinkRequest) o; + return Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.copySettings, other.copySettings) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.settings, other.settings) + && this.target.equals(other.target) + && Objects.equals(this.taskExecutionTimeout, other.taskExecutionTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java index abf8f1d5c1..5e5bf939ef 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ShrinkResponse.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,93 +47,130 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shrink.Response @JsonpDeserializable -public class ShrinkResponse extends AcknowledgedResponseBase { - private final boolean shardsAcknowledged; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShrinkResponse extends AcknowledgedResponseBase implements ToCopyableBuilder { + @Nonnull private final String index; + private final boolean shardsAcknowledged; + // --------------------------------------------------------------------------------------------- private ShrinkResponse(Builder builder) { super(builder); - - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - + this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); } - public static ShrinkResponse of(Function> fn) { + public static ShrinkResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code shards_acknowledged} + * Required - API name: {@code index} */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; + @Nonnull + public final String index() { + return this.index; } /** - * Required - API name: {@code index} + * Required - API name: {@code shards_acknowledged} */ - public final String index() { - return this.index; + public final boolean shardsAcknowledged() { + return this.shardsAcknowledged; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - generator.writeKey("index"); generator.write(this.index); + generator.writeKey("shards_acknowledged"); + generator.write(this.shardsAcknowledged); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShrinkResponse}. */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + private String index; private Boolean shardsAcknowledged; - private String index; + public Builder() {} - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; + private Builder(ShrinkResponse o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + private Builder(Builder o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { return this; } /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; } - @Override - protected Builder self() { + /** + * Required - API name: {@code shards_acknowledged} + */ + @Nonnull + public final Builder shardsAcknowledged(boolean value) { + this.shardsAcknowledged = value; return this; } /** * Builds a {@link ShrinkResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShrinkResponse build() { _checkSingleUse(); @@ -146,10 +189,27 @@ public ShrinkResponse build() { ); protected static void setupShrinkResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Boolean.hashCode(this.shardsAcknowledged); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShrinkResponse other = (ShrinkResponse) o; + return this.index.equals(other.index) && this.shardsAcknowledged == other.shardsAcknowledged; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitRequest.java similarity index 51% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitRequest.java index 8635a6d5b4..e6b6f22226 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -51,78 +58,124 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.split.Request /** - * Allows you to split an existing index into a new index with more primary - * shards. - * + * Allows you to split an existing index into a new index with more primary shards. */ @JsonpDeserializable -public class SplitRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SplitRequest extends RequestBase implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map aliases; + @Nullable + private final Time clusterManagerTimeout; + + @Nullable + private final Boolean copySettings; + + @Nonnull private final String index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final Map settings; + @Nonnull private final String target; + @Nullable + private final Time taskExecutionTimeout; + @Nullable private final Time timeout; @Nullable private final WaitForActiveShards waitForActiveShards; + @Nullable + private final Boolean waitForCompletion; + // --------------------------------------------------------------------------------------------- private SplitRequest(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.copySettings = builder.copySettings; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); + this.taskExecutionTimeout = builder.taskExecutionTimeout; this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; - + this.waitForCompletion = builder.waitForCompletion; } - public static SplitRequest of(Function> fn) { + public static SplitRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

*/ + @Nonnull public final Map aliases() { return this.aliases; } /** - * Required - The name of the source index to split + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * whether or not to copy settings from the source index. + *

+ * API name: {@code copy_settings} + *

+ */ + @Nullable + public final Boolean copySettings() { + return this.copySettings; + } + + /** + * Required - Name of the source index to split. *

* API name: {@code index} + *

*/ + @Nonnull public final String index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -131,35 +184,43 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager + * Configuration options for the target index. *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** * API name: {@code settings} + *

*/ + @Nonnull public final Map settings() { return this.settings; } /** - * Required - The name of the target index to split into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final String target() { return this.target; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nullable + public final Time taskExecutionTimeout() { + return this.taskExecutionTimeout; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -167,19 +228,32 @@ public final Time timeout() { } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer + * up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { return this.waitForActiveShards; } + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -187,217 +261,355 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartObject(); for (Map.Entry item0 : this.aliases.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link SplitRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Map aliases; - + @Nullable + private Time clusterManagerTimeout; + @Nullable + private Boolean copySettings; private String index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Map settings; - private String target; - + @Nullable + private Time taskExecutionTimeout; @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(SplitRequest o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.copySettings = o.copySettings; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.copySettings = o.copySettings; + this.index = o.index; + this.masterTimeout = o.masterTimeout; + this.settings = _mapCopy(o.settings); + this.target = o.target; + this.taskExecutionTimeout = o.taskExecutionTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; } /** + * Aliases for the resulting index. + *

* API name: {@code aliases} + *

+ * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } /** - * Required - The name of the source index to split + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code index} + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder index(String value) { - this.index = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * whether or not to copy settings from the source index. + *

+ * API name: {@code copy_settings} + *

+ */ + @Nonnull + public final Builder copySettings(@Nullable Boolean value) { + this.copySettings = value; return this; } /** - * Specify timeout for connection to master + * Required - Name of the source index to split. *

- * API name: {@code master_timeout} + * API name: {@code index} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder index(String value) { + this.index = value; + return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** + * Configuration options for the target index. + *

* API name: {@code settings} + *

+ * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; } /** + * Configuration options for the target index. + *

* API name: {@code settings} + *

+ * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; } /** - * Required - The name of the target index to split into + * Required - Name of the target index to create. *

* API name: {@code target} + *

*/ + @Nonnull public final Builder target(String value) { this.target = value; return this; } /** - * Explicit operation timeout + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(@Nullable Time value) { + this.taskExecutionTimeout = value; + return this; + } + + /** + * Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h. + *

+ * API name: {@code task_execution_timeout} + *

+ */ + @Nonnull + public final Builder taskExecutionTimeout(Function> fn) { + return taskExecutionTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * Set the number of active shards to wait for on the shrunken index before the - * operation returns. + * The number of shard copies that must be active before proceeding with the operation. Set to all or any positive + * integer up to the total number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + } + + /** + * Should this request wait until the operation has completed before returning. + *

+ * API name: {@code wait_for_completion} + *

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; } /** * Builds a {@link SplitRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SplitRequest build() { _checkSingleUse(); @@ -416,10 +628,8 @@ public SplitRequest build() { ); protected static void setupSplitRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); - } // --------------------------------------------------------------------------------------------- @@ -428,56 +638,80 @@ protected static void setupSplitRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _index = 1 << 0; - final int _target = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _target; - - if (propsSet == (_index | _target)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_split"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.target, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(request.index, buf); + buf.append("/_split/"); + SimpleEndpoint.pathEncode(request.target, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } + if (request.copySettings != null) { + params.put("copy_settings", String.valueOf(request.copySettings)); + } if (request.masterTimeout != null) { params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.clusterManagerTimeout != null) { - params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + if (request.taskExecutionTimeout != null) { + params.put("task_execution_timeout", request.taskExecutionTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); } if (request.waitForActiveShards != null) { params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); } return params; - }, SimpleEndpoint.emptyMap(), true, SplitResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.copySettings); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + this.target.hashCode(); + result = 31 * result + Objects.hashCode(this.taskExecutionTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SplitRequest other = (SplitRequest) o; + return Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.copySettings, other.copySettings) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.settings, other.settings) + && this.target.equals(other.target) + && Objects.equals(this.taskExecutionTimeout, other.taskExecutionTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitResponse.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitResponse.java index d7685dcf03..a7cd1fd5c8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SplitResponse.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,93 +47,130 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.split.Response @JsonpDeserializable -public class SplitResponse extends AcknowledgedResponseBase { - private final boolean shardsAcknowledged; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SplitResponse extends AcknowledgedResponseBase implements ToCopyableBuilder { + @Nonnull private final String index; + private final boolean shardsAcknowledged; + // --------------------------------------------------------------------------------------------- private SplitResponse(Builder builder) { super(builder); - - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - + this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); } - public static SplitResponse of(Function> fn) { + public static SplitResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code shards_acknowledged} + * Required - API name: {@code index} */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; + @Nonnull + public final String index() { + return this.index; } /** - * Required - API name: {@code index} + * Required - API name: {@code shards_acknowledged} */ - public final String index() { - return this.index; + public final boolean shardsAcknowledged() { + return this.shardsAcknowledged; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - generator.writeKey("index"); generator.write(this.index); + generator.writeKey("shards_acknowledged"); + generator.write(this.shardsAcknowledged); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SplitResponse}. */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + private String index; private Boolean shardsAcknowledged; - private String index; + public Builder() {} - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; + private Builder(SplitResponse o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + private Builder(Builder o) { + super(o); + this.index = o.index; + this.shardsAcknowledged = o.shardsAcknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { return this; } /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; } - @Override - protected Builder self() { + /** + * Required - API name: {@code shards_acknowledged} + */ + @Nonnull + public final Builder shardsAcknowledged(boolean value) { + this.shardsAcknowledged = value; return this; } /** * Builds a {@link SplitResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SplitResponse build() { _checkSingleUse(); @@ -146,10 +189,27 @@ public SplitResponse build() { ); protected static void setupSplitResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Boolean.hashCode(this.shardsAcknowledged); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SplitResponse other = (SplitResponse) o; + return this.index.equals(other.index) && this.shardsAcknowledged == other.shardsAcknowledged; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java index e8e47973e1..f4851bf742 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,27 +51,30 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.upgrade.Request /** - * DEPRECATED Upgrades to the current version of Lucene. - * + * The _upgrade API is no longer useful and will be removed. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpgradeRequest extends RequestBase implements ToCopyableBuilder { -public class UpgradeRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; - @Nullable - private final String index; + @Nonnull + private final List index; @Nullable private final Boolean onlyAncientSegments; @@ -75,26 +85,24 @@ public class UpgradeRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private UpgradeRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = builder.index; + this.index = ApiTypeHelper.unmodifiable(builder.index); this.onlyAncientSegments = builder.onlyAncientSegments; this.waitForCompletion = builder.waitForCompletion; - } - public static UpgradeRequest of(Function> fn) { + public static UpgradeRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or when + * no indexes have been specified). *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -102,20 +110,21 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -123,21 +132,21 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. *

* API name: {@code index} + *

*/ - @Nullable - public final String index() { + @Nonnull + public final List index() { return this.index; } /** - * If true, only ancient (an older Lucene major release) segments will be - * upgraded + * If true, only ancient (an older Lucene major release) segments will be upgraded. *

* API name: {@code only_ancient_segments} + *

*/ @Nullable public final Boolean onlyAncientSegments() { @@ -145,10 +154,10 @@ public final Boolean onlyAncientSegments() { } /** - * Specify whether the request should block until the all segments are upgraded - * (default: false) + * Should this request wait until the operation has completed before returning. *

* API name: {@code wait_for_completion} + *

*/ @Nullable public final Boolean waitForCompletion() { @@ -157,106 +166,168 @@ public final Boolean waitForCompletion() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link UpgradeRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - @Nullable - private String index; - + private List index; @Nullable private Boolean onlyAncientSegments; - @Nullable private Boolean waitForCompletion; + public Builder() {} + + private Builder(UpgradeRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.onlyAncientSegments = o.onlyAncientSegments; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.onlyAncientSegments = o.onlyAncientSegments; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or + * when no indexes have been specified). *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. + *

+ * API name: {@code index} + *

+ * + *

+ * Adds all elements of list to index. + *

+ */ + @Nonnull + public final Builder index(List list) { + this.index = _listAddAll(this.index, list); + return this; + } + + /** + * Comma-separated list of indexes; use _all or empty string to perform the operation on all indexes. *

* API name: {@code index} + *

+ * + *

+ * Adds one or more values to index. + *

*/ - public final Builder index(@Nullable String value) { - this.index = value; + @Nonnull + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); return this; } /** - * If true, only ancient (an older Lucene major release) segments will be - * upgraded + * If true, only ancient (an older Lucene major release) segments will be upgraded. *

* API name: {@code only_ancient_segments} + *

*/ + @Nonnull public final Builder onlyAncientSegments(@Nullable Boolean value) { this.onlyAncientSegments = value; return this; } /** - * Specify whether the request should block until the all segments are upgraded - * (default: false) + * Should this request wait until the operation has completed before returning. *

* API name: {@code wait_for_completion} + *

*/ + @Nonnull public final Builder waitForCompletion(@Nullable Boolean value) { this.waitForCompletion = value; return this; @@ -265,9 +336,10 @@ public final Builder waitForCompletion(@Nullable Boolean value) { /** * Builds a {@link UpgradeRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public UpgradeRequest build() { _checkSingleUse(); @@ -281,49 +353,41 @@ public UpgradeRequest build() { * Endpoint "{@code indices.upgrade}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _index = 1 << 0; int propsSet = 0; - if (request.index() != null) propsSet |= _index; + if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_upgrade"); - return buf.toString(); + return "/_upgrade"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_upgrade"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (request.onlyAncientSegments != null) { params.put("only_ancient_segments", String.valueOf(request.onlyAncientSegments)); } @@ -331,10 +395,34 @@ public UpgradeRequest build() { params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); } return params; - }, SimpleEndpoint.emptyMap(), false, UpgradeResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.onlyAncientSegments); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpgradeRequest other = (UpgradeRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.onlyAncientSegments, other.onlyAncientSegments) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java new file mode 100644 index 0000000000..b6a6d604fd --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java @@ -0,0 +1,228 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.ShardsOperationResponseBase; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.upgrade.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpgradeResponse extends ShardsOperationResponseBase implements ToCopyableBuilder { + + @Nonnull + private final Map upgradedIndices; + + // --------------------------------------------------------------------------------------------- + + private UpgradeResponse(Builder builder) { + super(builder); + this.upgradedIndices = ApiTypeHelper.unmodifiable(builder.upgradedIndices); + } + + public static UpgradeResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code upgraded_indices} + */ + @Nonnull + public final Map upgradedIndices() { + return this.upgradedIndices; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.upgradedIndices)) { + generator.writeKey("upgraded_indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.upgradedIndices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpgradeResponse}. + */ + public static class Builder extends ShardsOperationResponseBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private Map upgradedIndices; + + public Builder() {} + + private Builder(UpgradeResponse o) { + super(o); + this.upgradedIndices = _mapCopy(o.upgradedIndices); + } + + private Builder(Builder o) { + super(o); + this.upgradedIndices = _mapCopy(o.upgradedIndices); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code upgraded_indices} + * + *

+ * Adds all elements of map to upgradedIndices. + *

+ */ + @Nonnull + public final Builder upgradedIndices(Map map) { + this.upgradedIndices = _mapPutAll(this.upgradedIndices, map); + return this; + } + + /** + * API name: {@code upgraded_indices} + * + *

+ * Adds an entry to upgradedIndices. + *

+ */ + @Nonnull + public final Builder upgradedIndices(String key, UpgradeVersionStatus value) { + this.upgradedIndices = _mapPut(this.upgradedIndices, key, value); + return this; + } + + /** + * API name: {@code upgraded_indices} + * + *

+ * Adds a value to upgradedIndices using a builder lambda. + *

+ */ + @Nonnull + public final Builder upgradedIndices(String key, Function> fn) { + return upgradedIndices(key, fn.apply(new UpgradeVersionStatus.Builder()).build()); + } + + /** + * Builds a {@link UpgradeResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpgradeResponse build() { + _checkSingleUse(); + + return new UpgradeResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpgradeResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpgradeResponse::setupUpgradeResponseDeserializer + ); + + protected static void setupUpgradeResponseDeserializer(ObjectDeserializer op) { + setupShardsOperationResponseBaseDeserializer(op); + op.add(Builder::upgradedIndices, JsonpDeserializer.stringMapDeserializer(UpgradeVersionStatus._DESERIALIZER), "upgraded_indices"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.upgradedIndices); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpgradeResponse other = (UpgradeResponse) o; + return Objects.equals(this.upgradedIndices, other.upgradedIndices); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeStatus.java new file mode 100644 index 0000000000..548bf128f8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeStatus.java @@ -0,0 +1,253 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.UpgradeStatus + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpgradeStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long sizeInBytes; + + @Nullable + private final Long sizeToUpgradeAncientInBytes; + + @Nullable + private final Long sizeToUpgradeInBytes; + + // --------------------------------------------------------------------------------------------- + + private UpgradeStatus(Builder builder) { + this.sizeInBytes = builder.sizeInBytes; + this.sizeToUpgradeAncientInBytes = builder.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = builder.sizeToUpgradeInBytes; + } + + public static UpgradeStatus of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code size_in_bytes} + */ + @Nullable + public final Long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * API name: {@code size_to_upgrade_ancient_in_bytes} + */ + @Nullable + public final Long sizeToUpgradeAncientInBytes() { + return this.sizeToUpgradeAncientInBytes; + } + + /** + * API name: {@code size_to_upgrade_in_bytes} + */ + @Nullable + public final Long sizeToUpgradeInBytes() { + return this.sizeToUpgradeInBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.sizeInBytes != null) { + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + } + + if (this.sizeToUpgradeAncientInBytes != null) { + generator.writeKey("size_to_upgrade_ancient_in_bytes"); + generator.write(this.sizeToUpgradeAncientInBytes); + } + + if (this.sizeToUpgradeInBytes != null) { + generator.writeKey("size_to_upgrade_in_bytes"); + generator.write(this.sizeToUpgradeInBytes); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpgradeStatus}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long sizeInBytes; + @Nullable + private Long sizeToUpgradeAncientInBytes; + @Nullable + private Long sizeToUpgradeInBytes; + + public Builder() {} + + private Builder(UpgradeStatus o) { + this.sizeInBytes = o.sizeInBytes; + this.sizeToUpgradeAncientInBytes = o.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = o.sizeToUpgradeInBytes; + } + + private Builder(Builder o) { + this.sizeInBytes = o.sizeInBytes; + this.sizeToUpgradeAncientInBytes = o.sizeToUpgradeAncientInBytes; + this.sizeToUpgradeInBytes = o.sizeToUpgradeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code size_in_bytes} + */ + @Nonnull + public final Builder sizeInBytes(@Nullable Long value) { + this.sizeInBytes = value; + return this; + } + + /** + * API name: {@code size_to_upgrade_ancient_in_bytes} + */ + @Nonnull + public final Builder sizeToUpgradeAncientInBytes(@Nullable Long value) { + this.sizeToUpgradeAncientInBytes = value; + return this; + } + + /** + * API name: {@code size_to_upgrade_in_bytes} + */ + @Nonnull + public final Builder sizeToUpgradeInBytes(@Nullable Long value) { + this.sizeToUpgradeInBytes = value; + return this; + } + + /** + * Builds a {@link UpgradeStatus}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpgradeStatus build() { + _checkSingleUse(); + + return new UpgradeStatus(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpgradeStatus} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpgradeStatus::setupUpgradeStatusDeserializer + ); + + protected static void setupUpgradeStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + op.add(Builder::sizeToUpgradeAncientInBytes, JsonpDeserializer.longDeserializer(), "size_to_upgrade_ancient_in_bytes"); + op.add(Builder::sizeToUpgradeInBytes, JsonpDeserializer.longDeserializer(), "size_to_upgrade_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.sizeInBytes); + result = 31 * result + Objects.hashCode(this.sizeToUpgradeAncientInBytes); + result = 31 * result + Objects.hashCode(this.sizeToUpgradeInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpgradeStatus other = (UpgradeStatus) o; + return Objects.equals(this.sizeInBytes, other.sizeInBytes) + && Objects.equals(this.sizeToUpgradeAncientInBytes, other.sizeToUpgradeAncientInBytes) + && Objects.equals(this.sizeToUpgradeInBytes, other.sizeToUpgradeInBytes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeVersionStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeVersionStatus.java new file mode 100644 index 0000000000..38cb860522 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/UpgradeVersionStatus.java @@ -0,0 +1,220 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.UpgradeVersionStatus + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpgradeVersionStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String oldestLuceneSegmentVersion; + + @Nullable + private final String upgradeVersion; + + // --------------------------------------------------------------------------------------------- + + private UpgradeVersionStatus(Builder builder) { + this.oldestLuceneSegmentVersion = builder.oldestLuceneSegmentVersion; + this.upgradeVersion = builder.upgradeVersion; + } + + public static UpgradeVersionStatus of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code oldest_lucene_segment_version} + */ + @Nullable + public final String oldestLuceneSegmentVersion() { + return this.oldestLuceneSegmentVersion; + } + + /** + * API name: {@code upgrade_version} + */ + @Nullable + public final String upgradeVersion() { + return this.upgradeVersion; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.oldestLuceneSegmentVersion != null) { + generator.writeKey("oldest_lucene_segment_version"); + generator.write(this.oldestLuceneSegmentVersion); + } + + if (this.upgradeVersion != null) { + generator.writeKey("upgrade_version"); + generator.write(this.upgradeVersion); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpgradeVersionStatus}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String oldestLuceneSegmentVersion; + @Nullable + private String upgradeVersion; + + public Builder() {} + + private Builder(UpgradeVersionStatus o) { + this.oldestLuceneSegmentVersion = o.oldestLuceneSegmentVersion; + this.upgradeVersion = o.upgradeVersion; + } + + private Builder(Builder o) { + this.oldestLuceneSegmentVersion = o.oldestLuceneSegmentVersion; + this.upgradeVersion = o.upgradeVersion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code oldest_lucene_segment_version} + */ + @Nonnull + public final Builder oldestLuceneSegmentVersion(@Nullable String value) { + this.oldestLuceneSegmentVersion = value; + return this; + } + + /** + * API name: {@code upgrade_version} + */ + @Nonnull + public final Builder upgradeVersion(@Nullable String value) { + this.upgradeVersion = value; + return this; + } + + /** + * Builds a {@link UpgradeVersionStatus}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpgradeVersionStatus build() { + _checkSingleUse(); + + return new UpgradeVersionStatus(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpgradeVersionStatus} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpgradeVersionStatus::setupUpgradeVersionStatusDeserializer + ); + + protected static void setupUpgradeVersionStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::oldestLuceneSegmentVersion, JsonpDeserializer.stringDeserializer(), "oldest_lucene_segment_version"); + op.add(Builder::upgradeVersion, JsonpDeserializer.stringDeserializer(), "upgrade_version"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.oldestLuceneSegmentVersion); + result = 31 * result + Objects.hashCode(this.upgradeVersion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpgradeVersionStatus other = (UpgradeVersionStatus) o; + return Objects.equals(this.oldestLuceneSegmentVersion, other.oldestLuceneSegmentVersion) + && Objects.equals(this.upgradeVersion, other.upgradeVersion); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java index 2446f53dd2..d6c93d2e29 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryRequest.java @@ -30,14 +30,21 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -53,17 +60,23 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.validate_query.Request /** * Allows a user to validate a potentially expensive query without executing it. - * */ @JsonpDeserializable -public class ValidateQueryRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ValidateQueryRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Boolean allShards; @@ -82,6 +95,7 @@ public class ValidateQueryRequest extends RequestBase implements PlainJsonSerial @Nullable private final String df; + @Nonnull private final List expandWildcards; @Nullable @@ -90,6 +104,7 @@ public class ValidateQueryRequest extends RequestBase implements PlainJsonSerial @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -107,7 +122,6 @@ public class ValidateQueryRequest extends RequestBase implements PlainJsonSerial // --------------------------------------------------------------------------------------------- private ValidateQueryRequest(Builder builder) { - this.allShards = builder.allShards; this.allowNoIndices = builder.allowNoIndices; this.analyzeWildcard = builder.analyzeWildcard; @@ -122,17 +136,17 @@ private ValidateQueryRequest(Builder builder) { this.q = builder.q; this.query = builder.query; this.rewrite = builder.rewrite; - } - public static ValidateQueryRequest of(Function> fn) { + public static ValidateQueryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Execute validation on all shards instead of one random shard per index + * If true, the validation is executed on all shards instead of one random shard per index. *

* API name: {@code all_shards} + *

*/ @Nullable public final Boolean allShards() { @@ -140,11 +154,11 @@ public final Boolean allShards() { } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -152,10 +166,10 @@ public final Boolean allowNoIndices() { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} + *

*/ @Nullable public final Boolean analyzeWildcard() { @@ -163,9 +177,10 @@ public final Boolean analyzeWildcard() { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. This parameter can only be used when the q query string parameter is specified. *

* API name: {@code analyzer} + *

*/ @Nullable public final String analyzer() { @@ -173,9 +188,10 @@ public final String analyzer() { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or OR. *

* API name: {@code default_operator} + *

*/ @Nullable public final Operator defaultOperator() { @@ -183,10 +199,11 @@ public final Operator defaultOperator() { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q + * query string parameter is specified. *

* API name: {@code df} + *

*/ @Nullable public final String df() { @@ -194,19 +211,23 @@ public final String df() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Return detailed information about the error + * If true, the response returns detailed information if an error has occurred. *

* API name: {@code explain} + *

*/ @Nullable public final Boolean explain() { @@ -214,10 +235,10 @@ public final Boolean explain() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -225,20 +246,22 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names to restrict the operation; use - * _all or empty string to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). To search all data streams + * or indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. *

* API name: {@code lenient} + *

*/ @Nullable public final Boolean lenient() { @@ -246,9 +269,10 @@ public final Boolean lenient() { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} + *

*/ @Nullable public final String q() { @@ -264,10 +288,10 @@ public final Query query() { } /** - * Provide a more detailed explanation showing the actual Lucene query that will - * be executed. + * If true, returns a more detailed explanation showing the actual Lucene query that will be executed. *

* API name: {@code rewrite} + *

*/ @Nullable public final Boolean rewrite() { @@ -277,6 +301,7 @@ public final Boolean rewrite() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -284,217 +309,288 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.query != null) { generator.writeKey("query"); this.query.serialize(generator, mapper); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ValidateQueryRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allShards; - @Nullable private Boolean allowNoIndices; - @Nullable private Boolean analyzeWildcard; - @Nullable private String analyzer; - @Nullable private Operator defaultOperator; - @Nullable private String df; - @Nullable private List expandWildcards; - @Nullable private Boolean explain; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Boolean lenient; - @Nullable private String q; - @Nullable private Query query; - @Nullable private Boolean rewrite; + public Builder() {} + + private Builder(ValidateQueryRequest o) { + this.allShards = o.allShards; + this.allowNoIndices = o.allowNoIndices; + this.analyzeWildcard = o.analyzeWildcard; + this.analyzer = o.analyzer; + this.defaultOperator = o.defaultOperator; + this.df = o.df; + this.expandWildcards = _listCopy(o.expandWildcards); + this.explain = o.explain; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.lenient = o.lenient; + this.q = o.q; + this.query = o.query; + this.rewrite = o.rewrite; + } + + private Builder(Builder o) { + this.allShards = o.allShards; + this.allowNoIndices = o.allowNoIndices; + this.analyzeWildcard = o.analyzeWildcard; + this.analyzer = o.analyzer; + this.defaultOperator = o.defaultOperator; + this.df = o.df; + this.expandWildcards = _listCopy(o.expandWildcards); + this.explain = o.explain; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.lenient = o.lenient; + this.q = o.q; + this.query = o.query; + this.rewrite = o.rewrite; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Execute validation on all shards instead of one random shard per index + * If true, the validation is executed on all shards instead of one random shard per index. *

* API name: {@code all_shards} + *

*/ + @Nonnull public final Builder allShards(@Nullable Boolean value) { this.allShards = value; return this; } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} + *

*/ + @Nonnull public final Builder analyzeWildcard(@Nullable Boolean value) { this.analyzeWildcard = value; return this; } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. This parameter can only be used when the q query string parameter is + * specified. *

* API name: {@code analyzer} + *

*/ + @Nonnull public final Builder analyzer(@Nullable String value) { this.analyzer = value; return this; } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or OR. *

* API name: {@code default_operator} + *

*/ + @Nonnull public final Builder defaultOperator(@Nullable Operator value) { this.defaultOperator = value; return this; } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. This parameter can only be used when the + * q query string parameter is specified. *

* API name: {@code df} + *

*/ + @Nonnull public final Builder df(@Nullable String value) { this.df = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Return detailed information about the error + * If true, the response returns detailed information if an error has occurred. *

* API name: {@code explain} + *

*/ + @Nonnull public final Builder explain(@Nullable Boolean value) { this.explain = value; return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names to restrict the operation; use - * _all or empty string to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). To search all data + * streams or indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names to restrict the operation; use - * _all or empty string to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases to search. Supports wildcards (*). To search all data + * streams or indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to a numeric field) in the query string will be + * ignored. *

* API name: {@code lenient} + *

*/ + @Nonnull public final Builder lenient(@Nullable Boolean value) { this.lenient = value; return this; } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} + *

*/ + @Nonnull public final Builder q(@Nullable String value) { this.q = value; return this; @@ -503,6 +599,7 @@ public final Builder q(@Nullable String value) { /** * API name: {@code query} */ + @Nonnull public final Builder query(@Nullable Query value) { this.query = value; return this; @@ -511,16 +608,18 @@ public final Builder query(@Nullable Query value) { /** * API name: {@code query} */ + @Nonnull public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); + return query(fn.apply(new Query.Builder()).build()); } /** - * Provide a more detailed explanation showing the actual Lucene query that will - * be executed. + * If true, returns a more detailed explanation showing the actual Lucene query that will be executed. *

* API name: {@code rewrite} + *

*/ + @Nonnull public final Builder rewrite(@Nullable Boolean value) { this.rewrite = value; return this; @@ -529,9 +628,10 @@ public final Builder rewrite(@Nullable Boolean value) { /** * Builds a {@link ValidateQueryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ValidateQueryRequest build() { _checkSingleUse(); @@ -550,9 +650,7 @@ public ValidateQueryRequest build() { ); protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::query, Query._DESERIALIZER, "query"); - } // --------------------------------------------------------------------------------------------- @@ -561,13 +659,8 @@ protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _index = 1 << 0; @@ -577,67 +670,102 @@ protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer v).collect(Collectors.joining(",")), buf); - buf.append("/_validate"); - buf.append("/query"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_validate/query"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.explain != null) { - params.put("explain", String.valueOf(request.explain)); + if (request.allShards != null) { + params.put("all_shards", String.valueOf(request.allShards)); } - if (request.q != null) { - params.put("q", request.q); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } - if (request.df != null) { - params.put("df", request.df); + if (request.analyzeWildcard != null) { + params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard)); + } + if (request.analyzer != null) { + params.put("analyzer", request.analyzer); } if (request.defaultOperator != null) { params.put("default_operator", request.defaultOperator.jsonValue()); } - if (request.allShards != null) { - params.put("all_shards", String.valueOf(request.allShards)); + if (request.df != null) { + params.put("df", request.df); } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.explain != null) { + params.put("explain", String.valueOf(request.explain)); + } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.analyzer != null) { - params.put("analyzer", request.analyzer); - } - if (request.analyzeWildcard != null) { - params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard)); - } if (request.lenient != null) { params.put("lenient", String.valueOf(request.lenient)); } + if (request.q != null) { + params.put("q", request.q); + } if (request.rewrite != null) { params.put("rewrite", String.valueOf(request.rewrite)); } return params; - }, SimpleEndpoint.emptyMap(), true, ValidateQueryResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allShards); + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.analyzeWildcard); + result = 31 * result + Objects.hashCode(this.analyzer); + result = 31 * result + Objects.hashCode(this.defaultOperator); + result = 31 * result + Objects.hashCode(this.df); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.explain); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.lenient); + result = 31 * result + Objects.hashCode(this.q); + result = 31 * result + Objects.hashCode(this.query); + result = 31 * result + Objects.hashCode(this.rewrite); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ValidateQueryRequest other = (ValidateQueryRequest) o; + return Objects.equals(this.allShards, other.allShards) + && Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.analyzeWildcard, other.analyzeWildcard) + && Objects.equals(this.analyzer, other.analyzer) + && Objects.equals(this.defaultOperator, other.defaultOperator) + && Objects.equals(this.df, other.df) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.explain, other.explain) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.lenient, other.lenient) + && Objects.equals(this.q, other.q) + && Objects.equals(this.query, other.query) + && Objects.equals(this.rewrite, other.rewrite); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java index af16f7c178..090cabaa3a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ValidateQueryResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,13 +52,24 @@ import org.opensearch.client.opensearch._types.ShardStatistics; import org.opensearch.client.opensearch.indices.validate_query.IndicesValidationExplanation; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.validate_query.Response @JsonpDeserializable -public class ValidateQueryResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ValidateQueryResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String error; + + @Nonnull private final List explanations; @Nullable @@ -59,27 +77,31 @@ public class ValidateQueryResponse implements PlainJsonSerializable { private final boolean valid; - @Nullable - private final String error; - // --------------------------------------------------------------------------------------------- private ValidateQueryResponse(Builder builder) { - + this.error = builder.error; this.explanations = ApiTypeHelper.unmodifiable(builder.explanations); this.shards = builder.shards; this.valid = ApiTypeHelper.requireNonNull(builder.valid, this, "valid"); - this.error = builder.error; - } - public static ValidateQueryResponse of(Function> fn) { + public static ValidateQueryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code error} + */ + @Nullable + public final String error() { + return this.error; + } + /** * API name: {@code explanations} */ + @Nonnull public final List explanations() { return this.explanations; } @@ -99,17 +121,10 @@ public final boolean valid() { return this.valid; } - /** - * API name: {@code error} - */ - @Nullable - public final String error() { - return this.error; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -117,56 +132,93 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.error != null) { + generator.writeKey("error"); + generator.write(this.error); + } if (ApiTypeHelper.isDefined(this.explanations)) { generator.writeKey("explanations"); generator.writeStartArray(); for (IndicesValidationExplanation item0 : this.explanations) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.shards != null) { generator.writeKey("_shards"); this.shards.serialize(generator, mapper); - } + generator.writeKey("valid"); generator.write(this.valid); + } - if (this.error != null) { - generator.writeKey("error"); - generator.write(this.error); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ValidateQueryResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String error; @Nullable private List explanations; - @Nullable private ShardStatistics shards; - private Boolean valid; - @Nullable - private String error; + public Builder() {} + + private Builder(ValidateQueryResponse o) { + this.error = o.error; + this.explanations = _listCopy(o.explanations); + this.shards = o.shards; + this.valid = o.valid; + } + + private Builder(Builder o) { + this.error = o.error; + this.explanations = _listCopy(o.explanations); + this.shards = o.shards; + this.valid = o.valid; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code error} + */ + @Nonnull + public final Builder error(@Nullable String value) { + this.error = value; + return this; + } /** * API name: {@code explanations} + * *

* Adds all elements of list to explanations. + *

*/ + @Nonnull public final Builder explanations(List list) { this.explanations = _listAddAll(this.explanations, list); return this; @@ -174,9 +226,12 @@ public final Builder explanations(List list) { /** * API name: {@code explanations} + * *

* Adds one or more values to explanations. + *

*/ + @Nonnull public final Builder explanations(IndicesValidationExplanation value, IndicesValidationExplanation... values) { this.explanations = _listAdd(this.explanations, value, values); return this; @@ -184,9 +239,12 @@ public final Builder explanations(IndicesValidationExplanation value, IndicesVal /** * API name: {@code explanations} + * *

* Adds a value to explanations using a builder lambda. + *

*/ + @Nonnull public final Builder explanations(Function> fn) { return explanations(fn.apply(new IndicesValidationExplanation.Builder()).build()); } @@ -194,6 +252,7 @@ public final Builder explanations(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } /** * Required - API name: {@code valid} */ + @Nonnull public final Builder valid(boolean value) { this.valid = value; return this; } - /** - * API name: {@code error} - */ - public final Builder error(@Nullable String value) { - this.error = value; - return this; - } - /** * Builds a {@link ValidateQueryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ValidateQueryResponse build() { _checkSingleUse(); @@ -246,12 +300,30 @@ public ValidateQueryResponse build() { ); protected static void setupValidateQueryResponseDeserializer(ObjectDeserializer op) { - + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); op.add(Builder::explanations, JsonpDeserializer.arrayDeserializer(IndicesValidationExplanation._DESERIALIZER), "explanations"); op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(Builder::valid, JsonpDeserializer.booleanDeserializer(), "valid"); - op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.error); + result = 31 * result + Objects.hashCode(this.explanations); + result = 31 * result + Objects.hashCode(this.shards); + result = 31 * result + Boolean.hashCode(this.valid); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ValidateQueryResponse other = (ValidateQueryResponse) o; + return Objects.equals(this.error, other.error) + && Objects.equals(this.explanations, other.explanations) + && Objects.equals(this.shards, other.shards) + && this.valid == other.valid; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java index 4be8f6a5db..5f8aa9dafd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseIndexResult.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.close; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,27 +50,30 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.close.CloseIndexResult @JsonpDeserializable -public class CloseIndexResult implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloseIndexResult implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean closed; + @Nonnull private final Map shards; // --------------------------------------------------------------------------------------------- private CloseIndexResult(Builder builder) { - this.closed = ApiTypeHelper.requireNonNull(builder.closed, this, "closed"); this.shards = ApiTypeHelper.unmodifiable(builder.shards); - } - public static CloseIndexResult of(Function> fn) { + public static CloseIndexResult of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -77,6 +87,7 @@ public final boolean closed() { /** * API name: {@code shards} */ + @Nonnull public final Map shards() { return this.shards; } @@ -84,6 +95,7 @@ public final Map shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -91,7 +103,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("closed"); generator.write(this.closed); @@ -101,29 +112,54 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.shards.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CloseIndexResult}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean closed; - @Nullable private Map shards; + public Builder() {} + + private Builder(CloseIndexResult o) { + this.closed = o.closed; + this.shards = _mapCopy(o.shards); + } + + private Builder(Builder o) { + this.closed = o.closed; + this.shards = _mapCopy(o.shards); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code closed} */ + @Nonnull public final Builder closed(boolean value) { this.closed = value; return this; @@ -131,9 +167,12 @@ public final Builder closed(boolean value) { /** * API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ + @Nonnull public final Builder shards(Map map) { this.shards = _mapPutAll(this.shards, map); return this; @@ -141,9 +180,12 @@ public final Builder shards(Map map) { /** * API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ + @Nonnull public final Builder shards(String key, CloseShardResult value) { this.shards = _mapPut(this.shards, key, value); return this; @@ -151,9 +193,12 @@ public final Builder shards(String key, CloseShardResult value) { /** * API name: {@code shards} + * *

- * Adds an entry to shards using a builder lambda. + * Adds a value to shards using a builder lambda. + *

*/ + @Nonnull public final Builder shards(String key, Function> fn) { return shards(key, fn.apply(new CloseShardResult.Builder()).build()); } @@ -161,9 +206,10 @@ public final Builder shards(String key, Function op) { - op.add(Builder::closed, JsonpDeserializer.booleanDeserializer(), "closed"); op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(CloseShardResult._DESERIALIZER), "shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.closed); + result = 31 * result + Objects.hashCode(this.shards); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloseIndexResult other = (CloseIndexResult) o; + return this.closed == other.closed && Objects.equals(this.shards, other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java index f8fa17239d..2b30d5be06 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/close/CloseShardResult.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.close; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,30 +49,34 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ShardFailure; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.close.CloseShardResult @JsonpDeserializable -public class CloseShardResult implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CloseShardResult implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final List failures; // --------------------------------------------------------------------------------------------- private CloseShardResult(Builder builder) { - this.failures = ApiTypeHelper.unmodifiableRequired(builder.failures, this, "failures"); - } - public static CloseShardResult of(Function> fn) { + public static CloseShardResult of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code failures} */ + @Nonnull public final List failures() { return this.failures; } @@ -74,6 +84,7 @@ public final List failures() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,34 +92,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (ShardFailure item0 : this.failures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("failures"); + generator.writeStartArray(); + for (ShardFailure item0 : this.failures) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CloseShardResult}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List failures; + public Builder() {} + + private Builder(CloseShardResult o) { + this.failures = _listCopy(o.failures); + } + + private Builder(Builder o) { + this.failures = _listCopy(o.failures); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code failures} + * *

* Adds all elements of list to failures. + *

*/ + @Nonnull public final Builder failures(List list) { this.failures = _listAddAll(this.failures, list); return this; @@ -116,9 +150,12 @@ public final Builder failures(List list) { /** * Required - API name: {@code failures} + * *

* Adds one or more values to failures. + *

*/ + @Nonnull public final Builder failures(ShardFailure value, ShardFailure... values) { this.failures = _listAdd(this.failures, value, values); return this; @@ -126,9 +163,12 @@ public final Builder failures(ShardFailure value, ShardFailure... values) { /** * Required - API name: {@code failures} + * *

* Adds a value to failures using a builder lambda. + *

*/ + @Nonnull public final Builder failures(Function> fn) { return failures(fn.apply(new ShardFailure.Builder()).build()); } @@ -136,9 +176,10 @@ public final Builder failures(Function op) { - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.failures.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CloseShardResult other = (CloseShardResult) o; + return this.failures.equals(other.failures); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java index 0c3ba07c18..7118f24ba8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/FileDetails.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,15 +47,20 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.FileDetails @JsonpDeserializable -public class FileDetails implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FileDetails implements PlainJsonSerializable, ToCopyableBuilder { + private final long length; + @Nonnull private final String name; private final long recovered; @@ -57,14 +68,12 @@ public class FileDetails implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private FileDetails(Builder builder) { - this.length = ApiTypeHelper.requireNonNull(builder.length, this, "length"); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.recovered = ApiTypeHelper.requireNonNull(builder.recovered, this, "recovered"); - } - public static FileDetails of(Function> fn) { + public static FileDetails of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -78,6 +87,7 @@ public final long length() { /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } @@ -92,6 +102,7 @@ public final long recovered() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +110,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("length"); generator.write(this.length); @@ -108,25 +118,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("recovered"); generator.write(this.recovered); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FileDetails}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long length; - private String name; - private Long recovered; + public Builder() {} + + private Builder(FileDetails o) { + this.length = o.length; + this.name = o.name; + this.recovered = o.recovered; + } + + private Builder(Builder o) { + this.length = o.length; + this.name = o.name; + this.recovered = o.recovered; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code length} */ + @Nonnull public final Builder length(long value) { this.length = value; return this; @@ -135,6 +173,7 @@ public final Builder length(long value) { /** * Required - API name: {@code name} */ + @Nonnull public final Builder name(String value) { this.name = value; return this; @@ -143,6 +182,7 @@ public final Builder name(String value) { /** * Required - API name: {@code recovered} */ + @Nonnull public final Builder recovered(long value) { this.recovered = value; return this; @@ -151,9 +191,10 @@ public final Builder recovered(long value) { /** * Builds a {@link FileDetails}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FileDetails build() { _checkSingleUse(); @@ -172,11 +213,25 @@ public FileDetails build() { ); protected static void setupFileDetailsDeserializer(ObjectDeserializer op) { - op.add(Builder::length, JsonpDeserializer.longDeserializer(), "length"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::recovered, JsonpDeserializer.longDeserializer(), "recovered"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.length); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Long.hashCode(this.recovered); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FileDetails other = (FileDetails) o; + return this.length == other.length && this.name.equals(other.name) && this.recovered == other.recovered; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java index 858ee50852..fe76c15876 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryBytes.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,59 +49,63 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.RecoveryBytes @JsonpDeserializable -public class RecoveryBytes implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryBytes implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String percent; @Nullable private final String recovered; - private final String recoveredInBytes; - @Nullable private final String recoveredFromSnapshot; @Nullable - private final String recoveredFromSnapshotInBytes; + private final Long recoveredFromSnapshotInBytes; + + private final long recoveredInBytes; @Nullable private final String reused; - private final String reusedInBytes; + private final long reusedInBytes; @Nullable private final String total; - private final String totalInBytes; + private final long totalInBytes; // --------------------------------------------------------------------------------------------- private RecoveryBytes(Builder builder) { - this.percent = ApiTypeHelper.requireNonNull(builder.percent, this, "percent"); this.recovered = builder.recovered; - this.recoveredInBytes = ApiTypeHelper.requireNonNull(builder.recoveredInBytes, this, "recoveredInBytes"); this.recoveredFromSnapshot = builder.recoveredFromSnapshot; this.recoveredFromSnapshotInBytes = builder.recoveredFromSnapshotInBytes; + this.recoveredInBytes = ApiTypeHelper.requireNonNull(builder.recoveredInBytes, this, "recoveredInBytes"); this.reused = builder.reused; this.reusedInBytes = ApiTypeHelper.requireNonNull(builder.reusedInBytes, this, "reusedInBytes"); this.total = builder.total; this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes"); - } - public static RecoveryBytes of(Function> fn) { + public static RecoveryBytes of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code percent} */ + @Nonnull public final String percent() { return this.percent; } @@ -107,13 +118,6 @@ public final String recovered() { return this.recovered; } - /** - * Required - API name: {@code recovered_in_bytes} - */ - public final String recoveredInBytes() { - return this.recoveredInBytes; - } - /** * API name: {@code recovered_from_snapshot} */ @@ -126,10 +130,17 @@ public final String recoveredFromSnapshot() { * API name: {@code recovered_from_snapshot_in_bytes} */ @Nullable - public final String recoveredFromSnapshotInBytes() { + public final Long recoveredFromSnapshotInBytes() { return this.recoveredFromSnapshotInBytes; } + /** + * Required - API name: {@code recovered_in_bytes} + */ + public final long recoveredInBytes() { + return this.recoveredInBytes; + } + /** * API name: {@code reused} */ @@ -141,7 +152,7 @@ public final String reused() { /** * Required - API name: {@code reused_in_bytes} */ - public final String reusedInBytes() { + public final long reusedInBytes() { return this.reusedInBytes; } @@ -156,13 +167,14 @@ public final String total() { /** * Required - API name: {@code total_in_bytes} */ - public final String totalInBytes() { + public final long totalInBytes() { return this.totalInBytes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -170,79 +182,112 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("percent"); generator.write(this.percent); if (this.recovered != null) { generator.writeKey("recovered"); generator.write(this.recovered); - } - generator.writeKey("recovered_in_bytes"); - generator.write(this.recoveredInBytes); if (this.recoveredFromSnapshot != null) { generator.writeKey("recovered_from_snapshot"); generator.write(this.recoveredFromSnapshot); - } + if (this.recoveredFromSnapshotInBytes != null) { generator.writeKey("recovered_from_snapshot_in_bytes"); generator.write(this.recoveredFromSnapshotInBytes); - } + + generator.writeKey("recovered_in_bytes"); + generator.write(this.recoveredInBytes); + if (this.reused != null) { generator.writeKey("reused"); generator.write(this.reused); - } + generator.writeKey("reused_in_bytes"); generator.write(this.reusedInBytes); if (this.total != null) { generator.writeKey("total"); generator.write(this.total); - } + generator.writeKey("total_in_bytes"); generator.write(this.totalInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryBytes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String percent; - @Nullable private String recovered; - - private String recoveredInBytes; - @Nullable private String recoveredFromSnapshot; - @Nullable - private String recoveredFromSnapshotInBytes; - + private Long recoveredFromSnapshotInBytes; + private Long recoveredInBytes; @Nullable private String reused; - - private String reusedInBytes; - + private Long reusedInBytes; @Nullable private String total; + private Long totalInBytes; + + public Builder() {} + + private Builder(RecoveryBytes o) { + this.percent = o.percent; + this.recovered = o.recovered; + this.recoveredFromSnapshot = o.recoveredFromSnapshot; + this.recoveredFromSnapshotInBytes = o.recoveredFromSnapshotInBytes; + this.recoveredInBytes = o.recoveredInBytes; + this.reused = o.reused; + this.reusedInBytes = o.reusedInBytes; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + } + + private Builder(Builder o) { + this.percent = o.percent; + this.recovered = o.recovered; + this.recoveredFromSnapshot = o.recoveredFromSnapshot; + this.recoveredFromSnapshotInBytes = o.recoveredFromSnapshotInBytes; + this.recoveredInBytes = o.recoveredInBytes; + this.reused = o.reused; + this.reusedInBytes = o.reusedInBytes; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + } - private String totalInBytes; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code percent} */ + @Nonnull public final Builder percent(String value) { this.percent = value; return this; @@ -251,22 +296,16 @@ public final Builder percent(String value) { /** * API name: {@code recovered} */ + @Nonnull public final Builder recovered(@Nullable String value) { this.recovered = value; return this; } - /** - * Required - API name: {@code recovered_in_bytes} - */ - public final Builder recoveredInBytes(String value) { - this.recoveredInBytes = value; - return this; - } - /** * API name: {@code recovered_from_snapshot} */ + @Nonnull public final Builder recoveredFromSnapshot(@Nullable String value) { this.recoveredFromSnapshot = value; return this; @@ -275,14 +314,25 @@ public final Builder recoveredFromSnapshot(@Nullable String value) { /** * API name: {@code recovered_from_snapshot_in_bytes} */ - public final Builder recoveredFromSnapshotInBytes(@Nullable String value) { + @Nonnull + public final Builder recoveredFromSnapshotInBytes(@Nullable Long value) { this.recoveredFromSnapshotInBytes = value; return this; } + /** + * Required - API name: {@code recovered_in_bytes} + */ + @Nonnull + public final Builder recoveredInBytes(long value) { + this.recoveredInBytes = value; + return this; + } + /** * API name: {@code reused} */ + @Nonnull public final Builder reused(@Nullable String value) { this.reused = value; return this; @@ -291,7 +341,8 @@ public final Builder reused(@Nullable String value) { /** * Required - API name: {@code reused_in_bytes} */ - public final Builder reusedInBytes(String value) { + @Nonnull + public final Builder reusedInBytes(long value) { this.reusedInBytes = value; return this; } @@ -299,6 +350,7 @@ public final Builder reusedInBytes(String value) { /** * API name: {@code total} */ + @Nonnull public final Builder total(@Nullable String value) { this.total = value; return this; @@ -307,7 +359,8 @@ public final Builder total(@Nullable String value) { /** * Required - API name: {@code total_in_bytes} */ - public final Builder totalInBytes(String value) { + @Nonnull + public final Builder totalInBytes(long value) { this.totalInBytes = value; return this; } @@ -315,9 +368,10 @@ public final Builder totalInBytes(String value) { /** * Builds a {@link RecoveryBytes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RecoveryBytes build() { _checkSingleUse(); @@ -336,17 +390,45 @@ public RecoveryBytes build() { ); protected static void setupRecoveryBytesDeserializer(ObjectDeserializer op) { - op.add(Builder::percent, JsonpDeserializer.stringDeserializer(), "percent"); op.add(Builder::recovered, JsonpDeserializer.stringDeserializer(), "recovered"); - op.add(Builder::recoveredInBytes, JsonpDeserializer.stringDeserializer(), "recovered_in_bytes"); op.add(Builder::recoveredFromSnapshot, JsonpDeserializer.stringDeserializer(), "recovered_from_snapshot"); - op.add(Builder::recoveredFromSnapshotInBytes, JsonpDeserializer.stringDeserializer(), "recovered_from_snapshot_in_bytes"); + op.add(Builder::recoveredFromSnapshotInBytes, JsonpDeserializer.longDeserializer(), "recovered_from_snapshot_in_bytes"); + op.add(Builder::recoveredInBytes, JsonpDeserializer.longDeserializer(), "recovered_in_bytes"); op.add(Builder::reused, JsonpDeserializer.stringDeserializer(), "reused"); - op.add(Builder::reusedInBytes, JsonpDeserializer.stringDeserializer(), "reused_in_bytes"); + op.add(Builder::reusedInBytes, JsonpDeserializer.longDeserializer(), "reused_in_bytes"); op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); - op.add(Builder::totalInBytes, JsonpDeserializer.stringDeserializer(), "total_in_bytes"); + op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.percent.hashCode(); + result = 31 * result + Objects.hashCode(this.recovered); + result = 31 * result + Objects.hashCode(this.recoveredFromSnapshot); + result = 31 * result + Objects.hashCode(this.recoveredFromSnapshotInBytes); + result = 31 * result + Long.hashCode(this.recoveredInBytes); + result = 31 * result + Objects.hashCode(this.reused); + result = 31 * result + Long.hashCode(this.reusedInBytes); + result = 31 * result + Objects.hashCode(this.total); + result = 31 * result + Long.hashCode(this.totalInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryBytes other = (RecoveryBytes) o; + return this.percent.equals(other.percent) + && Objects.equals(this.recovered, other.recovered) + && Objects.equals(this.recoveredFromSnapshot, other.recoveredFromSnapshot) + && Objects.equals(this.recoveredFromSnapshotInBytes, other.recoveredFromSnapshotInBytes) + && this.recoveredInBytes == other.recoveredInBytes + && Objects.equals(this.reused, other.reused) + && this.reusedInBytes == other.reusedInBytes + && Objects.equals(this.total, other.total) + && this.totalInBytes == other.totalInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java index 023672e241..aae3222d81 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryFiles.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,15 +50,21 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.RecoveryFiles @JsonpDeserializable -public class RecoveryFiles implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryFiles implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final List details; + @Nonnull private final String percent; private final long recovered; @@ -63,22 +76,21 @@ public class RecoveryFiles implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private RecoveryFiles(Builder builder) { - this.details = ApiTypeHelper.unmodifiable(builder.details); this.percent = ApiTypeHelper.requireNonNull(builder.percent, this, "percent"); this.recovered = ApiTypeHelper.requireNonNull(builder.recovered, this, "recovered"); this.reused = ApiTypeHelper.requireNonNull(builder.reused, this, "reused"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - } - public static RecoveryFiles of(Function> fn) { + public static RecoveryFiles of(Function> fn) { return fn.apply(new Builder()).build(); } /** * API name: {@code details} */ + @Nonnull public final List details() { return this.details; } @@ -86,6 +98,7 @@ public final List details() { /** * Required - API name: {@code percent} */ + @Nonnull public final String percent() { return this.percent; } @@ -114,6 +127,7 @@ public final long total() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -121,17 +135,15 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.details)) { generator.writeKey("details"); generator.writeStartArray(); for (FileDetails item0 : this.details) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + generator.writeKey("percent"); generator.write(this.percent); @@ -143,32 +155,64 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total"); generator.write(this.total); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryFiles}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List details; - private String percent; - private Long recovered; - private Long reused; - private Long total; + public Builder() {} + + private Builder(RecoveryFiles o) { + this.details = _listCopy(o.details); + this.percent = o.percent; + this.recovered = o.recovered; + this.reused = o.reused; + this.total = o.total; + } + + private Builder(Builder o) { + this.details = _listCopy(o.details); + this.percent = o.percent; + this.recovered = o.recovered; + this.reused = o.reused; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code details} + * *

* Adds all elements of list to details. + *

*/ + @Nonnull public final Builder details(List list) { this.details = _listAddAll(this.details, list); return this; @@ -176,9 +220,12 @@ public final Builder details(List list) { /** * API name: {@code details} + * *

* Adds one or more values to details. + *

*/ + @Nonnull public final Builder details(FileDetails value, FileDetails... values) { this.details = _listAdd(this.details, value, values); return this; @@ -186,9 +233,12 @@ public final Builder details(FileDetails value, FileDetails... values) { /** * API name: {@code details} + * *

* Adds a value to details using a builder lambda. + *

*/ + @Nonnull public final Builder details(Function> fn) { return details(fn.apply(new FileDetails.Builder()).build()); } @@ -196,6 +246,7 @@ public final Builder details(Function op) { - op.add(Builder::details, JsonpDeserializer.arrayDeserializer(FileDetails._DESERIALIZER), "details"); op.add(Builder::percent, JsonpDeserializer.stringDeserializer(), "percent"); op.add(Builder::recovered, JsonpDeserializer.longDeserializer(), "recovered"); op.add(Builder::reused, JsonpDeserializer.longDeserializer(), "reused"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.details); + result = 31 * result + this.percent.hashCode(); + result = 31 * result + Long.hashCode(this.recovered); + result = 31 * result + Long.hashCode(this.reused); + result = 31 * result + Long.hashCode(this.total); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryFiles other = (RecoveryFiles) o; + return Objects.equals(this.details, other.details) + && this.percent.equals(other.percent) + && this.recovered == other.recovered + && this.reused == other.reused + && this.total == other.total; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java index 963d86fc5a..8681348f8a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryIndexStatus.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,39 +50,44 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.RecoveryIndexStatus @JsonpDeserializable -public class RecoveryIndexStatus implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryIndexStatus implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final RecoveryBytes bytes; + @Nonnull private final RecoveryFiles files; + @Nonnull private final RecoveryBytes size; @Nullable private final Time sourceThrottleTime; - private final String sourceThrottleTimeInMillis; + private final long sourceThrottleTimeInMillis; @Nullable private final Time targetThrottleTime; - private final String targetThrottleTimeInMillis; - - private final String totalTimeInMillis; + private final long targetThrottleTimeInMillis; @Nullable private final Time totalTime; + private final long totalTimeInMillis; + // --------------------------------------------------------------------------------------------- private RecoveryIndexStatus(Builder builder) { - this.bytes = builder.bytes; this.files = ApiTypeHelper.requireNonNull(builder.files, this, "files"); this.size = ApiTypeHelper.requireNonNull(builder.size, this, "size"); @@ -91,12 +103,11 @@ private RecoveryIndexStatus(Builder builder) { this, "targetThrottleTimeInMillis" ); - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); this.totalTime = builder.totalTime; - + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); } - public static RecoveryIndexStatus of(Function> fn) { + public static RecoveryIndexStatus of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -111,6 +122,7 @@ public final RecoveryBytes bytes() { /** * Required - API name: {@code files} */ + @Nonnull public final RecoveryFiles files() { return this.files; } @@ -118,6 +130,7 @@ public final RecoveryFiles files() { /** * Required - API name: {@code size} */ + @Nonnull public final RecoveryBytes size() { return this.size; } @@ -133,7 +146,7 @@ public final Time sourceThrottleTime() { /** * Required - API name: {@code source_throttle_time_in_millis} */ - public final String sourceThrottleTimeInMillis() { + public final long sourceThrottleTimeInMillis() { return this.sourceThrottleTimeInMillis; } @@ -148,17 +161,10 @@ public final Time targetThrottleTime() { /** * Required - API name: {@code target_throttle_time_in_millis} */ - public final String targetThrottleTimeInMillis() { + public final long targetThrottleTimeInMillis() { return this.targetThrottleTimeInMillis; } - /** - * Required - API name: {@code total_time_in_millis} - */ - public final String totalTimeInMillis() { - return this.totalTimeInMillis; - } - /** * API name: {@code total_time} */ @@ -167,9 +173,17 @@ public final Time totalTime() { return this.totalTime; } + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -177,12 +191,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.bytes != null) { generator.writeKey("bytes"); this.bytes.serialize(generator, mapper); - } + generator.writeKey("files"); this.files.serialize(generator, mapper); @@ -192,62 +205,95 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.sourceThrottleTime != null) { generator.writeKey("source_throttle_time"); this.sourceThrottleTime.serialize(generator, mapper); - } + generator.writeKey("source_throttle_time_in_millis"); generator.write(this.sourceThrottleTimeInMillis); if (this.targetThrottleTime != null) { generator.writeKey("target_throttle_time"); this.targetThrottleTime.serialize(generator, mapper); - } + generator.writeKey("target_throttle_time_in_millis"); generator.write(this.targetThrottleTimeInMillis); - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - if (this.totalTime != null) { generator.writeKey("total_time"); this.totalTime.serialize(generator, mapper); - } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryIndexStatus}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private RecoveryBytes bytes; - private RecoveryFiles files; - private RecoveryBytes size; - @Nullable private Time sourceThrottleTime; - - private String sourceThrottleTimeInMillis; - + private Long sourceThrottleTimeInMillis; @Nullable private Time targetThrottleTime; - - private String targetThrottleTimeInMillis; - - private String totalTimeInMillis; - + private Long targetThrottleTimeInMillis; @Nullable private Time totalTime; + private Long totalTimeInMillis; + + public Builder() {} + + private Builder(RecoveryIndexStatus o) { + this.bytes = o.bytes; + this.files = o.files; + this.size = o.size; + this.sourceThrottleTime = o.sourceThrottleTime; + this.sourceThrottleTimeInMillis = o.sourceThrottleTimeInMillis; + this.targetThrottleTime = o.targetThrottleTime; + this.targetThrottleTimeInMillis = o.targetThrottleTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.bytes = o.bytes; + this.files = o.files; + this.size = o.size; + this.sourceThrottleTime = o.sourceThrottleTime; + this.sourceThrottleTimeInMillis = o.sourceThrottleTimeInMillis; + this.targetThrottleTime = o.targetThrottleTime; + this.targetThrottleTimeInMillis = o.targetThrottleTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * API name: {@code bytes} */ + @Nonnull public final Builder bytes(@Nullable RecoveryBytes value) { this.bytes = value; return this; @@ -256,13 +302,15 @@ public final Builder bytes(@Nullable RecoveryBytes value) { /** * API name: {@code bytes} */ + @Nonnull public final Builder bytes(Function> fn) { - return this.bytes(fn.apply(new RecoveryBytes.Builder()).build()); + return bytes(fn.apply(new RecoveryBytes.Builder()).build()); } /** * Required - API name: {@code files} */ + @Nonnull public final Builder files(RecoveryFiles value) { this.files = value; return this; @@ -271,13 +319,15 @@ public final Builder files(RecoveryFiles value) { /** * Required - API name: {@code files} */ + @Nonnull public final Builder files(Function> fn) { - return this.files(fn.apply(new RecoveryFiles.Builder()).build()); + return files(fn.apply(new RecoveryFiles.Builder()).build()); } /** * Required - API name: {@code size} */ + @Nonnull public final Builder size(RecoveryBytes value) { this.size = value; return this; @@ -286,13 +336,15 @@ public final Builder size(RecoveryBytes value) { /** * Required - API name: {@code size} */ + @Nonnull public final Builder size(Function> fn) { - return this.size(fn.apply(new RecoveryBytes.Builder()).build()); + return size(fn.apply(new RecoveryBytes.Builder()).build()); } /** * API name: {@code source_throttle_time} */ + @Nonnull public final Builder sourceThrottleTime(@Nullable Time value) { this.sourceThrottleTime = value; return this; @@ -301,14 +353,16 @@ public final Builder sourceThrottleTime(@Nullable Time value) { /** * API name: {@code source_throttle_time} */ + @Nonnull public final Builder sourceThrottleTime(Function> fn) { - return this.sourceThrottleTime(fn.apply(new Time.Builder()).build()); + return sourceThrottleTime(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code source_throttle_time_in_millis} */ - public final Builder sourceThrottleTimeInMillis(String value) { + @Nonnull + public final Builder sourceThrottleTimeInMillis(long value) { this.sourceThrottleTimeInMillis = value; return this; } @@ -316,6 +370,7 @@ public final Builder sourceThrottleTimeInMillis(String value) { /** * API name: {@code target_throttle_time} */ + @Nonnull public final Builder targetThrottleTime(@Nullable Time value) { this.targetThrottleTime = value; return this; @@ -324,29 +379,24 @@ public final Builder targetThrottleTime(@Nullable Time value) { /** * API name: {@code target_throttle_time} */ + @Nonnull public final Builder targetThrottleTime(Function> fn) { - return this.targetThrottleTime(fn.apply(new Time.Builder()).build()); + return targetThrottleTime(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code target_throttle_time_in_millis} */ - public final Builder targetThrottleTimeInMillis(String value) { + @Nonnull + public final Builder targetThrottleTimeInMillis(long value) { this.targetThrottleTimeInMillis = value; return this; } - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(String value) { - this.totalTimeInMillis = value; - return this; - } - /** * API name: {@code total_time} */ + @Nonnull public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; @@ -355,16 +405,27 @@ public final Builder totalTime(@Nullable Time value) { /** * API name: {@code total_time} */ + @Nonnull public final Builder totalTime(Function> fn) { - return this.totalTime(fn.apply(new Time.Builder()).build()); + return totalTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + @Nonnull + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; } /** * Builds a {@link RecoveryIndexStatus}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RecoveryIndexStatus build() { _checkSingleUse(); @@ -383,17 +444,45 @@ public RecoveryIndexStatus build() { ); protected static void setupRecoveryIndexStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::bytes, RecoveryBytes._DESERIALIZER, "bytes"); op.add(Builder::files, RecoveryFiles._DESERIALIZER, "files"); op.add(Builder::size, RecoveryBytes._DESERIALIZER, "size"); op.add(Builder::sourceThrottleTime, Time._DESERIALIZER, "source_throttle_time"); - op.add(Builder::sourceThrottleTimeInMillis, JsonpDeserializer.stringDeserializer(), "source_throttle_time_in_millis"); + op.add(Builder::sourceThrottleTimeInMillis, JsonpDeserializer.longDeserializer(), "source_throttle_time_in_millis"); op.add(Builder::targetThrottleTime, Time._DESERIALIZER, "target_throttle_time"); - op.add(Builder::targetThrottleTimeInMillis, JsonpDeserializer.stringDeserializer(), "target_throttle_time_in_millis"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); + op.add(Builder::targetThrottleTimeInMillis, JsonpDeserializer.longDeserializer(), "target_throttle_time_in_millis"); op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.bytes); + result = 31 * result + this.files.hashCode(); + result = 31 * result + this.size.hashCode(); + result = 31 * result + Objects.hashCode(this.sourceThrottleTime); + result = 31 * result + Long.hashCode(this.sourceThrottleTimeInMillis); + result = 31 * result + Objects.hashCode(this.targetThrottleTime); + result = 31 * result + Long.hashCode(this.targetThrottleTimeInMillis); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryIndexStatus other = (RecoveryIndexStatus) o; + return Objects.equals(this.bytes, other.bytes) + && this.files.equals(other.files) + && this.size.equals(other.size) + && Objects.equals(this.sourceThrottleTime, other.sourceThrottleTime) + && this.sourceThrottleTimeInMillis == other.sourceThrottleTimeInMillis + && Objects.equals(this.targetThrottleTime, other.targetThrottleTime) + && this.targetThrottleTimeInMillis == other.targetThrottleTimeInMillis + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java similarity index 53% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java index e881cae9ec..08f119e85c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryOrigin.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,78 +48,96 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.RecoveryOrigin @JsonpDeserializable -public class RecoveryOrigin implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryOrigin implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable - private final String hostname; + private final Boolean bootstrapNewHistoryUuid; @Nullable private final String host; @Nullable - private final String transportAddress; + private final String hostname; @Nullable private final String id; + @Nullable + private final String index; + @Nullable private final String ip; + @Nullable + private final Boolean isSearchableSnapshot; + @Nullable private final String name; @Nullable - private final Boolean bootstrapNewHistoryUuid; + private final Boolean remoteStoreIndexShallowCopy; @Nullable private final String repository; + @Nullable + private final String restoreUuid; + @Nullable private final String snapshot; @Nullable - private final String version; + private final String sourceRemoteStoreRepository; @Nullable - private final String restoreuuid; + private final String sourceRemoteTranslogRepository; @Nullable - private final String index; + private final String transportAddress; + + @Nullable + private final String version; // --------------------------------------------------------------------------------------------- private RecoveryOrigin(Builder builder) { - - this.hostname = builder.hostname; + this.bootstrapNewHistoryUuid = builder.bootstrapNewHistoryUuid; this.host = builder.host; - this.transportAddress = builder.transportAddress; + this.hostname = builder.hostname; this.id = builder.id; + this.index = builder.index; this.ip = builder.ip; + this.isSearchableSnapshot = builder.isSearchableSnapshot; this.name = builder.name; - this.bootstrapNewHistoryUuid = builder.bootstrapNewHistoryUuid; + this.remoteStoreIndexShallowCopy = builder.remoteStoreIndexShallowCopy; this.repository = builder.repository; + this.restoreUuid = builder.restoreUuid; this.snapshot = builder.snapshot; + this.sourceRemoteStoreRepository = builder.sourceRemoteStoreRepository; + this.sourceRemoteTranslogRepository = builder.sourceRemoteTranslogRepository; + this.transportAddress = builder.transportAddress; this.version = builder.version; - this.restoreuuid = builder.restoreuuid; - this.index = builder.index; - } - public static RecoveryOrigin of(Function> fn) { + public static RecoveryOrigin of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * API name: {@code hostname} + * API name: {@code bootstrap_new_history_uuid} */ @Nullable - public final String hostname() { - return this.hostname; + public final Boolean bootstrapNewHistoryUuid() { + return this.bootstrapNewHistoryUuid; } /** @@ -124,11 +149,11 @@ public final String host() { } /** - * API name: {@code transport_address} + * API name: {@code hostname} */ @Nullable - public final String transportAddress() { - return this.transportAddress; + public final String hostname() { + return this.hostname; } /** @@ -139,6 +164,14 @@ public final String id() { return this.id; } + /** + * API name: {@code index} + */ + @Nullable + public final String index() { + return this.index; + } + /** * API name: {@code ip} */ @@ -147,6 +180,14 @@ public final String ip() { return this.ip; } + /** + * API name: {@code isSearchableSnapshot} + */ + @Nullable + public final Boolean isSearchableSnapshot() { + return this.isSearchableSnapshot; + } + /** * API name: {@code name} */ @@ -156,11 +197,11 @@ public final String name() { } /** - * API name: {@code bootstrap_new_history_uuid} + * API name: {@code remoteStoreIndexShallowCopy} */ @Nullable - public final Boolean bootstrapNewHistoryUuid() { - return this.bootstrapNewHistoryUuid; + public final Boolean remoteStoreIndexShallowCopy() { + return this.remoteStoreIndexShallowCopy; } /** @@ -171,6 +212,14 @@ public final String repository() { return this.repository; } + /** + * API name: {@code restoreUUID} + */ + @Nullable + public final String restoreUuid() { + return this.restoreUuid; + } + /** * API name: {@code snapshot} */ @@ -180,32 +229,41 @@ public final String snapshot() { } /** - * API name: {@code version} + * API name: {@code sourceRemoteStoreRepository} */ @Nullable - public final String version() { - return this.version; + public final String sourceRemoteStoreRepository() { + return this.sourceRemoteStoreRepository; } /** - * API name: {@code restoreUUID} + * API name: {@code sourceRemoteTranslogRepository} */ @Nullable - public final String restoreuuid() { - return this.restoreuuid; + public final String sourceRemoteTranslogRepository() { + return this.sourceRemoteTranslogRepository; } /** - * API name: {@code index} + * API name: {@code transport_address} */ @Nullable - public final String index() { - return this.index; + public final String transportAddress() { + return this.transportAddress; + } + + /** + * API name: {@code version} + */ + @Nullable + public final String version() { + return this.version; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -213,215 +271,334 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.hostname != null) { - generator.writeKey("hostname"); - generator.write(this.hostname); - + if (this.bootstrapNewHistoryUuid != null) { + generator.writeKey("bootstrap_new_history_uuid"); + generator.write(this.bootstrapNewHistoryUuid); } + if (this.host != null) { generator.writeKey("host"); generator.write(this.host); - } - if (this.transportAddress != null) { - generator.writeKey("transport_address"); - generator.write(this.transportAddress); + if (this.hostname != null) { + generator.writeKey("hostname"); + generator.write(this.hostname); } + if (this.id != null) { generator.writeKey("id"); generator.write(this.id); + } + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); } + if (this.ip != null) { generator.writeKey("ip"); generator.write(this.ip); + } + if (this.isSearchableSnapshot != null) { + generator.writeKey("isSearchableSnapshot"); + generator.write(this.isSearchableSnapshot); } + if (this.name != null) { generator.writeKey("name"); generator.write(this.name); - } - if (this.bootstrapNewHistoryUuid != null) { - generator.writeKey("bootstrap_new_history_uuid"); - generator.write(this.bootstrapNewHistoryUuid); + if (this.remoteStoreIndexShallowCopy != null) { + generator.writeKey("remoteStoreIndexShallowCopy"); + generator.write(this.remoteStoreIndexShallowCopy); } + if (this.repository != null) { generator.writeKey("repository"); generator.write(this.repository); + } + if (this.restoreUuid != null) { + generator.writeKey("restoreUUID"); + generator.write(this.restoreUuid); } + if (this.snapshot != null) { generator.writeKey("snapshot"); generator.write(this.snapshot); - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); + if (this.sourceRemoteStoreRepository != null) { + generator.writeKey("sourceRemoteStoreRepository"); + generator.write(this.sourceRemoteStoreRepository); } - if (this.restoreuuid != null) { - generator.writeKey("restoreUUID"); - generator.write(this.restoreuuid); + if (this.sourceRemoteTranslogRepository != null) { + generator.writeKey("sourceRemoteTranslogRepository"); + generator.write(this.sourceRemoteTranslogRepository); } - if (this.index != null) { - generator.writeKey("index"); - generator.write(this.index); + if (this.transportAddress != null) { + generator.writeKey("transport_address"); + generator.write(this.transportAddress); } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryOrigin}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable - private String hostname; - + private Boolean bootstrapNewHistoryUuid; @Nullable private String host; - @Nullable - private String transportAddress; - + private String hostname; @Nullable private String id; - + @Nullable + private String index; @Nullable private String ip; - + @Nullable + private Boolean isSearchableSnapshot; @Nullable private String name; - @Nullable - private Boolean bootstrapNewHistoryUuid; - + private Boolean remoteStoreIndexShallowCopy; @Nullable private String repository; - + @Nullable + private String restoreUuid; @Nullable private String snapshot; - + @Nullable + private String sourceRemoteStoreRepository; + @Nullable + private String sourceRemoteTranslogRepository; + @Nullable + private String transportAddress; @Nullable private String version; - @Nullable - private String restoreuuid; + public Builder() {} + + private Builder(RecoveryOrigin o) { + this.bootstrapNewHistoryUuid = o.bootstrapNewHistoryUuid; + this.host = o.host; + this.hostname = o.hostname; + this.id = o.id; + this.index = o.index; + this.ip = o.ip; + this.isSearchableSnapshot = o.isSearchableSnapshot; + this.name = o.name; + this.remoteStoreIndexShallowCopy = o.remoteStoreIndexShallowCopy; + this.repository = o.repository; + this.restoreUuid = o.restoreUuid; + this.snapshot = o.snapshot; + this.sourceRemoteStoreRepository = o.sourceRemoteStoreRepository; + this.sourceRemoteTranslogRepository = o.sourceRemoteTranslogRepository; + this.transportAddress = o.transportAddress; + this.version = o.version; + } - @Nullable - private String index; + private Builder(Builder o) { + this.bootstrapNewHistoryUuid = o.bootstrapNewHistoryUuid; + this.host = o.host; + this.hostname = o.hostname; + this.id = o.id; + this.index = o.index; + this.ip = o.ip; + this.isSearchableSnapshot = o.isSearchableSnapshot; + this.name = o.name; + this.remoteStoreIndexShallowCopy = o.remoteStoreIndexShallowCopy; + this.repository = o.repository; + this.restoreUuid = o.restoreUuid; + this.snapshot = o.snapshot; + this.sourceRemoteStoreRepository = o.sourceRemoteStoreRepository; + this.sourceRemoteTranslogRepository = o.sourceRemoteTranslogRepository; + this.transportAddress = o.transportAddress; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * API name: {@code hostname} + * API name: {@code bootstrap_new_history_uuid} */ - public final Builder hostname(@Nullable String value) { - this.hostname = value; + @Nonnull + public final Builder bootstrapNewHistoryUuid(@Nullable Boolean value) { + this.bootstrapNewHistoryUuid = value; return this; } /** * API name: {@code host} */ + @Nonnull public final Builder host(@Nullable String value) { this.host = value; return this; } /** - * API name: {@code transport_address} + * API name: {@code hostname} */ - public final Builder transportAddress(@Nullable String value) { - this.transportAddress = value; + @Nonnull + public final Builder hostname(@Nullable String value) { + this.hostname = value; return this; } /** * API name: {@code id} */ + @Nonnull public final Builder id(@Nullable String value) { this.id = value; return this; } + /** + * API name: {@code index} + */ + @Nonnull + public final Builder index(@Nullable String value) { + this.index = value; + return this; + } + /** * API name: {@code ip} */ + @Nonnull public final Builder ip(@Nullable String value) { this.ip = value; return this; } + /** + * API name: {@code isSearchableSnapshot} + */ + @Nonnull + public final Builder isSearchableSnapshot(@Nullable Boolean value) { + this.isSearchableSnapshot = value; + return this; + } + /** * API name: {@code name} */ + @Nonnull public final Builder name(@Nullable String value) { this.name = value; return this; } /** - * API name: {@code bootstrap_new_history_uuid} + * API name: {@code remoteStoreIndexShallowCopy} */ - public final Builder bootstrapNewHistoryUuid(@Nullable Boolean value) { - this.bootstrapNewHistoryUuid = value; + @Nonnull + public final Builder remoteStoreIndexShallowCopy(@Nullable Boolean value) { + this.remoteStoreIndexShallowCopy = value; return this; } /** * API name: {@code repository} */ + @Nonnull public final Builder repository(@Nullable String value) { this.repository = value; return this; } + /** + * API name: {@code restoreUUID} + */ + @Nonnull + public final Builder restoreUuid(@Nullable String value) { + this.restoreUuid = value; + return this; + } + /** * API name: {@code snapshot} */ + @Nonnull public final Builder snapshot(@Nullable String value) { this.snapshot = value; return this; } /** - * API name: {@code version} + * API name: {@code sourceRemoteStoreRepository} */ - public final Builder version(@Nullable String value) { - this.version = value; + @Nonnull + public final Builder sourceRemoteStoreRepository(@Nullable String value) { + this.sourceRemoteStoreRepository = value; return this; } /** - * API name: {@code restoreUUID} + * API name: {@code sourceRemoteTranslogRepository} */ - public final Builder restoreuuid(@Nullable String value) { - this.restoreuuid = value; + @Nonnull + public final Builder sourceRemoteTranslogRepository(@Nullable String value) { + this.sourceRemoteTranslogRepository = value; return this; } /** - * API name: {@code index} + * API name: {@code transport_address} */ - public final Builder index(@Nullable String value) { - this.index = value; + @Nonnull + public final Builder transportAddress(@Nullable String value) { + this.transportAddress = value; + return this; + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable String value) { + this.version = value; return this; } /** * Builds a {@link RecoveryOrigin}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RecoveryOrigin build() { _checkSingleUse(); @@ -440,20 +617,66 @@ public RecoveryOrigin build() { ); protected static void setupRecoveryOriginDeserializer(ObjectDeserializer op) { - - op.add(Builder::hostname, JsonpDeserializer.stringDeserializer(), "hostname"); + op.add(Builder::bootstrapNewHistoryUuid, JsonpDeserializer.booleanDeserializer(), "bootstrap_new_history_uuid"); op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host"); - op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + op.add(Builder::hostname, JsonpDeserializer.stringDeserializer(), "hostname"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::ip, JsonpDeserializer.stringDeserializer(), "ip"); + op.add(Builder::isSearchableSnapshot, JsonpDeserializer.booleanDeserializer(), "isSearchableSnapshot"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::bootstrapNewHistoryUuid, JsonpDeserializer.booleanDeserializer(), "bootstrap_new_history_uuid"); + op.add(Builder::remoteStoreIndexShallowCopy, JsonpDeserializer.booleanDeserializer(), "remoteStoreIndexShallowCopy"); op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); + op.add(Builder::restoreUuid, JsonpDeserializer.stringDeserializer(), "restoreUUID"); op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); + op.add(Builder::sourceRemoteStoreRepository, JsonpDeserializer.stringDeserializer(), "sourceRemoteStoreRepository"); + op.add(Builder::sourceRemoteTranslogRepository, JsonpDeserializer.stringDeserializer(), "sourceRemoteTranslogRepository"); + op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); - op.add(Builder::restoreuuid, JsonpDeserializer.stringDeserializer(), "restoreUUID"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.bootstrapNewHistoryUuid); + result = 31 * result + Objects.hashCode(this.host); + result = 31 * result + Objects.hashCode(this.hostname); + result = 31 * result + Objects.hashCode(this.id); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.ip); + result = 31 * result + Objects.hashCode(this.isSearchableSnapshot); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.remoteStoreIndexShallowCopy); + result = 31 * result + Objects.hashCode(this.repository); + result = 31 * result + Objects.hashCode(this.restoreUuid); + result = 31 * result + Objects.hashCode(this.snapshot); + result = 31 * result + Objects.hashCode(this.sourceRemoteStoreRepository); + result = 31 * result + Objects.hashCode(this.sourceRemoteTranslogRepository); + result = 31 * result + Objects.hashCode(this.transportAddress); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryOrigin other = (RecoveryOrigin) o; + return Objects.equals(this.bootstrapNewHistoryUuid, other.bootstrapNewHistoryUuid) + && Objects.equals(this.host, other.host) + && Objects.equals(this.hostname, other.hostname) + && Objects.equals(this.id, other.id) + && Objects.equals(this.index, other.index) + && Objects.equals(this.ip, other.ip) + && Objects.equals(this.isSearchableSnapshot, other.isSearchableSnapshot) + && Objects.equals(this.name, other.name) + && Objects.equals(this.remoteStoreIndexShallowCopy, other.remoteStoreIndexShallowCopy) + && Objects.equals(this.repository, other.repository) + && Objects.equals(this.restoreUuid, other.restoreUuid) + && Objects.equals(this.snapshot, other.snapshot) + && Objects.equals(this.sourceRemoteStoreRepository, other.sourceRemoteStoreRepository) + && Objects.equals(this.sourceRemoteTranslogRepository, other.sourceRemoteTranslogRepository) + && Objects.equals(this.transportAddress, other.transportAddress) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java new file mode 100644 index 0000000000..dab50c40f8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java @@ -0,0 +1,294 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.recovery; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.recovery.RecoveryStartStatus + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryStartStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Time checkIndexTime; + + private final long checkIndexTimeInMillis; + + @Nullable + private final Time totalTime; + + private final long totalTimeInMillis; + + // --------------------------------------------------------------------------------------------- + + private RecoveryStartStatus(Builder builder) { + this.checkIndexTime = builder.checkIndexTime; + this.checkIndexTimeInMillis = ApiTypeHelper.requireNonNull(builder.checkIndexTimeInMillis, this, "checkIndexTimeInMillis"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + } + + public static RecoveryStartStatus of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code check_index_time} + */ + @Nullable + public final Time checkIndexTime() { + return this.checkIndexTime; + } + + /** + * Required - API name: {@code check_index_time_in_millis} + */ + public final long checkIndexTimeInMillis() { + return this.checkIndexTimeInMillis; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final Time totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.checkIndexTime != null) { + generator.writeKey("check_index_time"); + this.checkIndexTime.serialize(generator, mapper); + } + + generator.writeKey("check_index_time_in_millis"); + generator.write(this.checkIndexTimeInMillis); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + this.totalTime.serialize(generator, mapper); + } + + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RecoveryStartStatus}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time checkIndexTime; + private Long checkIndexTimeInMillis; + @Nullable + private Time totalTime; + private Long totalTimeInMillis; + + public Builder() {} + + private Builder(RecoveryStartStatus o) { + this.checkIndexTime = o.checkIndexTime; + this.checkIndexTimeInMillis = o.checkIndexTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.checkIndexTime = o.checkIndexTime; + this.checkIndexTimeInMillis = o.checkIndexTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code check_index_time} + */ + @Nonnull + public final Builder checkIndexTime(@Nullable Time value) { + this.checkIndexTime = value; + return this; + } + + /** + * API name: {@code check_index_time} + */ + @Nonnull + public final Builder checkIndexTime(Function> fn) { + return checkIndexTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code check_index_time_in_millis} + */ + @Nonnull + public final Builder checkIndexTimeInMillis(long value) { + this.checkIndexTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(@Nullable Time value) { + this.totalTime = value; + return this; + } + + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + @Nonnull + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link RecoveryStartStatus}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RecoveryStartStatus build() { + _checkSingleUse(); + + return new RecoveryStartStatus(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RecoveryStartStatus} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RecoveryStartStatus::setupRecoveryStartStatusDeserializer + ); + + protected static void setupRecoveryStartStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::checkIndexTime, Time._DESERIALIZER, "check_index_time"); + op.add(Builder::checkIndexTimeInMillis, JsonpDeserializer.longDeserializer(), "check_index_time_in_millis"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.checkIndexTime); + result = 31 * result + Long.hashCode(this.checkIndexTimeInMillis); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryStartStatus other = (RecoveryStartStatus) o; + return Objects.equals(this.checkIndexTime, other.checkIndexTime) + && this.checkIndexTimeInMillis == other.checkIndexTimeInMillis + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java index 2e041eff10..64d016dbf0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStatus.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.RecoveryStatus @JsonpDeserializable -public class RecoveryStatus implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RecoveryStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final List shards; // --------------------------------------------------------------------------------------------- private RecoveryStatus(Builder builder) { - this.shards = ApiTypeHelper.unmodifiableRequired(builder.shards, this, "shards"); - } - public static RecoveryStatus of(Function> fn) { + public static RecoveryStatus of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code shards} */ + @Nonnull public final List shards() { return this.shards; } @@ -73,6 +83,7 @@ public final List shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,34 +91,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("shards"); - generator.writeStartArray(); - for (ShardRecovery item0 : this.shards) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("shards"); + generator.writeStartArray(); + for (ShardRecovery item0 : this.shards) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RecoveryStatus}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List shards; + public Builder() {} + + private Builder(RecoveryStatus o) { + this.shards = _listCopy(o.shards); + } + + private Builder(Builder o) { + this.shards = _listCopy(o.shards); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code shards} + * *

* Adds all elements of list to shards. + *

*/ + @Nonnull public final Builder shards(List list) { this.shards = _listAddAll(this.shards, list); return this; @@ -115,9 +149,12 @@ public final Builder shards(List list) { /** * Required - API name: {@code shards} + * *

* Adds one or more values to shards. + *

*/ + @Nonnull public final Builder shards(ShardRecovery value, ShardRecovery... values) { this.shards = _listAdd(this.shards, value, values); return this; @@ -125,9 +162,12 @@ public final Builder shards(ShardRecovery value, ShardRecovery... values) { /** * Required - API name: {@code shards} + * *

* Adds a value to shards using a builder lambda. + *

*/ + @Nonnull public final Builder shards(Function> fn) { return shards(fn.apply(new ShardRecovery.Builder()).build()); } @@ -135,9 +175,10 @@ public final Builder shards(Function op) { - op.add(Builder::shards, JsonpDeserializer.arrayDeserializer(ShardRecovery._DESERIALIZER), "shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RecoveryStatus other = (RecoveryStatus) o; + return this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java index 01a1e89056..d8fa8eb6cf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/ShardRecovery.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,22 +48,30 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.ShardRecovery @JsonpDeserializable -public class ShardRecovery implements PlainJsonSerializable { - private final long id; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardRecovery implements PlainJsonSerializable, ToCopyableBuilder { + + private final int id; + @Nonnull private final RecoveryIndexStatus index; private final boolean primary; + @Nonnull private final RecoveryOrigin source; + @Nonnull private final String stage; @Nullable @@ -65,30 +80,34 @@ public class ShardRecovery implements PlainJsonSerializable { @Nullable private final String startTime; - private final String startTimeInMillis; + private final long startTimeInMillis; @Nullable private final String stopTime; - private final String stopTimeInMillis; + @Nullable + private final Long stopTimeInMillis; + @Nonnull private final RecoveryOrigin target; @Nullable - private final String totalTime; + private final Time totalTime; - private final String totalTimeInMillis; + private final long totalTimeInMillis; + @Nonnull private final TranslogStatus translog; + @Nonnull private final String type; + @Nonnull private final VerifyIndex verifyIndex; // --------------------------------------------------------------------------------------------- private ShardRecovery(Builder builder) { - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); @@ -98,30 +117,30 @@ private ShardRecovery(Builder builder) { this.startTime = builder.startTime; this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); this.stopTime = builder.stopTime; - this.stopTimeInMillis = ApiTypeHelper.requireNonNull(builder.stopTimeInMillis, this, "stopTimeInMillis"); + this.stopTimeInMillis = builder.stopTimeInMillis; this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); this.translog = ApiTypeHelper.requireNonNull(builder.translog, this, "translog"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.verifyIndex = ApiTypeHelper.requireNonNull(builder.verifyIndex, this, "verifyIndex"); - } - public static ShardRecovery of(Function> fn) { + public static ShardRecovery of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code id} */ - public final long id() { + public final int id() { return this.id; } /** * Required - API name: {@code index} */ + @Nonnull public final RecoveryIndexStatus index() { return this.index; } @@ -136,6 +155,7 @@ public final boolean primary() { /** * Required - API name: {@code source} */ + @Nonnull public final RecoveryOrigin source() { return this.source; } @@ -143,6 +163,7 @@ public final RecoveryOrigin source() { /** * Required - API name: {@code stage} */ + @Nonnull public final String stage() { return this.stage; } @@ -166,7 +187,7 @@ public final String startTime() { /** * Required - API name: {@code start_time_in_millis} */ - public final String startTimeInMillis() { + public final long startTimeInMillis() { return this.startTimeInMillis; } @@ -179,15 +200,17 @@ public final String stopTime() { } /** - * Required - API name: {@code stop_time_in_millis} + * API name: {@code stop_time_in_millis} */ - public final String stopTimeInMillis() { + @Nullable + public final Long stopTimeInMillis() { return this.stopTimeInMillis; } /** * Required - API name: {@code target} */ + @Nonnull public final RecoveryOrigin target() { return this.target; } @@ -196,20 +219,21 @@ public final RecoveryOrigin target() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } /** * Required - API name: {@code total_time_in_millis} */ - public final String totalTimeInMillis() { + public final long totalTimeInMillis() { return this.totalTimeInMillis; } /** * Required - API name: {@code translog} */ + @Nonnull public final TranslogStatus translog() { return this.translog; } @@ -217,6 +241,7 @@ public final TranslogStatus translog() { /** * Required - API name: {@code type} */ + @Nonnull public final String type() { return this.type; } @@ -224,6 +249,7 @@ public final String type() { /** * Required - API name: {@code verify_index} */ + @Nonnull public final VerifyIndex verifyIndex() { return this.verifyIndex; } @@ -231,6 +257,7 @@ public final VerifyIndex verifyIndex() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -238,7 +265,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("id"); generator.write(this.id); @@ -257,32 +283,34 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.start != null) { generator.writeKey("start"); this.start.serialize(generator, mapper); - } + if (this.startTime != null) { generator.writeKey("start_time"); generator.write(this.startTime); - } + generator.writeKey("start_time_in_millis"); generator.write(this.startTimeInMillis); if (this.stopTime != null) { generator.writeKey("stop_time"); generator.write(this.stopTime); + } + if (this.stopTimeInMillis != null) { + generator.writeKey("stop_time_in_millis"); + generator.write(this.stopTimeInMillis); } - generator.writeKey("stop_time_in_millis"); - generator.write(this.stopTimeInMillis); generator.writeKey("target"); this.target.serialize(generator, mapper); if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); @@ -294,56 +322,98 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("verify_index"); this.verifyIndex.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardRecovery}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long id; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Integer id; private RecoveryIndexStatus index; - private Boolean primary; - private RecoveryOrigin source; - private String stage; - @Nullable private RecoveryStartStatus start; - @Nullable private String startTime; - - private String startTimeInMillis; - + private Long startTimeInMillis; @Nullable private String stopTime; - - private String stopTimeInMillis; - + @Nullable + private Long stopTimeInMillis; private RecoveryOrigin target; - @Nullable - private String totalTime; - - private String totalTimeInMillis; - + private Time totalTime; + private Long totalTimeInMillis; private TranslogStatus translog; - private String type; - private VerifyIndex verifyIndex; + public Builder() {} + + private Builder(ShardRecovery o) { + this.id = o.id; + this.index = o.index; + this.primary = o.primary; + this.source = o.source; + this.stage = o.stage; + this.start = o.start; + this.startTime = o.startTime; + this.startTimeInMillis = o.startTimeInMillis; + this.stopTime = o.stopTime; + this.stopTimeInMillis = o.stopTimeInMillis; + this.target = o.target; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + this.translog = o.translog; + this.type = o.type; + this.verifyIndex = o.verifyIndex; + } + + private Builder(Builder o) { + this.id = o.id; + this.index = o.index; + this.primary = o.primary; + this.source = o.source; + this.stage = o.stage; + this.start = o.start; + this.startTime = o.startTime; + this.startTimeInMillis = o.startTimeInMillis; + this.stopTime = o.stopTime; + this.stopTimeInMillis = o.stopTimeInMillis; + this.target = o.target; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + this.translog = o.translog; + this.type = o.type; + this.verifyIndex = o.verifyIndex; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code id} */ - public final Builder id(long value) { + @Nonnull + public final Builder id(int value) { this.id = value; return this; } @@ -351,6 +421,7 @@ public final Builder id(long value) { /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(RecoveryIndexStatus value) { this.index = value; return this; @@ -359,13 +430,15 @@ public final Builder index(RecoveryIndexStatus value) { /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(Function> fn) { - return this.index(fn.apply(new RecoveryIndexStatus.Builder()).build()); + return index(fn.apply(new RecoveryIndexStatus.Builder()).build()); } /** * Required - API name: {@code primary} */ + @Nonnull public final Builder primary(boolean value) { this.primary = value; return this; @@ -374,6 +447,7 @@ public final Builder primary(boolean value) { /** * Required - API name: {@code source} */ + @Nonnull public final Builder source(RecoveryOrigin value) { this.source = value; return this; @@ -382,13 +456,15 @@ public final Builder source(RecoveryOrigin value) { /** * Required - API name: {@code source} */ + @Nonnull public final Builder source(Function> fn) { - return this.source(fn.apply(new RecoveryOrigin.Builder()).build()); + return source(fn.apply(new RecoveryOrigin.Builder()).build()); } /** * Required - API name: {@code stage} */ + @Nonnull public final Builder stage(String value) { this.stage = value; return this; @@ -397,6 +473,7 @@ public final Builder stage(String value) { /** * API name: {@code start} */ + @Nonnull public final Builder start(@Nullable RecoveryStartStatus value) { this.start = value; return this; @@ -405,13 +482,15 @@ public final Builder start(@Nullable RecoveryStartStatus value) { /** * API name: {@code start} */ + @Nonnull public final Builder start(Function> fn) { - return this.start(fn.apply(new RecoveryStartStatus.Builder()).build()); + return start(fn.apply(new RecoveryStartStatus.Builder()).build()); } /** * API name: {@code start_time} */ + @Nonnull public final Builder startTime(@Nullable String value) { this.startTime = value; return this; @@ -420,7 +499,8 @@ public final Builder startTime(@Nullable String value) { /** * Required - API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(String value) { + @Nonnull + public final Builder startTimeInMillis(long value) { this.startTimeInMillis = value; return this; } @@ -428,15 +508,17 @@ public final Builder startTimeInMillis(String value) { /** * API name: {@code stop_time} */ + @Nonnull public final Builder stopTime(@Nullable String value) { this.stopTime = value; return this; } /** - * Required - API name: {@code stop_time_in_millis} + * API name: {@code stop_time_in_millis} */ - public final Builder stopTimeInMillis(String value) { + @Nonnull + public final Builder stopTimeInMillis(@Nullable Long value) { this.stopTimeInMillis = value; return this; } @@ -444,6 +526,7 @@ public final Builder stopTimeInMillis(String value) { /** * Required - API name: {@code target} */ + @Nonnull public final Builder target(RecoveryOrigin value) { this.target = value; return this; @@ -452,22 +535,33 @@ public final Builder target(RecoveryOrigin value) { /** * Required - API name: {@code target} */ + @Nonnull public final Builder target(Function> fn) { - return this.target(fn.apply(new RecoveryOrigin.Builder()).build()); + return target(fn.apply(new RecoveryOrigin.Builder()).build()); } /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(String value) { + @Nonnull + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -475,6 +569,7 @@ public final Builder totalTimeInMillis(String value) { /** * Required - API name: {@code translog} */ + @Nonnull public final Builder translog(TranslogStatus value) { this.translog = value; return this; @@ -483,13 +578,15 @@ public final Builder translog(TranslogStatus value) { /** * Required - API name: {@code translog} */ + @Nonnull public final Builder translog(Function> fn) { - return this.translog(fn.apply(new TranslogStatus.Builder()).build()); + return translog(fn.apply(new TranslogStatus.Builder()).build()); } /** * Required - API name: {@code type} */ + @Nonnull public final Builder type(String value) { this.type = value; return this; @@ -498,6 +595,7 @@ public final Builder type(String value) { /** * Required - API name: {@code verify_index} */ + @Nonnull public final Builder verifyIndex(VerifyIndex value) { this.verifyIndex = value; return this; @@ -506,16 +604,18 @@ public final Builder verifyIndex(VerifyIndex value) { /** * Required - API name: {@code verify_index} */ + @Nonnull public final Builder verifyIndex(Function> fn) { - return this.verifyIndex(fn.apply(new VerifyIndex.Builder()).build()); + return verifyIndex(fn.apply(new VerifyIndex.Builder()).build()); } /** * Builds a {@link ShardRecovery}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardRecovery build() { _checkSingleUse(); @@ -534,24 +634,66 @@ public ShardRecovery build() { ); protected static void setupShardRecoveryDeserializer(ObjectDeserializer op) { - - op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id"); + op.add(Builder::id, JsonpDeserializer.integerDeserializer(), "id"); op.add(Builder::index, RecoveryIndexStatus._DESERIALIZER, "index"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::source, RecoveryOrigin._DESERIALIZER, "source"); op.add(Builder::stage, JsonpDeserializer.stringDeserializer(), "stage"); op.add(Builder::start, RecoveryStartStatus._DESERIALIZER, "start"); op.add(Builder::startTime, JsonpDeserializer.stringDeserializer(), "start_time"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.stringDeserializer(), "start_time_in_millis"); + op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); op.add(Builder::stopTime, JsonpDeserializer.stringDeserializer(), "stop_time"); - op.add(Builder::stopTimeInMillis, JsonpDeserializer.stringDeserializer(), "stop_time_in_millis"); + op.add(Builder::stopTimeInMillis, JsonpDeserializer.longDeserializer(), "stop_time_in_millis"); op.add(Builder::target, RecoveryOrigin._DESERIALIZER, "target"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); op.add(Builder::translog, TranslogStatus._DESERIALIZER, "translog"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); op.add(Builder::verifyIndex, VerifyIndex._DESERIALIZER, "verify_index"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.id); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Boolean.hashCode(this.primary); + result = 31 * result + this.source.hashCode(); + result = 31 * result + this.stage.hashCode(); + result = 31 * result + Objects.hashCode(this.start); + result = 31 * result + Objects.hashCode(this.startTime); + result = 31 * result + Long.hashCode(this.startTimeInMillis); + result = 31 * result + Objects.hashCode(this.stopTime); + result = 31 * result + Objects.hashCode(this.stopTimeInMillis); + result = 31 * result + this.target.hashCode(); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + result = 31 * result + this.translog.hashCode(); + result = 31 * result + this.type.hashCode(); + result = 31 * result + this.verifyIndex.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardRecovery other = (ShardRecovery) o; + return this.id == other.id + && this.index.equals(other.index) + && this.primary == other.primary + && this.source.equals(other.source) + && this.stage.equals(other.stage) + && Objects.equals(this.start, other.start) + && Objects.equals(this.startTime, other.startTime) + && this.startTimeInMillis == other.startTimeInMillis + && Objects.equals(this.stopTime, other.stopTime) + && Objects.equals(this.stopTimeInMillis, other.stopTimeInMillis) + && this.target.equals(other.target) + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis + && this.translog.equals(other.translog) + && this.type.equals(other.type) + && this.verifyIndex.equals(other.verifyIndex); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java index 31eaa521a0..b4115e58aa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/TranslogStatus.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,47 +48,52 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.TranslogStatus @JsonpDeserializable -public class TranslogStatus implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TranslogStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String percent; - private final long recovered; + private final int recovered; - private final long total; + private final int total; - private final long totalOnStart; + private final int totalOnStart; @Nullable - private final String totalTime; + private final Time totalTime; - private final String totalTimeInMillis; + private final long totalTimeInMillis; // --------------------------------------------------------------------------------------------- private TranslogStatus(Builder builder) { - this.percent = ApiTypeHelper.requireNonNull(builder.percent, this, "percent"); this.recovered = ApiTypeHelper.requireNonNull(builder.recovered, this, "recovered"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.totalOnStart = ApiTypeHelper.requireNonNull(builder.totalOnStart, this, "totalOnStart"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - } - public static TranslogStatus of(Function> fn) { + public static TranslogStatus of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code percent} */ + @Nonnull public final String percent() { return this.percent; } @@ -89,21 +101,21 @@ public final String percent() { /** * Required - API name: {@code recovered} */ - public final long recovered() { + public final int recovered() { return this.recovered; } /** * Required - API name: {@code total} */ - public final long total() { + public final int total() { return this.total; } /** * Required - API name: {@code total_on_start} */ - public final long totalOnStart() { + public final int totalOnStart() { return this.totalOnStart; } @@ -111,20 +123,21 @@ public final long totalOnStart() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } /** * Required - API name: {@code total_time_in_millis} */ - public final String totalTimeInMillis() { + public final long totalTimeInMillis() { return this.totalTimeInMillis; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -132,7 +145,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("percent"); generator.write(this.percent); @@ -147,37 +159,68 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); - + this.totalTime.serialize(generator, mapper); } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TranslogStatus}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String percent; - - private Long recovered; - - private Long total; - - private Long totalOnStart; - + private Integer recovered; + private Integer total; + private Integer totalOnStart; @Nullable - private String totalTime; + private Time totalTime; + private Long totalTimeInMillis; + + public Builder() {} + + private Builder(TranslogStatus o) { + this.percent = o.percent; + this.recovered = o.recovered; + this.total = o.total; + this.totalOnStart = o.totalOnStart; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } - private String totalTimeInMillis; + private Builder(Builder o) { + this.percent = o.percent; + this.recovered = o.recovered; + this.total = o.total; + this.totalOnStart = o.totalOnStart; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code percent} */ + @Nonnull public final Builder percent(String value) { this.percent = value; return this; @@ -186,7 +229,8 @@ public final Builder percent(String value) { /** * Required - API name: {@code recovered} */ - public final Builder recovered(long value) { + @Nonnull + public final Builder recovered(int value) { this.recovered = value; return this; } @@ -194,7 +238,8 @@ public final Builder recovered(long value) { /** * Required - API name: {@code total} */ - public final Builder total(long value) { + @Nonnull + public final Builder total(int value) { this.total = value; return this; } @@ -202,7 +247,8 @@ public final Builder total(long value) { /** * Required - API name: {@code total_on_start} */ - public final Builder totalOnStart(long value) { + @Nonnull + public final Builder totalOnStart(int value) { this.totalOnStart = value; return this; } @@ -210,15 +256,25 @@ public final Builder totalOnStart(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + @Nonnull + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + @Nonnull + public final Builder totalTime(Function> fn) { + return totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(String value) { + @Nonnull + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -226,9 +282,10 @@ public final Builder totalTimeInMillis(String value) { /** * Builds a {@link TranslogStatus}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TranslogStatus build() { _checkSingleUse(); @@ -247,14 +304,36 @@ public TranslogStatus build() { ); protected static void setupTranslogStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::percent, JsonpDeserializer.stringDeserializer(), "percent"); - op.add(Builder::recovered, JsonpDeserializer.longDeserializer(), "recovered"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalOnStart, JsonpDeserializer.longDeserializer(), "total_on_start"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); + op.add(Builder::recovered, JsonpDeserializer.integerDeserializer(), "recovered"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + op.add(Builder::totalOnStart, JsonpDeserializer.integerDeserializer(), "total_on_start"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.percent.hashCode(); + result = 31 * result + Integer.hashCode(this.recovered); + result = 31 * result + Integer.hashCode(this.total); + result = 31 * result + Integer.hashCode(this.totalOnStart); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TranslogStatus other = (TranslogStatus) o; + return this.percent.equals(other.percent) + && this.recovered == other.recovered + && this.total == other.total + && this.totalOnStart == other.totalOnStart + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java index 93f9e584aa..0387b47ebd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/recovery/VerifyIndex.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.recovery; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,35 +50,37 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.recovery.VerifyIndex @JsonpDeserializable -public class VerifyIndex implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class VerifyIndex implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Time checkIndexTime; - private final String checkIndexTimeInMillis; + private final long checkIndexTimeInMillis; @Nullable private final Time totalTime; - private final String totalTimeInMillis; + private final long totalTimeInMillis; // --------------------------------------------------------------------------------------------- private VerifyIndex(Builder builder) { - this.checkIndexTime = builder.checkIndexTime; this.checkIndexTimeInMillis = ApiTypeHelper.requireNonNull(builder.checkIndexTimeInMillis, this, "checkIndexTimeInMillis"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - } - public static VerifyIndex of(Function> fn) { + public static VerifyIndex of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -86,7 +95,7 @@ public final Time checkIndexTime() { /** * Required - API name: {@code check_index_time_in_millis} */ - public final String checkIndexTimeInMillis() { + public final long checkIndexTimeInMillis() { return this.checkIndexTimeInMillis; } @@ -101,13 +110,14 @@ public final Time totalTime() { /** * Required - API name: {@code total_time_in_millis} */ - public final String totalTimeInMillis() { + public final long totalTimeInMillis() { return this.totalTimeInMillis; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -115,45 +125,73 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.checkIndexTime != null) { generator.writeKey("check_index_time"); this.checkIndexTime.serialize(generator, mapper); - } + generator.writeKey("check_index_time_in_millis"); generator.write(this.checkIndexTimeInMillis); if (this.totalTime != null) { generator.writeKey("total_time"); this.totalTime.serialize(generator, mapper); - } + generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link VerifyIndex}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time checkIndexTime; - - private String checkIndexTimeInMillis; - + private Long checkIndexTimeInMillis; @Nullable private Time totalTime; + private Long totalTimeInMillis; - private String totalTimeInMillis; + public Builder() {} + + private Builder(VerifyIndex o) { + this.checkIndexTime = o.checkIndexTime; + this.checkIndexTimeInMillis = o.checkIndexTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + private Builder(Builder o) { + this.checkIndexTime = o.checkIndexTime; + this.checkIndexTimeInMillis = o.checkIndexTimeInMillis; + this.totalTime = o.totalTime; + this.totalTimeInMillis = o.totalTimeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * API name: {@code check_index_time} */ + @Nonnull public final Builder checkIndexTime(@Nullable Time value) { this.checkIndexTime = value; return this; @@ -162,14 +200,16 @@ public final Builder checkIndexTime(@Nullable Time value) { /** * API name: {@code check_index_time} */ + @Nonnull public final Builder checkIndexTime(Function> fn) { - return this.checkIndexTime(fn.apply(new Time.Builder()).build()); + return checkIndexTime(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code check_index_time_in_millis} */ - public final Builder checkIndexTimeInMillis(String value) { + @Nonnull + public final Builder checkIndexTimeInMillis(long value) { this.checkIndexTimeInMillis = value; return this; } @@ -177,6 +217,7 @@ public final Builder checkIndexTimeInMillis(String value) { /** * API name: {@code total_time} */ + @Nonnull public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; @@ -185,14 +226,16 @@ public final Builder totalTime(@Nullable Time value) { /** * API name: {@code total_time} */ + @Nonnull public final Builder totalTime(Function> fn) { - return this.totalTime(fn.apply(new Time.Builder()).build()); + return totalTime(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(String value) { + @Nonnull + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -200,9 +243,10 @@ public final Builder totalTimeInMillis(String value) { /** * Builds a {@link VerifyIndex}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public VerifyIndex build() { _checkSingleUse(); @@ -221,12 +265,30 @@ public VerifyIndex build() { ); protected static void setupVerifyIndexDeserializer(ObjectDeserializer op) { - op.add(Builder::checkIndexTime, Time._DESERIALIZER, "check_index_time"); - op.add(Builder::checkIndexTimeInMillis, JsonpDeserializer.stringDeserializer(), "check_index_time_in_millis"); + op.add(Builder::checkIndexTimeInMillis, JsonpDeserializer.longDeserializer(), "check_index_time_in_millis"); op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.checkIndexTime); + result = 31 * result + Long.hashCode(this.checkIndexTimeInMillis); + result = 31 * result + Objects.hashCode(this.totalTime); + result = 31 * result + Long.hashCode(this.totalTimeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + VerifyIndex other = (VerifyIndex) o; + return Objects.equals(this.checkIndexTime, other.checkIndexTime) + && this.checkIndexTimeInMillis == other.checkIndexTimeInMillis + && Objects.equals(this.totalTime, other.totalTime) + && this.totalTimeInMillis == other.totalTimeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java index 5b21e9f837..1a94ebe7e9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexAliasItem.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.resolve_index; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,47 +48,57 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.resolve_index.ResolveIndexAliasItem @JsonpDeserializable -public class ResolveIndexAliasItem implements PlainJsonSerializable { - private final String name; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResolveIndexAliasItem + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nonnull private final List indices; + @Nonnull + private final String name; + // --------------------------------------------------------------------------------------------- private ResolveIndexAliasItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static ResolveIndexAliasItem of(Function> fn) { + public static ResolveIndexAliasItem of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code name} + * Required - API name: {@code indices} */ - public final String name() { - return this.name; + @Nonnull + public final List indices() { + return this.indices; } /** - * Required - API name: {@code indices} + * Required - API name: {@code name} */ - public final List indices() { - return this.indices; + @Nonnull + public final String name() { + return this.name; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -90,47 +106,63 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("indices"); + generator.writeStartArray(); + for (String item0 : this.indices) { + generator.write(item0); + } + generator.writeEnd(); generator.writeKey("name"); generator.write(this.name); + } - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (String item0 : this.indices) { - generator.write(item0); - - } - generator.writeEnd(); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ResolveIndexAliasItem}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List indices; private String name; - private List indices; + public Builder() {} - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + private Builder(ResolveIndexAliasItem o) { + this.indices = _listCopy(o.indices); + this.name = o.name; + } + + private Builder(Builder o) { + this.indices = _listCopy(o.indices); + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code indices} + * *

* Adds all elements of list to indices. + *

*/ + @Nonnull public final Builder indices(List list) { this.indices = _listAddAll(this.indices, list); return this; @@ -138,20 +170,33 @@ public final Builder indices(List list) { /** * Required - API name: {@code indices} + * *

* Adds one or more values to indices. + *

*/ + @Nonnull public final Builder indices(String value, String... values) { this.indices = _listAdd(this.indices, value, values); return this; } + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + /** * Builds a {@link ResolveIndexAliasItem}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ResolveIndexAliasItem build() { _checkSingleUse(); @@ -170,10 +215,23 @@ public ResolveIndexAliasItem build() { ); protected static void setupResolveIndexAliasItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "indices"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.indices.hashCode(); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResolveIndexAliasItem other = (ResolveIndexAliasItem) o; + return this.indices.equals(other.indices) && this.name.equals(other.name); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexDataStreamsItem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexDataStreamsItem.java new file mode 100644 index 0000000000..0b9bdfcca9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexDataStreamsItem.java @@ -0,0 +1,270 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.resolve_index; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.resolve_index.ResolveIndexDataStreamsItem + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResolveIndexDataStreamsItem + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List backingIndices; + + @Nonnull + private final String name; + + @Nonnull + private final String timestampField; + + // --------------------------------------------------------------------------------------------- + + private ResolveIndexDataStreamsItem(Builder builder) { + this.backingIndices = ApiTypeHelper.unmodifiableRequired(builder.backingIndices, this, "backingIndices"); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); + } + + public static ResolveIndexDataStreamsItem of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code backing_indices} + */ + @Nonnull + public final List backingIndices() { + return this.backingIndices; + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code timestamp_field} + */ + @Nonnull + public final String timestampField() { + return this.timestampField; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("backing_indices"); + generator.writeStartArray(); + for (String item0 : this.backingIndices) { + generator.write(item0); + } + generator.writeEnd(); + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("timestamp_field"); + generator.write(this.timestampField); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ResolveIndexDataStreamsItem}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List backingIndices; + private String name; + private String timestampField; + + public Builder() {} + + private Builder(ResolveIndexDataStreamsItem o) { + this.backingIndices = _listCopy(o.backingIndices); + this.name = o.name; + this.timestampField = o.timestampField; + } + + private Builder(Builder o) { + this.backingIndices = _listCopy(o.backingIndices); + this.name = o.name; + this.timestampField = o.timestampField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code backing_indices} + * + *

+ * Adds all elements of list to backingIndices. + *

+ */ + @Nonnull + public final Builder backingIndices(List list) { + this.backingIndices = _listAddAll(this.backingIndices, list); + return this; + } + + /** + * Required - API name: {@code backing_indices} + * + *

+ * Adds one or more values to backingIndices. + *

+ */ + @Nonnull + public final Builder backingIndices(String value, String... values) { + this.backingIndices = _listAdd(this.backingIndices, value, values); + return this; + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code timestamp_field} + */ + @Nonnull + public final Builder timestampField(String value) { + this.timestampField = value; + return this; + } + + /** + * Builds a {@link ResolveIndexDataStreamsItem}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ResolveIndexDataStreamsItem build() { + _checkSingleUse(); + + return new ResolveIndexDataStreamsItem(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ResolveIndexDataStreamsItem} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ResolveIndexDataStreamsItem::setupResolveIndexDataStreamsItemDeserializer + ); + + protected static void setupResolveIndexDataStreamsItemDeserializer(ObjectDeserializer op) { + op.add(Builder::backingIndices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "backing_indices"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::timestampField, JsonpDeserializer.stringDeserializer(), "timestamp_field"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.backingIndices.hashCode(); + result = 31 * result + this.name.hashCode(); + result = 31 * result + this.timestampField.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResolveIndexDataStreamsItem other = (ResolveIndexDataStreamsItem) o; + return this.backingIndices.equals(other.backingIndices) + && this.name.equals(other.name) + && this.timestampField.equals(other.timestampField); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java index a23b9f3a71..d0a4b85d72 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/resolve_index/ResolveIndexItem.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.resolve_index; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,47 +50,46 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.resolve_index.ResolveIndexItem @JsonpDeserializable -public class ResolveIndexItem implements PlainJsonSerializable { - private final String name; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResolveIndexItem implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final List aliases; + @Nonnull private final List attributes; @Nullable private final String dataStream; + @Nonnull + private final String name; + // --------------------------------------------------------------------------------------------- private ResolveIndexItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); this.dataStream = builder.dataStream; - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static ResolveIndexItem of(Function> fn) { + public static ResolveIndexItem of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - /** * API name: {@code aliases} */ + @Nonnull public final List aliases() { return this.aliases; } @@ -91,6 +97,7 @@ public final List aliases() { /** * Required - API name: {@code attributes} */ + @Nonnull public final List attributes() { return this.attributes; } @@ -103,9 +110,18 @@ public final String dataStream() { return this.dataStream; } + /** + * Required - API name: {@code name} + */ + @Nonnull + public final String name() { + return this.name; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -113,68 +129,85 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartArray(); for (String item0 : this.aliases) { generator.write(item0); - } generator.writeEnd(); - } - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartArray(); - for (String item0 : this.attributes) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("attributes"); + generator.writeStartArray(); + for (String item0 : this.attributes) { + generator.write(item0); } + generator.writeEnd(); + if (this.dataStream != null) { generator.writeKey("data_stream"); generator.write(this.dataStream); - } + generator.writeKey("name"); + generator.write(this.name); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ResolveIndexItem}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List aliases; - private List attributes; - @Nullable private String dataStream; + private String name; - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + public Builder() {} + + private Builder(ResolveIndexItem o) { + this.aliases = _listCopy(o.aliases); + this.attributes = _listCopy(o.attributes); + this.dataStream = o.dataStream; + this.name = o.name; + } + + private Builder(Builder o) { + this.aliases = _listCopy(o.aliases); + this.attributes = _listCopy(o.attributes); + this.dataStream = o.dataStream; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code aliases} + * *

* Adds all elements of list to aliases. + *

*/ + @Nonnull public final Builder aliases(List list) { this.aliases = _listAddAll(this.aliases, list); return this; @@ -182,9 +215,12 @@ public final Builder aliases(List list) { /** * API name: {@code aliases} + * *

* Adds one or more values to aliases. + *

*/ + @Nonnull public final Builder aliases(String value, String... values) { this.aliases = _listAdd(this.aliases, value, values); return this; @@ -192,9 +228,12 @@ public final Builder aliases(String value, String... values) { /** * Required - API name: {@code attributes} + * *

* Adds all elements of list to attributes. + *

*/ + @Nonnull public final Builder attributes(List list) { this.attributes = _listAddAll(this.attributes, list); return this; @@ -202,9 +241,12 @@ public final Builder attributes(List list) { /** * Required - API name: {@code attributes} + * *

* Adds one or more values to attributes. + *

*/ + @Nonnull public final Builder attributes(String value, String... values) { this.attributes = _listAdd(this.attributes, value, values); return this; @@ -213,17 +255,28 @@ public final Builder attributes(String value, String... values) { /** * API name: {@code data_stream} */ + @Nonnull public final Builder dataStream(@Nullable String value) { this.dataStream = value; return this; } + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + /** * Builds a {@link ResolveIndexItem}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ResolveIndexItem build() { _checkSingleUse(); @@ -242,12 +295,30 @@ public ResolveIndexItem build() { ); protected static void setupResolveIndexItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::aliases, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "aliases"); op.add(Builder::attributes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + this.attributes.hashCode(); + result = 31 * result + Objects.hashCode(this.dataStream); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResolveIndexItem other = (ResolveIndexItem) o; + return Objects.equals(this.aliases, other.aliases) + && this.attributes.equals(other.attributes) + && Objects.equals(this.dataStream, other.dataStream) + && this.name.equals(other.name); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java new file mode 100644 index 0000000000..d6f7df0363 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java @@ -0,0 +1,666 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.rollover; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.rollover.RolloverConditions + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RolloverConditions implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Time maxAge; + + @Nullable + private final Long maxAgeMillis; + + @Nullable + private final Long maxDocs; + + @Nullable + private final Long maxPrimaryShardDocs; + + @Nullable + private final String maxPrimaryShardSize; + + @Nullable + private final Long maxPrimaryShardSizeBytes; + + @Nullable + private final String maxSize; + + @Nullable + private final Long maxSizeBytes; + + @Nullable + private final Time minAge; + + @Nullable + private final Long minDocs; + + @Nullable + private final Long minPrimaryShardDocs; + + @Nullable + private final String minPrimaryShardSize; + + @Nullable + private final Long minPrimaryShardSizeBytes; + + @Nullable + private final String minSize; + + @Nullable + private final Long minSizeBytes; + + // --------------------------------------------------------------------------------------------- + + private RolloverConditions(Builder builder) { + this.maxAge = builder.maxAge; + this.maxAgeMillis = builder.maxAgeMillis; + this.maxDocs = builder.maxDocs; + this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; + this.maxPrimaryShardSize = builder.maxPrimaryShardSize; + this.maxPrimaryShardSizeBytes = builder.maxPrimaryShardSizeBytes; + this.maxSize = builder.maxSize; + this.maxSizeBytes = builder.maxSizeBytes; + this.minAge = builder.minAge; + this.minDocs = builder.minDocs; + this.minPrimaryShardDocs = builder.minPrimaryShardDocs; + this.minPrimaryShardSize = builder.minPrimaryShardSize; + this.minPrimaryShardSizeBytes = builder.minPrimaryShardSizeBytes; + this.minSize = builder.minSize; + this.minSizeBytes = builder.minSizeBytes; + } + + public static RolloverConditions of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_age} + */ + @Nullable + public final Time maxAge() { + return this.maxAge; + } + + /** + * API name: {@code max_age_millis} + */ + @Nullable + public final Long maxAgeMillis() { + return this.maxAgeMillis; + } + + /** + * API name: {@code max_docs} + */ + @Nullable + public final Long maxDocs() { + return this.maxDocs; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + @Nullable + public final Long maxPrimaryShardDocs() { + return this.maxPrimaryShardDocs; + } + + /** + * API name: {@code max_primary_shard_size} + */ + @Nullable + public final String maxPrimaryShardSize() { + return this.maxPrimaryShardSize; + } + + /** + * API name: {@code max_primary_shard_size_bytes} + */ + @Nullable + public final Long maxPrimaryShardSizeBytes() { + return this.maxPrimaryShardSizeBytes; + } + + /** + * API name: {@code max_size} + */ + @Nullable + public final String maxSize() { + return this.maxSize; + } + + /** + * API name: {@code max_size_bytes} + */ + @Nullable + public final Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * API name: {@code min_age} + */ + @Nullable + public final Time minAge() { + return this.minAge; + } + + /** + * API name: {@code min_docs} + */ + @Nullable + public final Long minDocs() { + return this.minDocs; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + @Nullable + public final Long minPrimaryShardDocs() { + return this.minPrimaryShardDocs; + } + + /** + * API name: {@code min_primary_shard_size} + */ + @Nullable + public final String minPrimaryShardSize() { + return this.minPrimaryShardSize; + } + + /** + * API name: {@code min_primary_shard_size_bytes} + */ + @Nullable + public final Long minPrimaryShardSizeBytes() { + return this.minPrimaryShardSizeBytes; + } + + /** + * API name: {@code min_size} + */ + @Nullable + public final String minSize() { + return this.minSize; + } + + /** + * API name: {@code min_size_bytes} + */ + @Nullable + public final Long minSizeBytes() { + return this.minSizeBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.maxAge != null) { + generator.writeKey("max_age"); + this.maxAge.serialize(generator, mapper); + } + + if (this.maxAgeMillis != null) { + generator.writeKey("max_age_millis"); + generator.write(this.maxAgeMillis); + } + + if (this.maxDocs != null) { + generator.writeKey("max_docs"); + generator.write(this.maxDocs); + } + + if (this.maxPrimaryShardDocs != null) { + generator.writeKey("max_primary_shard_docs"); + generator.write(this.maxPrimaryShardDocs); + } + + if (this.maxPrimaryShardSize != null) { + generator.writeKey("max_primary_shard_size"); + generator.write(this.maxPrimaryShardSize); + } + + if (this.maxPrimaryShardSizeBytes != null) { + generator.writeKey("max_primary_shard_size_bytes"); + generator.write(this.maxPrimaryShardSizeBytes); + } + + if (this.maxSize != null) { + generator.writeKey("max_size"); + generator.write(this.maxSize); + } + + if (this.maxSizeBytes != null) { + generator.writeKey("max_size_bytes"); + generator.write(this.maxSizeBytes); + } + + if (this.minAge != null) { + generator.writeKey("min_age"); + this.minAge.serialize(generator, mapper); + } + + if (this.minDocs != null) { + generator.writeKey("min_docs"); + generator.write(this.minDocs); + } + + if (this.minPrimaryShardDocs != null) { + generator.writeKey("min_primary_shard_docs"); + generator.write(this.minPrimaryShardDocs); + } + + if (this.minPrimaryShardSize != null) { + generator.writeKey("min_primary_shard_size"); + generator.write(this.minPrimaryShardSize); + } + + if (this.minPrimaryShardSizeBytes != null) { + generator.writeKey("min_primary_shard_size_bytes"); + generator.write(this.minPrimaryShardSizeBytes); + } + + if (this.minSize != null) { + generator.writeKey("min_size"); + generator.write(this.minSize); + } + + if (this.minSizeBytes != null) { + generator.writeKey("min_size_bytes"); + generator.write(this.minSizeBytes); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RolloverConditions}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time maxAge; + @Nullable + private Long maxAgeMillis; + @Nullable + private Long maxDocs; + @Nullable + private Long maxPrimaryShardDocs; + @Nullable + private String maxPrimaryShardSize; + @Nullable + private Long maxPrimaryShardSizeBytes; + @Nullable + private String maxSize; + @Nullable + private Long maxSizeBytes; + @Nullable + private Time minAge; + @Nullable + private Long minDocs; + @Nullable + private Long minPrimaryShardDocs; + @Nullable + private String minPrimaryShardSize; + @Nullable + private Long minPrimaryShardSizeBytes; + @Nullable + private String minSize; + @Nullable + private Long minSizeBytes; + + public Builder() {} + + private Builder(RolloverConditions o) { + this.maxAge = o.maxAge; + this.maxAgeMillis = o.maxAgeMillis; + this.maxDocs = o.maxDocs; + this.maxPrimaryShardDocs = o.maxPrimaryShardDocs; + this.maxPrimaryShardSize = o.maxPrimaryShardSize; + this.maxPrimaryShardSizeBytes = o.maxPrimaryShardSizeBytes; + this.maxSize = o.maxSize; + this.maxSizeBytes = o.maxSizeBytes; + this.minAge = o.minAge; + this.minDocs = o.minDocs; + this.minPrimaryShardDocs = o.minPrimaryShardDocs; + this.minPrimaryShardSize = o.minPrimaryShardSize; + this.minPrimaryShardSizeBytes = o.minPrimaryShardSizeBytes; + this.minSize = o.minSize; + this.minSizeBytes = o.minSizeBytes; + } + + private Builder(Builder o) { + this.maxAge = o.maxAge; + this.maxAgeMillis = o.maxAgeMillis; + this.maxDocs = o.maxDocs; + this.maxPrimaryShardDocs = o.maxPrimaryShardDocs; + this.maxPrimaryShardSize = o.maxPrimaryShardSize; + this.maxPrimaryShardSizeBytes = o.maxPrimaryShardSizeBytes; + this.maxSize = o.maxSize; + this.maxSizeBytes = o.maxSizeBytes; + this.minAge = o.minAge; + this.minDocs = o.minDocs; + this.minPrimaryShardDocs = o.minPrimaryShardDocs; + this.minPrimaryShardSize = o.minPrimaryShardSize; + this.minPrimaryShardSizeBytes = o.minPrimaryShardSizeBytes; + this.minSize = o.minSize; + this.minSizeBytes = o.minSizeBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code max_age} + */ + @Nonnull + public final Builder maxAge(@Nullable Time value) { + this.maxAge = value; + return this; + } + + /** + * API name: {@code max_age} + */ + @Nonnull + public final Builder maxAge(Function> fn) { + return maxAge(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code max_age_millis} + */ + @Nonnull + public final Builder maxAgeMillis(@Nullable Long value) { + this.maxAgeMillis = value; + return this; + } + + /** + * API name: {@code max_docs} + */ + @Nonnull + public final Builder maxDocs(@Nullable Long value) { + this.maxDocs = value; + return this; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + @Nonnull + public final Builder maxPrimaryShardDocs(@Nullable Long value) { + this.maxPrimaryShardDocs = value; + return this; + } + + /** + * API name: {@code max_primary_shard_size} + */ + @Nonnull + public final Builder maxPrimaryShardSize(@Nullable String value) { + this.maxPrimaryShardSize = value; + return this; + } + + /** + * API name: {@code max_primary_shard_size_bytes} + */ + @Nonnull + public final Builder maxPrimaryShardSizeBytes(@Nullable Long value) { + this.maxPrimaryShardSizeBytes = value; + return this; + } + + /** + * API name: {@code max_size} + */ + @Nonnull + public final Builder maxSize(@Nullable String value) { + this.maxSize = value; + return this; + } + + /** + * API name: {@code max_size_bytes} + */ + @Nonnull + public final Builder maxSizeBytes(@Nullable Long value) { + this.maxSizeBytes = value; + return this; + } + + /** + * API name: {@code min_age} + */ + @Nonnull + public final Builder minAge(@Nullable Time value) { + this.minAge = value; + return this; + } + + /** + * API name: {@code min_age} + */ + @Nonnull + public final Builder minAge(Function> fn) { + return minAge(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code min_docs} + */ + @Nonnull + public final Builder minDocs(@Nullable Long value) { + this.minDocs = value; + return this; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + @Nonnull + public final Builder minPrimaryShardDocs(@Nullable Long value) { + this.minPrimaryShardDocs = value; + return this; + } + + /** + * API name: {@code min_primary_shard_size} + */ + @Nonnull + public final Builder minPrimaryShardSize(@Nullable String value) { + this.minPrimaryShardSize = value; + return this; + } + + /** + * API name: {@code min_primary_shard_size_bytes} + */ + @Nonnull + public final Builder minPrimaryShardSizeBytes(@Nullable Long value) { + this.minPrimaryShardSizeBytes = value; + return this; + } + + /** + * API name: {@code min_size} + */ + @Nonnull + public final Builder minSize(@Nullable String value) { + this.minSize = value; + return this; + } + + /** + * API name: {@code min_size_bytes} + */ + @Nonnull + public final Builder minSizeBytes(@Nullable Long value) { + this.minSizeBytes = value; + return this; + } + + /** + * Builds a {@link RolloverConditions}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RolloverConditions build() { + _checkSingleUse(); + + return new RolloverConditions(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RolloverConditions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RolloverConditions::setupRolloverConditionsDeserializer + ); + + protected static void setupRolloverConditionsDeserializer(ObjectDeserializer op) { + op.add(Builder::maxAge, Time._DESERIALIZER, "max_age"); + op.add(Builder::maxAgeMillis, JsonpDeserializer.longDeserializer(), "max_age_millis"); + op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); + op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); + op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); + op.add(Builder::maxPrimaryShardSizeBytes, JsonpDeserializer.longDeserializer(), "max_primary_shard_size_bytes"); + op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); + op.add(Builder::maxSizeBytes, JsonpDeserializer.longDeserializer(), "max_size_bytes"); + op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); + op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); + op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); + op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); + op.add(Builder::minPrimaryShardSizeBytes, JsonpDeserializer.longDeserializer(), "min_primary_shard_size_bytes"); + op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); + op.add(Builder::minSizeBytes, JsonpDeserializer.longDeserializer(), "min_size_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxAge); + result = 31 * result + Objects.hashCode(this.maxAgeMillis); + result = 31 * result + Objects.hashCode(this.maxDocs); + result = 31 * result + Objects.hashCode(this.maxPrimaryShardDocs); + result = 31 * result + Objects.hashCode(this.maxPrimaryShardSize); + result = 31 * result + Objects.hashCode(this.maxPrimaryShardSizeBytes); + result = 31 * result + Objects.hashCode(this.maxSize); + result = 31 * result + Objects.hashCode(this.maxSizeBytes); + result = 31 * result + Objects.hashCode(this.minAge); + result = 31 * result + Objects.hashCode(this.minDocs); + result = 31 * result + Objects.hashCode(this.minPrimaryShardDocs); + result = 31 * result + Objects.hashCode(this.minPrimaryShardSize); + result = 31 * result + Objects.hashCode(this.minPrimaryShardSizeBytes); + result = 31 * result + Objects.hashCode(this.minSize); + result = 31 * result + Objects.hashCode(this.minSizeBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RolloverConditions other = (RolloverConditions) o; + return Objects.equals(this.maxAge, other.maxAge) + && Objects.equals(this.maxAgeMillis, other.maxAgeMillis) + && Objects.equals(this.maxDocs, other.maxDocs) + && Objects.equals(this.maxPrimaryShardDocs, other.maxPrimaryShardDocs) + && Objects.equals(this.maxPrimaryShardSize, other.maxPrimaryShardSize) + && Objects.equals(this.maxPrimaryShardSizeBytes, other.maxPrimaryShardSizeBytes) + && Objects.equals(this.maxSize, other.maxSize) + && Objects.equals(this.maxSizeBytes, other.maxSizeBytes) + && Objects.equals(this.minAge, other.minAge) + && Objects.equals(this.minDocs, other.minDocs) + && Objects.equals(this.minPrimaryShardDocs, other.minPrimaryShardDocs) + && Objects.equals(this.minPrimaryShardSize, other.minPrimaryShardSize) + && Objects.equals(this.minPrimaryShardSizeBytes, other.minPrimaryShardSizeBytes) + && Objects.equals(this.minSize, other.minSize) + && Objects.equals(this.minSizeBytes, other.minSizeBytes); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java index 7ce9d1dcfa..f519c436c3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/IndexSegment.java @@ -30,12 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.segments; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,30 +49,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.IndexSegment @JsonpDeserializable -public class IndexSegment implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexSegment implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map> shards; // --------------------------------------------------------------------------------------------- private IndexSegment(Builder builder) { - this.shards = ApiTypeHelper.unmodifiableRequired(builder.shards, this, "shards"); - } - public static IndexSegment of(Function> fn) { + public static IndexSegment of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code shards} */ + @Nonnull public final Map> shards() { return this.shards; } @@ -74,6 +84,7 @@ public final Map> shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,42 +92,64 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("shards"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (ShardsSegment item1 : item0.getValue()) { - item1.serialize(generator, mapper); - - } + generator.writeKey("shards"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.shards.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (ShardsSegment item1 : item0.getValue()) { + item1.serialize(generator, mapper); } - generator.writeEnd(); - } generator.writeEnd(); - } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndexSegment}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map> shards; + public Builder() {} + + private Builder(IndexSegment o) { + this.shards = _mapCopy(o.shards); + } + + private Builder(Builder o) { + this.shards = _mapCopy(o.shards); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ + @Nonnull public final Builder shards(Map> map) { this.shards = _mapPutAll(this.shards, map); return this; @@ -124,9 +157,12 @@ public final Builder shards(Map> map) { /** * Required - API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ + @Nonnull public final Builder shards(String key, List value) { this.shards = _mapPut(this.shards, key, value); return this; @@ -135,9 +171,10 @@ public final Builder shards(String key, List value) { /** * Builds a {@link IndexSegment}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndexSegment build() { _checkSingleUse(); @@ -156,13 +193,25 @@ public IndexSegment build() { ); protected static void setupIndexSegmentDeserializer(ObjectDeserializer op) { - op.add( Builder::shards, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(ShardsSegment._DESERIALIZER)), "shards" ); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexSegment other = (IndexSegment) o; + return this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/Segment.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/Segment.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/Segment.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/Segment.java index 0c82e3199c..a3c4ff7e10 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/Segment.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/Segment.java @@ -30,11 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.segments; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,57 +50,71 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.Segment @JsonpDeserializable -public class Segment implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Segment implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map attributes; private final boolean committed; private final boolean compound; - private final long deletedDocs; + private final int deletedDocs; private final int generation; - private final double memoryInBytes; + @Nullable + private final String memory; + + @Nullable + private final Long memoryInBytes; + + private final int numDocs; private final boolean search; - private final double sizeInBytes; + @Nullable + private final String size; - private final long numDocs; + private final long sizeInBytes; + @Nonnull private final String version; // --------------------------------------------------------------------------------------------- private Segment(Builder builder) { - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); this.committed = ApiTypeHelper.requireNonNull(builder.committed, this, "committed"); this.compound = ApiTypeHelper.requireNonNull(builder.compound, this, "compound"); this.deletedDocs = ApiTypeHelper.requireNonNull(builder.deletedDocs, this, "deletedDocs"); this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); - this.memoryInBytes = ApiTypeHelper.requireNonNull(builder.memoryInBytes, this, "memoryInBytes"); + this.memory = builder.memory; + this.memoryInBytes = builder.memoryInBytes; + this.numDocs = ApiTypeHelper.requireNonNull(builder.numDocs, this, "numDocs"); this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); + this.size = builder.size; this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - this.numDocs = ApiTypeHelper.requireNonNull(builder.numDocs, this, "numDocs"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - } - public static Segment of(Function> fn) { + public static Segment of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code attributes} */ + @Nonnull public final Map attributes() { return this.attributes; } @@ -114,7 +136,7 @@ public final boolean compound() { /** * Required - API name: {@code deleted_docs} */ - public final long deletedDocs() { + public final int deletedDocs() { return this.deletedDocs; } @@ -126,12 +148,28 @@ public final int generation() { } /** - * Required - API name: {@code memory_in_bytes} + * API name: {@code memory} */ - public final double memoryInBytes() { + @Nullable + public final String memory() { + return this.memory; + } + + /** + * API name: {@code memory_in_bytes} + */ + @Nullable + public final Long memoryInBytes() { return this.memoryInBytes; } + /** + * Required - API name: {@code num_docs} + */ + public final int numDocs() { + return this.numDocs; + } + /** * Required - API name: {@code search} */ @@ -140,22 +178,24 @@ public final boolean search() { } /** - * Required - API name: {@code size_in_bytes} + * API name: {@code size} */ - public final double sizeInBytes() { - return this.sizeInBytes; + @Nullable + public final String size() { + return this.size; } /** - * Required - API name: {@code num_docs} + * Required - API name: {@code size_in_bytes} */ - public final long numDocs() { - return this.numDocs; + public final long sizeInBytes() { + return this.sizeInBytes; } /** * Required - API name: {@code version} */ + @Nonnull public final String version() { return this.version; } @@ -163,6 +203,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -170,18 +211,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } + generator.writeEnd(); + generator.writeKey("committed"); generator.write(this.committed); @@ -194,55 +231,113 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("generation"); generator.write(this.generation); - generator.writeKey("memory_in_bytes"); - generator.write(this.memoryInBytes); + if (this.memory != null) { + generator.writeKey("memory"); + generator.write(this.memory); + } + + if (this.memoryInBytes != null) { + generator.writeKey("memory_in_bytes"); + generator.write(this.memoryInBytes); + } + + generator.writeKey("num_docs"); + generator.write(this.numDocs); generator.writeKey("search"); generator.write(this.search); + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + } + generator.writeKey("size_in_bytes"); generator.write(this.sizeInBytes); - generator.writeKey("num_docs"); - generator.write(this.numDocs); - generator.writeKey("version"); generator.write(this.version); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Segment}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map attributes; - private Boolean committed; - private Boolean compound; - - private Long deletedDocs; - + private Integer deletedDocs; private Integer generation; - - private Double memoryInBytes; - + @Nullable + private String memory; + @Nullable + private Long memoryInBytes; + private Integer numDocs; private Boolean search; + @Nullable + private String size; + private Long sizeInBytes; + private String version; - private Double sizeInBytes; + public Builder() {} + + private Builder(Segment o) { + this.attributes = _mapCopy(o.attributes); + this.committed = o.committed; + this.compound = o.compound; + this.deletedDocs = o.deletedDocs; + this.generation = o.generation; + this.memory = o.memory; + this.memoryInBytes = o.memoryInBytes; + this.numDocs = o.numDocs; + this.search = o.search; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + this.version = o.version; + } - private Long numDocs; + private Builder(Builder o) { + this.attributes = _mapCopy(o.attributes); + this.committed = o.committed; + this.compound = o.compound; + this.deletedDocs = o.deletedDocs; + this.generation = o.generation; + this.memory = o.memory; + this.memoryInBytes = o.memoryInBytes; + this.numDocs = o.numDocs; + this.search = o.search; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + this.version = o.version; + } - private String version; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code attributes} + * *

- * Adds all entries of map to attributes. + * Adds all elements of map to attributes. + *

*/ + @Nonnull public final Builder attributes(Map map) { this.attributes = _mapPutAll(this.attributes, map); return this; @@ -250,9 +345,12 @@ public final Builder attributes(Map map) { /** * Required - API name: {@code attributes} + * *

* Adds an entry to attributes. + *

*/ + @Nonnull public final Builder attributes(String key, String value) { this.attributes = _mapPut(this.attributes, key, value); return this; @@ -261,6 +359,7 @@ public final Builder attributes(String key, String value) { /** * Required - API name: {@code committed} */ + @Nonnull public final Builder committed(boolean value) { this.committed = value; return this; @@ -269,6 +368,7 @@ public final Builder committed(boolean value) { /** * Required - API name: {@code compound} */ + @Nonnull public final Builder compound(boolean value) { this.compound = value; return this; @@ -277,7 +377,8 @@ public final Builder compound(boolean value) { /** * Required - API name: {@code deleted_docs} */ - public final Builder deletedDocs(long value) { + @Nonnull + public final Builder deletedDocs(int value) { this.deletedDocs = value; return this; } @@ -285,46 +386,70 @@ public final Builder deletedDocs(long value) { /** * Required - API name: {@code generation} */ + @Nonnull public final Builder generation(int value) { this.generation = value; return this; } /** - * Required - API name: {@code memory_in_bytes} + * API name: {@code memory} + */ + @Nonnull + public final Builder memory(@Nullable String value) { + this.memory = value; + return this; + } + + /** + * API name: {@code memory_in_bytes} */ - public final Builder memoryInBytes(double value) { + @Nonnull + public final Builder memoryInBytes(@Nullable Long value) { this.memoryInBytes = value; return this; } + /** + * Required - API name: {@code num_docs} + */ + @Nonnull + public final Builder numDocs(int value) { + this.numDocs = value; + return this; + } + /** * Required - API name: {@code search} */ + @Nonnull public final Builder search(boolean value) { this.search = value; return this; } /** - * Required - API name: {@code size_in_bytes} + * API name: {@code size} */ - public final Builder sizeInBytes(double value) { - this.sizeInBytes = value; + @Nonnull + public final Builder size(@Nullable String value) { + this.size = value; return this; } /** - * Required - API name: {@code num_docs} + * Required - API name: {@code size_in_bytes} */ - public final Builder numDocs(long value) { - this.numDocs = value; + @Nonnull + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; return this; } /** * Required - API name: {@code version} */ + @Nonnull public final Builder version(String value) { this.version = value; return this; @@ -333,9 +458,10 @@ public final Builder version(String value) { /** * Builds a {@link Segment}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Segment build() { _checkSingleUse(); @@ -354,18 +480,54 @@ public Segment build() { ); protected static void setupSegmentDeserializer(ObjectDeserializer op) { - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(Builder::committed, JsonpDeserializer.booleanDeserializer(), "committed"); op.add(Builder::compound, JsonpDeserializer.booleanDeserializer(), "compound"); - op.add(Builder::deletedDocs, JsonpDeserializer.longDeserializer(), "deleted_docs"); + op.add(Builder::deletedDocs, JsonpDeserializer.integerDeserializer(), "deleted_docs"); op.add(Builder::generation, JsonpDeserializer.integerDeserializer(), "generation"); - op.add(Builder::memoryInBytes, JsonpDeserializer.doubleDeserializer(), "memory_in_bytes"); + op.add(Builder::memory, JsonpDeserializer.stringDeserializer(), "memory"); + op.add(Builder::memoryInBytes, JsonpDeserializer.longDeserializer(), "memory_in_bytes"); + op.add(Builder::numDocs, JsonpDeserializer.integerDeserializer(), "num_docs"); op.add(Builder::search, JsonpDeserializer.booleanDeserializer(), "search"); - op.add(Builder::sizeInBytes, JsonpDeserializer.doubleDeserializer(), "size_in_bytes"); - op.add(Builder::numDocs, JsonpDeserializer.longDeserializer(), "num_docs"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.attributes.hashCode(); + result = 31 * result + Boolean.hashCode(this.committed); + result = 31 * result + Boolean.hashCode(this.compound); + result = 31 * result + Integer.hashCode(this.deletedDocs); + result = 31 * result + Integer.hashCode(this.generation); + result = 31 * result + Objects.hashCode(this.memory); + result = 31 * result + Objects.hashCode(this.memoryInBytes); + result = 31 * result + Integer.hashCode(this.numDocs); + result = 31 * result + Boolean.hashCode(this.search); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + result = 31 * result + this.version.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Segment other = (Segment) o; + return this.attributes.equals(other.attributes) + && this.committed == other.committed + && this.compound == other.compound + && this.deletedDocs == other.deletedDocs + && this.generation == other.generation + && Objects.equals(this.memory, other.memory) + && Objects.equals(this.memoryInBytes, other.memoryInBytes) + && this.numDocs == other.numDocs + && this.search == other.search + && Objects.equals(this.size, other.size) + && this.sizeInBytes == other.sizeInBytes + && this.version.equals(other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java index f6b131df2c..11db480210 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardSegmentRouting.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.segments; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,36 +47,41 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.ShardSegmentRouting @JsonpDeserializable -public class ShardSegmentRouting implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardSegmentRouting implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String node; private final boolean primary; + @Nonnull private final String state; // --------------------------------------------------------------------------------------------- private ShardSegmentRouting(Builder builder) { - this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); - } - public static ShardSegmentRouting of(Function> fn) { + public static ShardSegmentRouting of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code node} */ + @Nonnull public final String node() { return this.node; } @@ -85,6 +96,7 @@ public final boolean primary() { /** * Required - API name: {@code state} */ + @Nonnull public final String state() { return this.state; } @@ -92,6 +104,7 @@ public final String state() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +112,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("node"); generator.write(this.node); @@ -108,25 +120,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("state"); generator.write(this.state); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardSegmentRouting}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String node; - private Boolean primary; - private String state; + public Builder() {} + + private Builder(ShardSegmentRouting o) { + this.node = o.node; + this.primary = o.primary; + this.state = o.state; + } + + private Builder(Builder o) { + this.node = o.node; + this.primary = o.primary; + this.state = o.state; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code node} */ + @Nonnull public final Builder node(String value) { this.node = value; return this; @@ -135,6 +175,7 @@ public final Builder node(String value) { /** * Required - API name: {@code primary} */ + @Nonnull public final Builder primary(boolean value) { this.primary = value; return this; @@ -143,6 +184,7 @@ public final Builder primary(boolean value) { /** * Required - API name: {@code state} */ + @Nonnull public final Builder state(String value) { this.state = value; return this; @@ -151,9 +193,10 @@ public final Builder state(String value) { /** * Builds a {@link ShardSegmentRouting}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardSegmentRouting build() { _checkSingleUse(); @@ -172,11 +215,25 @@ public ShardSegmentRouting build() { ); protected static void setupShardSegmentRoutingDeserializer(ObjectDeserializer op) { - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.node.hashCode(); + result = 31 * result + Boolean.hashCode(this.primary); + result = 31 * result + this.state.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardSegmentRouting other = (ShardSegmentRouting) o; + return this.node.equals(other.node) && this.primary == other.primary && this.state.equals(other.state); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java index dca418771d..c1fc2fc94a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/segments/ShardsSegment.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.segments; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,33 +48,37 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.segments.ShardsSegment @JsonpDeserializable -public class ShardsSegment implements PlainJsonSerializable { - private final int numCommittedSegments; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardsSegment implements PlainJsonSerializable, ToCopyableBuilder { - private final ShardSegmentRouting routing; + private final int numCommittedSegments; private final int numSearchSegments; + @Nonnull + private final ShardSegmentRouting routing; + + @Nonnull private final Map segments; // --------------------------------------------------------------------------------------------- private ShardsSegment(Builder builder) { - this.numCommittedSegments = ApiTypeHelper.requireNonNull(builder.numCommittedSegments, this, "numCommittedSegments"); - this.routing = ApiTypeHelper.requireNonNull(builder.routing, this, "routing"); this.numSearchSegments = ApiTypeHelper.requireNonNull(builder.numSearchSegments, this, "numSearchSegments"); + this.routing = ApiTypeHelper.requireNonNull(builder.routing, this, "routing"); this.segments = ApiTypeHelper.unmodifiableRequired(builder.segments, this, "segments"); - } - public static ShardsSegment of(Function> fn) { + public static ShardsSegment of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -80,22 +90,24 @@ public final int numCommittedSegments() { } /** - * Required - API name: {@code routing} + * Required - API name: {@code num_search_segments} */ - public final ShardSegmentRouting routing() { - return this.routing; + public final int numSearchSegments() { + return this.numSearchSegments; } /** - * Required - API name: {@code num_search_segments} + * Required - API name: {@code routing} */ - public final int numSearchSegments() { - return this.numSearchSegments; + @Nonnull + public final ShardSegmentRouting routing() { + return this.routing; } /** * Required - API name: {@code segments} */ + @Nonnull public final Map segments() { return this.segments; } @@ -103,6 +115,7 @@ public final Map segments() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,81 +123,111 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("num_committed_segments"); generator.write(this.numCommittedSegments); - generator.writeKey("routing"); - this.routing.serialize(generator, mapper); - generator.writeKey("num_search_segments"); generator.write(this.numSearchSegments); - if (ApiTypeHelper.isDefined(this.segments)) { - generator.writeKey("segments"); - generator.writeStartObject(); - for (Map.Entry item0 : this.segments.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeKey("routing"); + this.routing.serialize(generator, mapper); + generator.writeKey("segments"); + generator.writeStartObject(); + for (Map.Entry item0 : this.segments.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardsSegment}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer numCommittedSegments; - + private Integer numSearchSegments; private ShardSegmentRouting routing; + private Map segments; - private Integer numSearchSegments; + public Builder() {} - private Map segments; + private Builder(ShardsSegment o) { + this.numCommittedSegments = o.numCommittedSegments; + this.numSearchSegments = o.numSearchSegments; + this.routing = o.routing; + this.segments = _mapCopy(o.segments); + } + + private Builder(Builder o) { + this.numCommittedSegments = o.numCommittedSegments; + this.numSearchSegments = o.numSearchSegments; + this.routing = o.routing; + this.segments = _mapCopy(o.segments); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code num_committed_segments} */ + @Nonnull public final Builder numCommittedSegments(int value) { this.numCommittedSegments = value; return this; } /** - * Required - API name: {@code routing} + * Required - API name: {@code num_search_segments} */ - public final Builder routing(ShardSegmentRouting value) { - this.routing = value; + @Nonnull + public final Builder numSearchSegments(int value) { + this.numSearchSegments = value; return this; } /** * Required - API name: {@code routing} */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new ShardSegmentRouting.Builder()).build()); + @Nonnull + public final Builder routing(ShardSegmentRouting value) { + this.routing = value; + return this; } /** - * Required - API name: {@code num_search_segments} + * Required - API name: {@code routing} */ - public final Builder numSearchSegments(int value) { - this.numSearchSegments = value; - return this; + @Nonnull + public final Builder routing(Function> fn) { + return routing(fn.apply(new ShardSegmentRouting.Builder()).build()); } /** * Required - API name: {@code segments} + * *

- * Adds all entries of map to segments. + * Adds all elements of map to segments. + *

*/ + @Nonnull public final Builder segments(Map map) { this.segments = _mapPutAll(this.segments, map); return this; @@ -192,9 +235,12 @@ public final Builder segments(Map map) { /** * Required - API name: {@code segments} + * *

* Adds an entry to segments. + *

*/ + @Nonnull public final Builder segments(String key, Segment value) { this.segments = _mapPut(this.segments, key, value); return this; @@ -202,9 +248,12 @@ public final Builder segments(String key, Segment value) { /** * Required - API name: {@code segments} + * *

- * Adds an entry to segments using a builder lambda. + * Adds a value to segments using a builder lambda. + *

*/ + @Nonnull public final Builder segments(String key, Function> fn) { return segments(key, fn.apply(new Segment.Builder()).build()); } @@ -212,9 +261,10 @@ public final Builder segments(String key, Function op) { - op.add(Builder::numCommittedSegments, JsonpDeserializer.integerDeserializer(), "num_committed_segments"); - op.add(Builder::routing, ShardSegmentRouting._DESERIALIZER, "routing"); op.add(Builder::numSearchSegments, JsonpDeserializer.integerDeserializer(), "num_search_segments"); + op.add(Builder::routing, ShardSegmentRouting._DESERIALIZER, "routing"); op.add(Builder::segments, JsonpDeserializer.stringMapDeserializer(Segment._DESERIALIZER), "segments"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.numCommittedSegments); + result = 31 * result + Integer.hashCode(this.numSearchSegments); + result = 31 * result + this.routing.hashCode(); + result = 31 * result + this.segments.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardsSegment other = (ShardsSegment) o; + return this.numCommittedSegments == other.numCommittedSegments + && this.numSearchSegments == other.numSearchSegments + && this.routing.equals(other.routing) + && this.segments.equals(other.segments); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java index 1f5a0a48b8..2b27433459 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/IndicesShardStores.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.IndicesShardStores @JsonpDeserializable -public class IndicesShardStores implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesShardStores implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map shards; // --------------------------------------------------------------------------------------------- private IndicesShardStores(Builder builder) { - this.shards = ApiTypeHelper.unmodifiableRequired(builder.shards, this, "shards"); - } - public static IndicesShardStores of(Function> fn) { + public static IndicesShardStores of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code shards} */ + @Nonnull public final Map shards() { return this.shards; } @@ -73,6 +83,7 @@ public final Map shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,35 +91,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("shards"); + generator.writeStartObject(); + for (Map.Entry item0 : this.shards.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndicesShardStores}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map shards; + public Builder() {} + + private Builder(IndicesShardStores o) { + this.shards = _mapCopy(o.shards); + } + + private Builder(Builder o) { + this.shards = _mapCopy(o.shards); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ + @Nonnull public final Builder shards(Map map) { this.shards = _mapPutAll(this.shards, map); return this; @@ -116,9 +150,12 @@ public final Builder shards(Map map) { /** * Required - API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ + @Nonnull public final Builder shards(String key, ShardStoreWrapper value) { this.shards = _mapPut(this.shards, key, value); return this; @@ -126,9 +163,12 @@ public final Builder shards(String key, ShardStoreWrapper value) { /** * Required - API name: {@code shards} + * *

- * Adds an entry to shards using a builder lambda. + * Adds a value to shards using a builder lambda. + *

*/ + @Nonnull public final Builder shards(String key, Function> fn) { return shards(key, fn.apply(new ShardStoreWrapper.Builder()).build()); } @@ -136,9 +176,10 @@ public final Builder shards(String key, Function op) { - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(ShardStoreWrapper._DESERIALIZER), "shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesShardStores other = (IndicesShardStores) o; + return this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java index 3f1add7602..f2433e32de 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStore.java @@ -30,120 +30,97 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import org.opensearch.client.json.JsonData; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.NodeAttributes; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.ShardStore @JsonpDeserializable -public class ShardStore implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardStore implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final ShardStoreAllocation allocation; + @Nullable private final String allocationId; - private final Map attributes; - - private final String id; - - private final long legacyVersion; - - private final String name; + @Nonnull + private final Map nodes; + @Nullable private final ShardStoreException storeException; - private final String transportAddress; - // --------------------------------------------------------------------------------------------- private ShardStore(Builder builder) { - this.allocation = ApiTypeHelper.requireNonNull(builder.allocation, this, "allocation"); - this.allocationId = ApiTypeHelper.requireNonNull(builder.allocationId, this, "allocationId"); - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.legacyVersion = ApiTypeHelper.requireNonNull(builder.legacyVersion, this, "legacyVersion"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.storeException = ApiTypeHelper.requireNonNull(builder.storeException, this, "storeException"); - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); - + this.allocationId = builder.allocationId; + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + this.storeException = builder.storeException; } - public static ShardStore of(Function> fn) { + public static ShardStore of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code allocation} */ + @Nonnull public final ShardStoreAllocation allocation() { return this.allocation; } /** - * Required - API name: {@code allocation_id} + * API name: {@code allocation_id} */ + @Nullable public final String allocationId() { return this.allocationId; } - /** - * Required - API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - API name: {@code legacy_version} - */ - public final long legacyVersion() { - return this.legacyVersion; - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; + @Nonnull + public final Map nodes() { + return this.nodes; } /** - * Required - API name: {@code store_exception} + * API name: {@code store_exception} */ + @Nullable public final ShardStoreException storeException() { return this.storeException; } - /** - * Required - API name: {@code transport_address} - */ - public final String transportAddress() { - return this.transportAddress; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -151,152 +128,148 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } generator.writeKey("allocation"); this.allocation.serialize(generator, mapper); - generator.writeKey("allocation_id"); - generator.write(this.allocationId); - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + if (this.allocationId != null) { + generator.writeKey("allocation_id"); + generator.write(this.allocationId); } - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("legacy_version"); - generator.write(this.legacyVersion); - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("store_exception"); - this.storeException.serialize(generator, mapper); + if (this.storeException != null) { + generator.writeKey("store_exception"); + this.storeException.serialize(generator, mapper); + } + } - generator.writeKey("transport_address"); - generator.write(this.transportAddress); + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ShardStore}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private ShardStoreAllocation allocation; - + @Nullable private String allocationId; + @Nullable + private Map nodes; + @Nullable + private ShardStoreException storeException; - private Map attributes; - - private String id; - - private Long legacyVersion; + public Builder() {} - private String name; + private Builder(ShardStore o) { + this.allocation = o.allocation; + this.allocationId = o.allocationId; + this.nodes = _mapCopy(o.nodes); + this.storeException = o.storeException; + } - private ShardStoreException storeException; + private Builder(Builder o) { + this.allocation = o.allocation; + this.allocationId = o.allocationId; + this.nodes = _mapCopy(o.nodes); + this.storeException = o.storeException; + } - private String transportAddress; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code allocation} */ + @Nonnull public final Builder allocation(ShardStoreAllocation value) { this.allocation = value; return this; } /** - * Required - API name: {@code allocation_id} + * API name: {@code allocation_id} */ - public final Builder allocationId(String value) { + @Nonnull + public final Builder allocationId(@Nullable String value) { this.allocationId = value; return this; } /** - * Required - API name: {@code attributes} + * *

- * Adds all entries of map to attributes. + * Adds all elements of map to nodes. + *

*/ - public final Builder attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); + @Nonnull + public final Builder nodes(Map map) { + this.nodes = _mapPutAll(this.nodes, map); return this; } /** - * Required - API name: {@code attributes} + * *

- * Adds an entry to attributes. - */ - public final Builder attributes(String key, JsonData value) { - this.attributes = _mapPut(this.attributes, key, value); - return this; - } - - /** - * Required - API name: {@code id} + * Adds an entry to nodes. + *

*/ - public final Builder id(String value) { - this.id = value; + @Nonnull + public final Builder nodes(String key, NodeAttributes value) { + this.nodes = _mapPut(this.nodes, key, value); return this; } /** - * Required - API name: {@code legacy_version} - */ - public final Builder legacyVersion(long value) { - this.legacyVersion = value; - return this; - } - - /** - * Required - API name: {@code name} + * + *

+ * Adds a value to nodes using a builder lambda. + *

*/ - public final Builder name(String value) { - this.name = value; - return this; + @Nonnull + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new NodeAttributes.Builder()).build()); } /** - * Required - API name: {@code store_exception} + * API name: {@code store_exception} */ - public final Builder storeException(ShardStoreException value) { + @Nonnull + public final Builder storeException(@Nullable ShardStoreException value) { this.storeException = value; return this; } /** - * Required - API name: {@code store_exception} + * API name: {@code store_exception} */ + @Nonnull public final Builder storeException(Function> fn) { - return this.storeException(fn.apply(new ShardStoreException.Builder()).build()); - } - - /** - * Required - API name: {@code transport_address} - */ - public final Builder transportAddress(String value) { - this.transportAddress = value; - return this; + return storeException(fn.apply(new ShardStoreException.Builder()).build()); } /** * Builds a {@link ShardStore}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardStore build() { _checkSingleUse(); @@ -315,16 +288,35 @@ public ShardStore build() { ); protected static void setupShardStoreDeserializer(ObjectDeserializer op) { - op.add(Builder::allocation, ShardStoreAllocation._DESERIALIZER, "allocation"); op.add(Builder::allocationId, JsonpDeserializer.stringDeserializer(), "allocation_id"); - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "attributes"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::legacyVersion, JsonpDeserializer.longDeserializer(), "legacy_version"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::storeException, ShardStoreException._DESERIALIZER, "store_exception"); - op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.nodes == null) { + builder.nodes = new HashMap<>(); + } + builder.nodes.put(name, NodeAttributes._DESERIALIZER.deserialize(parser, mapper)); + }); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.allocation.hashCode(); + result = 31 * result + Objects.hashCode(this.allocationId); + result = 31 * result + Objects.hashCode(this.nodes); + result = 31 * result + Objects.hashCode(this.storeException); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardStore other = (ShardStore) o; + return this.allocation.equals(other.allocation) + && Objects.equals(this.allocationId, other.allocationId) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.storeException, other.storeException); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java index a4c4d479e9..f740376653 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreAllocation.java @@ -30,20 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: indices.shard_stores.ShardStoreAllocation + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ShardStoreAllocation implements JsonEnum { Primary("primary"), Replica("replica"), - Unused("unused"), - - ; + Unused("unused"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java index 0a5fb968db..71ec2a25cf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreException.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,33 +47,38 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.ShardStoreException @JsonpDeserializable -public class ShardStoreException implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardStoreException implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String reason; + @Nonnull private final String type; // --------------------------------------------------------------------------------------------- private ShardStoreException(Builder builder) { - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - } - public static ShardStoreException of(Function> fn) { + public static ShardStoreException of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code reason} */ + @Nonnull public final String reason() { return this.reason; } @@ -75,6 +86,7 @@ public final String reason() { /** * Required - API name: {@code type} */ + @Nonnull public final String type() { return this.type; } @@ -82,6 +94,7 @@ public final String type() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +102,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("reason"); generator.write(this.reason); generator.writeKey("type"); generator.write(this.type); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardStoreException}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String reason; - private String type; + public Builder() {} + + private Builder(ShardStoreException o) { + this.reason = o.reason; + this.type = o.type; + } + + private Builder(Builder o) { + this.reason = o.reason; + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code reason} */ + @Nonnull public final Builder reason(String value) { this.reason = value; return this; @@ -120,6 +159,7 @@ public final Builder reason(String value) { /** * Required - API name: {@code type} */ + @Nonnull public final Builder type(String value) { this.type = value; return this; @@ -128,9 +168,10 @@ public final Builder type(String value) { /** * Builds a {@link ShardStoreException}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardStoreException build() { _checkSingleUse(); @@ -149,10 +190,23 @@ public ShardStoreException build() { ); protected static void setupShardStoreExceptionDeserializer(ObjectDeserializer op) { - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.reason.hashCode(); + result = 31 * result + this.type.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardStoreException other = (ShardStoreException) o; + return this.reason.equals(other.reason) && this.type.equals(other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java index 7bb25e7aea..22704adda0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreStatus.java @@ -30,22 +30,30 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: indices.shard_stores.ShardStoreStatus + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ShardStoreStatus implements JsonEnum { /** - * The primary shard and all replica shards are assigned. + * Return all shards, regardless of health status. */ - Green("green"), + All("all"), /** - * One or more replica shards are unassigned. + * The primary shard and all replica shards are assigned. */ - Yellow("yellow"), + Green("green"), /** * The primary shard is unassigned. @@ -53,11 +61,9 @@ public enum ShardStoreStatus implements JsonEnum { Red("red"), /** - * Return all shards, regardless of health status. + * One or more replica shards are unassigned. */ - All("all"), - - ; + Yellow("yellow"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java index 9f42069e79..e1c6f2c7a3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/shard_stores/ShardStoreWrapper.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.shard_stores; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.shard_stores.ShardStoreWrapper @JsonpDeserializable -public class ShardStoreWrapper implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardStoreWrapper implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final List stores; // --------------------------------------------------------------------------------------------- private ShardStoreWrapper(Builder builder) { - this.stores = ApiTypeHelper.unmodifiableRequired(builder.stores, this, "stores"); - } - public static ShardStoreWrapper of(Function> fn) { + public static ShardStoreWrapper of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code stores} */ + @Nonnull public final List stores() { return this.stores; } @@ -73,6 +83,7 @@ public final List stores() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,34 +91,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.stores)) { - generator.writeKey("stores"); - generator.writeStartArray(); - for (ShardStore item0 : this.stores) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("stores"); + generator.writeStartArray(); + for (ShardStore item0 : this.stores) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardStoreWrapper}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List stores; + public Builder() {} + + private Builder(ShardStoreWrapper o) { + this.stores = _listCopy(o.stores); + } + + private Builder(Builder o) { + this.stores = _listCopy(o.stores); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code stores} + * *

* Adds all elements of list to stores. + *

*/ + @Nonnull public final Builder stores(List list) { this.stores = _listAddAll(this.stores, list); return this; @@ -115,9 +149,12 @@ public final Builder stores(List list) { /** * Required - API name: {@code stores} + * *

* Adds one or more values to stores. + *

*/ + @Nonnull public final Builder stores(ShardStore value, ShardStore... values) { this.stores = _listAdd(this.stores, value, values); return this; @@ -125,9 +162,12 @@ public final Builder stores(ShardStore value, ShardStore... values) { /** * Required - API name: {@code stores} + * *

* Adds a value to stores using a builder lambda. + *

*/ + @Nonnull public final Builder stores(Function> fn) { return stores(fn.apply(new ShardStore.Builder()).build()); } @@ -135,9 +175,10 @@ public final Builder stores(Function op) { - op.add(Builder::stores, JsonpDeserializer.arrayDeserializer(ShardStore._DESERIALIZER), "stores"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.stores.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardStoreWrapper other = (ShardStoreWrapper) o; + return this.stores.equals(other.stores); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/AllIndicesStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/AllIndicesStats.java new file mode 100644 index 0000000000..d38828c415 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/AllIndicesStats.java @@ -0,0 +1,228 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.stats; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.stats.AllIndicesStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AllIndicesStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final IndexStats primaries; + + @Nonnull + private final IndexStats total; + + // --------------------------------------------------------------------------------------------- + + private AllIndicesStats(Builder builder) { + this.primaries = ApiTypeHelper.requireNonNull(builder.primaries, this, "primaries"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + } + + public static AllIndicesStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code primaries} + */ + @Nonnull + public final IndexStats primaries() { + return this.primaries; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final IndexStats total() { + return this.total; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("primaries"); + this.primaries.serialize(generator, mapper); + + generator.writeKey("total"); + this.total.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link AllIndicesStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private IndexStats primaries; + private IndexStats total; + + public Builder() {} + + private Builder(AllIndicesStats o) { + this.primaries = o.primaries; + this.total = o.total; + } + + private Builder(Builder o) { + this.primaries = o.primaries; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code primaries} + */ + @Nonnull + public final Builder primaries(IndexStats value) { + this.primaries = value; + return this; + } + + /** + * Required - API name: {@code primaries} + */ + @Nonnull + public final Builder primaries(Function> fn) { + return primaries(fn.apply(new IndexStats.Builder()).build()); + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(IndexStats value) { + this.total = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(Function> fn) { + return total(fn.apply(new IndexStats.Builder()).build()); + } + + /** + * Builds a {@link AllIndicesStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public AllIndicesStats build() { + _checkSingleUse(); + + return new AllIndicesStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AllIndicesStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + AllIndicesStats::setupAllIndicesStatsDeserializer + ); + + protected static void setupAllIndicesStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::primaries, IndexStats._DESERIALIZER, "primaries"); + op.add(Builder::total, IndexStats._DESERIALIZER, "total"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.primaries.hashCode(); + result = 31 * result + this.total.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AllIndicesStats other = (AllIndicesStats) o; + return this.primaries.equals(other.primaries) && this.total.equals(other.total); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexShardStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexShardStats.java new file mode 100644 index 0000000000..c828dcddb0 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexShardStats.java @@ -0,0 +1,361 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.stats; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.stats.IndexShardStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexShardStats extends IndexStatsBase implements ToCopyableBuilder { + + @Nullable + private final ShardCommit commit; + + @Nullable + private final ShardRetentionLeases retentionLeases; + + @Nullable + private final ShardRouting routing; + + @Nullable + private final ShardSequenceNumber seqNo; + + @Nullable + private final ShardPath shardPath; + + // --------------------------------------------------------------------------------------------- + + private IndexShardStats(Builder builder) { + super(builder); + this.commit = builder.commit; + this.retentionLeases = builder.retentionLeases; + this.routing = builder.routing; + this.seqNo = builder.seqNo; + this.shardPath = builder.shardPath; + } + + public static IndexShardStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code commit} + */ + @Nullable + public final ShardCommit commit() { + return this.commit; + } + + /** + * API name: {@code retention_leases} + */ + @Nullable + public final ShardRetentionLeases retentionLeases() { + return this.retentionLeases; + } + + /** + * API name: {@code routing} + */ + @Nullable + public final ShardRouting routing() { + return this.routing; + } + + /** + * API name: {@code seq_no} + */ + @Nullable + public final ShardSequenceNumber seqNo() { + return this.seqNo; + } + + /** + * API name: {@code shard_path} + */ + @Nullable + public final ShardPath shardPath() { + return this.shardPath; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.commit != null) { + generator.writeKey("commit"); + this.commit.serialize(generator, mapper); + } + + if (this.retentionLeases != null) { + generator.writeKey("retention_leases"); + this.retentionLeases.serialize(generator, mapper); + } + + if (this.routing != null) { + generator.writeKey("routing"); + this.routing.serialize(generator, mapper); + } + + if (this.seqNo != null) { + generator.writeKey("seq_no"); + this.seqNo.serialize(generator, mapper); + } + + if (this.shardPath != null) { + generator.writeKey("shard_path"); + this.shardPath.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link IndexShardStats}. + */ + public static class Builder extends IndexStatsBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private ShardCommit commit; + @Nullable + private ShardRetentionLeases retentionLeases; + @Nullable + private ShardRouting routing; + @Nullable + private ShardSequenceNumber seqNo; + @Nullable + private ShardPath shardPath; + + public Builder() {} + + private Builder(IndexShardStats o) { + super(o); + this.commit = o.commit; + this.retentionLeases = o.retentionLeases; + this.routing = o.routing; + this.seqNo = o.seqNo; + this.shardPath = o.shardPath; + } + + private Builder(Builder o) { + super(o); + this.commit = o.commit; + this.retentionLeases = o.retentionLeases; + this.routing = o.routing; + this.seqNo = o.seqNo; + this.shardPath = o.shardPath; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code commit} + */ + @Nonnull + public final Builder commit(@Nullable ShardCommit value) { + this.commit = value; + return this; + } + + /** + * API name: {@code commit} + */ + @Nonnull + public final Builder commit(Function> fn) { + return commit(fn.apply(new ShardCommit.Builder()).build()); + } + + /** + * API name: {@code retention_leases} + */ + @Nonnull + public final Builder retentionLeases(@Nullable ShardRetentionLeases value) { + this.retentionLeases = value; + return this; + } + + /** + * API name: {@code retention_leases} + */ + @Nonnull + public final Builder retentionLeases(Function> fn) { + return retentionLeases(fn.apply(new ShardRetentionLeases.Builder()).build()); + } + + /** + * API name: {@code routing} + */ + @Nonnull + public final Builder routing(@Nullable ShardRouting value) { + this.routing = value; + return this; + } + + /** + * API name: {@code routing} + */ + @Nonnull + public final Builder routing(Function> fn) { + return routing(fn.apply(new ShardRouting.Builder()).build()); + } + + /** + * API name: {@code seq_no} + */ + @Nonnull + public final Builder seqNo(@Nullable ShardSequenceNumber value) { + this.seqNo = value; + return this; + } + + /** + * API name: {@code seq_no} + */ + @Nonnull + public final Builder seqNo(Function> fn) { + return seqNo(fn.apply(new ShardSequenceNumber.Builder()).build()); + } + + /** + * API name: {@code shard_path} + */ + @Nonnull + public final Builder shardPath(@Nullable ShardPath value) { + this.shardPath = value; + return this; + } + + /** + * API name: {@code shard_path} + */ + @Nonnull + public final Builder shardPath(Function> fn) { + return shardPath(fn.apply(new ShardPath.Builder()).build()); + } + + /** + * Builds a {@link IndexShardStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public IndexShardStats build() { + _checkSingleUse(); + + return new IndexShardStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexShardStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexShardStats::setupIndexShardStatsDeserializer + ); + + protected static void setupIndexShardStatsDeserializer(ObjectDeserializer op) { + setupIndexStatsBaseDeserializer(op); + op.add(Builder::commit, ShardCommit._DESERIALIZER, "commit"); + op.add(Builder::retentionLeases, ShardRetentionLeases._DESERIALIZER, "retention_leases"); + op.add(Builder::routing, ShardRouting._DESERIALIZER, "routing"); + op.add(Builder::seqNo, ShardSequenceNumber._DESERIALIZER, "seq_no"); + op.add(Builder::shardPath, ShardPath._DESERIALIZER, "shard_path"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.commit); + result = 31 * result + Objects.hashCode(this.retentionLeases); + result = 31 * result + Objects.hashCode(this.routing); + result = 31 * result + Objects.hashCode(this.seqNo); + result = 31 * result + Objects.hashCode(this.shardPath); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexShardStats other = (IndexShardStats) o; + return Objects.equals(this.commit, other.commit) + && Objects.equals(this.retentionLeases, other.retentionLeases) + && Objects.equals(this.routing, other.routing) + && Objects.equals(this.seqNo, other.seqNo) + && Objects.equals(this.shardPath, other.shardPath); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java new file mode 100644 index 0000000000..67dfa2283f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java @@ -0,0 +1,149 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.stats; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.stats.IndexStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexStats extends IndexStatsBase implements ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private IndexStats(Builder builder) { + super(builder); + } + + public static IndexStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link IndexStats}. + */ + public static class Builder extends IndexStatsBase.AbstractBuilder implements CopyableBuilder { + + public Builder() {} + + private Builder(IndexStats o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public IndexStats build() { + _checkSingleUse(); + + return new IndexStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexStats::setupIndexStatsDeserializer + ); + + protected static void setupIndexStatsDeserializer(ObjectDeserializer op) { + setupIndexStatsBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStatsBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStatsBase.java new file mode 100644 index 0000000000..e7b91293da --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndexStatsBase.java @@ -0,0 +1,778 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.stats; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.CompletionStats; +import org.opensearch.client.opensearch._types.DocStats; +import org.opensearch.client.opensearch._types.FielddataStats; +import org.opensearch.client.opensearch._types.FlushStats; +import org.opensearch.client.opensearch._types.GetStats; +import org.opensearch.client.opensearch._types.IndexingStats; +import org.opensearch.client.opensearch._types.MergesStats; +import org.opensearch.client.opensearch._types.QueryCacheStats; +import org.opensearch.client.opensearch._types.RecoveryStats; +import org.opensearch.client.opensearch._types.RefreshStats; +import org.opensearch.client.opensearch._types.RequestCacheStats; +import org.opensearch.client.opensearch._types.SearchStats; +import org.opensearch.client.opensearch._types.SegmentsStats; +import org.opensearch.client.opensearch._types.StoreStats; +import org.opensearch.client.opensearch._types.TranslogStats; +import org.opensearch.client.opensearch._types.WarmerStats; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: indices.stats.IndexStatsBase + +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class IndexStatsBase implements PlainJsonSerializable { + + @Nullable + private final CompletionStats completion; + + @Nullable + private final DocStats docs; + + @Nullable + private final FielddataStats fielddata; + + @Nullable + private final FlushStats flush; + + @Nullable + private final GetStats get; + + @Nullable + private final IndexingStats indexing; + + @Nullable + private final MergesStats merges; + + @Nullable + private final QueryCacheStats queryCache; + + @Nullable + private final RecoveryStats recovery; + + @Nullable + private final RefreshStats refresh; + + @Nullable + private final RequestCacheStats requestCache; + + @Nullable + private final SearchStats search; + + @Nullable + private final SegmentsStats segments; + + @Nullable + private final StoreStats store; + + @Nullable + private final TranslogStats translog; + + @Nullable + private final WarmerStats warmer; + + // --------------------------------------------------------------------------------------------- + + protected IndexStatsBase(AbstractBuilder builder) { + this.completion = builder.completion; + this.docs = builder.docs; + this.fielddata = builder.fielddata; + this.flush = builder.flush; + this.get = builder.get; + this.indexing = builder.indexing; + this.merges = builder.merges; + this.queryCache = builder.queryCache; + this.recovery = builder.recovery; + this.refresh = builder.refresh; + this.requestCache = builder.requestCache; + this.search = builder.search; + this.segments = builder.segments; + this.store = builder.store; + this.translog = builder.translog; + this.warmer = builder.warmer; + } + + /** + * API name: {@code completion} + */ + @Nullable + public final CompletionStats completion() { + return this.completion; + } + + /** + * API name: {@code docs} + */ + @Nullable + public final DocStats docs() { + return this.docs; + } + + /** + * API name: {@code fielddata} + */ + @Nullable + public final FielddataStats fielddata() { + return this.fielddata; + } + + /** + * API name: {@code flush} + */ + @Nullable + public final FlushStats flush() { + return this.flush; + } + + /** + * API name: {@code get} + */ + @Nullable + public final GetStats get() { + return this.get; + } + + /** + * API name: {@code indexing} + */ + @Nullable + public final IndexingStats indexing() { + return this.indexing; + } + + /** + * API name: {@code merges} + */ + @Nullable + public final MergesStats merges() { + return this.merges; + } + + /** + * API name: {@code query_cache} + */ + @Nullable + public final QueryCacheStats queryCache() { + return this.queryCache; + } + + /** + * API name: {@code recovery} + */ + @Nullable + public final RecoveryStats recovery() { + return this.recovery; + } + + /** + * API name: {@code refresh} + */ + @Nullable + public final RefreshStats refresh() { + return this.refresh; + } + + /** + * API name: {@code request_cache} + */ + @Nullable + public final RequestCacheStats requestCache() { + return this.requestCache; + } + + /** + * API name: {@code search} + */ + @Nullable + public final SearchStats search() { + return this.search; + } + + /** + * API name: {@code segments} + */ + @Nullable + public final SegmentsStats segments() { + return this.segments; + } + + /** + * API name: {@code store} + */ + @Nullable + public final StoreStats store() { + return this.store; + } + + /** + * API name: {@code translog} + */ + @Nullable + public final TranslogStats translog() { + return this.translog; + } + + /** + * API name: {@code warmer} + */ + @Nullable + public final WarmerStats warmer() { + return this.warmer; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.completion != null) { + generator.writeKey("completion"); + this.completion.serialize(generator, mapper); + } + + if (this.docs != null) { + generator.writeKey("docs"); + this.docs.serialize(generator, mapper); + } + + if (this.fielddata != null) { + generator.writeKey("fielddata"); + this.fielddata.serialize(generator, mapper); + } + + if (this.flush != null) { + generator.writeKey("flush"); + this.flush.serialize(generator, mapper); + } + + if (this.get != null) { + generator.writeKey("get"); + this.get.serialize(generator, mapper); + } + + if (this.indexing != null) { + generator.writeKey("indexing"); + this.indexing.serialize(generator, mapper); + } + + if (this.merges != null) { + generator.writeKey("merges"); + this.merges.serialize(generator, mapper); + } + + if (this.queryCache != null) { + generator.writeKey("query_cache"); + this.queryCache.serialize(generator, mapper); + } + + if (this.recovery != null) { + generator.writeKey("recovery"); + this.recovery.serialize(generator, mapper); + } + + if (this.refresh != null) { + generator.writeKey("refresh"); + this.refresh.serialize(generator, mapper); + } + + if (this.requestCache != null) { + generator.writeKey("request_cache"); + this.requestCache.serialize(generator, mapper); + } + + if (this.search != null) { + generator.writeKey("search"); + this.search.serialize(generator, mapper); + } + + if (this.segments != null) { + generator.writeKey("segments"); + this.segments.serialize(generator, mapper); + } + + if (this.store != null) { + generator.writeKey("store"); + this.store.serialize(generator, mapper); + } + + if (this.translog != null) { + generator.writeKey("translog"); + this.translog.serialize(generator, mapper); + } + + if (this.warmer != null) { + generator.writeKey("warmer"); + this.warmer.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable + private CompletionStats completion; + @Nullable + private DocStats docs; + @Nullable + private FielddataStats fielddata; + @Nullable + private FlushStats flush; + @Nullable + private GetStats get; + @Nullable + private IndexingStats indexing; + @Nullable + private MergesStats merges; + @Nullable + private QueryCacheStats queryCache; + @Nullable + private RecoveryStats recovery; + @Nullable + private RefreshStats refresh; + @Nullable + private RequestCacheStats requestCache; + @Nullable + private SearchStats search; + @Nullable + private SegmentsStats segments; + @Nullable + private StoreStats store; + @Nullable + private TranslogStats translog; + @Nullable + private WarmerStats warmer; + + protected AbstractBuilder() {} + + protected AbstractBuilder(IndexStatsBase o) { + this.completion = o.completion; + this.docs = o.docs; + this.fielddata = o.fielddata; + this.flush = o.flush; + this.get = o.get; + this.indexing = o.indexing; + this.merges = o.merges; + this.queryCache = o.queryCache; + this.recovery = o.recovery; + this.refresh = o.refresh; + this.requestCache = o.requestCache; + this.search = o.search; + this.segments = o.segments; + this.store = o.store; + this.translog = o.translog; + this.warmer = o.warmer; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.completion = o.completion; + this.docs = o.docs; + this.fielddata = o.fielddata; + this.flush = o.flush; + this.get = o.get; + this.indexing = o.indexing; + this.merges = o.merges; + this.queryCache = o.queryCache; + this.recovery = o.recovery; + this.refresh = o.refresh; + this.requestCache = o.requestCache; + this.search = o.search; + this.segments = o.segments; + this.store = o.store; + this.translog = o.translog; + this.warmer = o.warmer; + } + + @Nonnull + protected abstract BuilderT self(); + + /** + * API name: {@code completion} + */ + @Nonnull + public final BuilderT completion(@Nullable CompletionStats value) { + this.completion = value; + return self(); + } + + /** + * API name: {@code completion} + */ + @Nonnull + public final BuilderT completion(Function> fn) { + return completion(fn.apply(new CompletionStats.Builder()).build()); + } + + /** + * API name: {@code docs} + */ + @Nonnull + public final BuilderT docs(@Nullable DocStats value) { + this.docs = value; + return self(); + } + + /** + * API name: {@code docs} + */ + @Nonnull + public final BuilderT docs(Function> fn) { + return docs(fn.apply(new DocStats.Builder()).build()); + } + + /** + * API name: {@code fielddata} + */ + @Nonnull + public final BuilderT fielddata(@Nullable FielddataStats value) { + this.fielddata = value; + return self(); + } + + /** + * API name: {@code fielddata} + */ + @Nonnull + public final BuilderT fielddata(Function> fn) { + return fielddata(fn.apply(new FielddataStats.Builder()).build()); + } + + /** + * API name: {@code flush} + */ + @Nonnull + public final BuilderT flush(@Nullable FlushStats value) { + this.flush = value; + return self(); + } + + /** + * API name: {@code flush} + */ + @Nonnull + public final BuilderT flush(Function> fn) { + return flush(fn.apply(new FlushStats.Builder()).build()); + } + + /** + * API name: {@code get} + */ + @Nonnull + public final BuilderT get(@Nullable GetStats value) { + this.get = value; + return self(); + } + + /** + * API name: {@code get} + */ + @Nonnull + public final BuilderT get(Function> fn) { + return get(fn.apply(new GetStats.Builder()).build()); + } + + /** + * API name: {@code indexing} + */ + @Nonnull + public final BuilderT indexing(@Nullable IndexingStats value) { + this.indexing = value; + return self(); + } + + /** + * API name: {@code indexing} + */ + @Nonnull + public final BuilderT indexing(Function> fn) { + return indexing(fn.apply(new IndexingStats.Builder()).build()); + } + + /** + * API name: {@code merges} + */ + @Nonnull + public final BuilderT merges(@Nullable MergesStats value) { + this.merges = value; + return self(); + } + + /** + * API name: {@code merges} + */ + @Nonnull + public final BuilderT merges(Function> fn) { + return merges(fn.apply(new MergesStats.Builder()).build()); + } + + /** + * API name: {@code query_cache} + */ + @Nonnull + public final BuilderT queryCache(@Nullable QueryCacheStats value) { + this.queryCache = value; + return self(); + } + + /** + * API name: {@code query_cache} + */ + @Nonnull + public final BuilderT queryCache(Function> fn) { + return queryCache(fn.apply(new QueryCacheStats.Builder()).build()); + } + + /** + * API name: {@code recovery} + */ + @Nonnull + public final BuilderT recovery(@Nullable RecoveryStats value) { + this.recovery = value; + return self(); + } + + /** + * API name: {@code recovery} + */ + @Nonnull + public final BuilderT recovery(Function> fn) { + return recovery(fn.apply(new RecoveryStats.Builder()).build()); + } + + /** + * API name: {@code refresh} + */ + @Nonnull + public final BuilderT refresh(@Nullable RefreshStats value) { + this.refresh = value; + return self(); + } + + /** + * API name: {@code refresh} + */ + @Nonnull + public final BuilderT refresh(Function> fn) { + return refresh(fn.apply(new RefreshStats.Builder()).build()); + } + + /** + * API name: {@code request_cache} + */ + @Nonnull + public final BuilderT requestCache(@Nullable RequestCacheStats value) { + this.requestCache = value; + return self(); + } + + /** + * API name: {@code request_cache} + */ + @Nonnull + public final BuilderT requestCache(Function> fn) { + return requestCache(fn.apply(new RequestCacheStats.Builder()).build()); + } + + /** + * API name: {@code search} + */ + @Nonnull + public final BuilderT search(@Nullable SearchStats value) { + this.search = value; + return self(); + } + + /** + * API name: {@code search} + */ + @Nonnull + public final BuilderT search(Function> fn) { + return search(fn.apply(new SearchStats.Builder()).build()); + } + + /** + * API name: {@code segments} + */ + @Nonnull + public final BuilderT segments(@Nullable SegmentsStats value) { + this.segments = value; + return self(); + } + + /** + * API name: {@code segments} + */ + @Nonnull + public final BuilderT segments(Function> fn) { + return segments(fn.apply(new SegmentsStats.Builder()).build()); + } + + /** + * API name: {@code store} + */ + @Nonnull + public final BuilderT store(@Nullable StoreStats value) { + this.store = value; + return self(); + } + + /** + * API name: {@code store} + */ + @Nonnull + public final BuilderT store(Function> fn) { + return store(fn.apply(new StoreStats.Builder()).build()); + } + + /** + * API name: {@code translog} + */ + @Nonnull + public final BuilderT translog(@Nullable TranslogStats value) { + this.translog = value; + return self(); + } + + /** + * API name: {@code translog} + */ + @Nonnull + public final BuilderT translog(Function> fn) { + return translog(fn.apply(new TranslogStats.Builder()).build()); + } + + /** + * API name: {@code warmer} + */ + @Nonnull + public final BuilderT warmer(@Nullable WarmerStats value) { + this.warmer = value; + return self(); + } + + /** + * API name: {@code warmer} + */ + @Nonnull + public final BuilderT warmer(Function> fn) { + return warmer(fn.apply(new WarmerStats.Builder()).build()); + } + } + + // --------------------------------------------------------------------------------------------- + + protected static > void setupIndexStatsBaseDeserializer(ObjectDeserializer op) { + op.add(AbstractBuilder::completion, CompletionStats._DESERIALIZER, "completion"); + op.add(AbstractBuilder::docs, DocStats._DESERIALIZER, "docs"); + op.add(AbstractBuilder::fielddata, FielddataStats._DESERIALIZER, "fielddata"); + op.add(AbstractBuilder::flush, FlushStats._DESERIALIZER, "flush"); + op.add(AbstractBuilder::get, GetStats._DESERIALIZER, "get"); + op.add(AbstractBuilder::indexing, IndexingStats._DESERIALIZER, "indexing"); + op.add(AbstractBuilder::merges, MergesStats._DESERIALIZER, "merges"); + op.add(AbstractBuilder::queryCache, QueryCacheStats._DESERIALIZER, "query_cache"); + op.add(AbstractBuilder::recovery, RecoveryStats._DESERIALIZER, "recovery"); + op.add(AbstractBuilder::refresh, RefreshStats._DESERIALIZER, "refresh"); + op.add(AbstractBuilder::requestCache, RequestCacheStats._DESERIALIZER, "request_cache"); + op.add(AbstractBuilder::search, SearchStats._DESERIALIZER, "search"); + op.add(AbstractBuilder::segments, SegmentsStats._DESERIALIZER, "segments"); + op.add(AbstractBuilder::store, StoreStats._DESERIALIZER, "store"); + op.add(AbstractBuilder::translog, TranslogStats._DESERIALIZER, "translog"); + op.add(AbstractBuilder::warmer, WarmerStats._DESERIALIZER, "warmer"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.completion); + result = 31 * result + Objects.hashCode(this.docs); + result = 31 * result + Objects.hashCode(this.fielddata); + result = 31 * result + Objects.hashCode(this.flush); + result = 31 * result + Objects.hashCode(this.get); + result = 31 * result + Objects.hashCode(this.indexing); + result = 31 * result + Objects.hashCode(this.merges); + result = 31 * result + Objects.hashCode(this.queryCache); + result = 31 * result + Objects.hashCode(this.recovery); + result = 31 * result + Objects.hashCode(this.refresh); + result = 31 * result + Objects.hashCode(this.requestCache); + result = 31 * result + Objects.hashCode(this.search); + result = 31 * result + Objects.hashCode(this.segments); + result = 31 * result + Objects.hashCode(this.store); + result = 31 * result + Objects.hashCode(this.translog); + result = 31 * result + Objects.hashCode(this.warmer); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexStatsBase other = (IndexStatsBase) o; + return Objects.equals(this.completion, other.completion) + && Objects.equals(this.docs, other.docs) + && Objects.equals(this.fielddata, other.fielddata) + && Objects.equals(this.flush, other.flush) + && Objects.equals(this.get, other.get) + && Objects.equals(this.indexing, other.indexing) + && Objects.equals(this.merges, other.merges) + && Objects.equals(this.queryCache, other.queryCache) + && Objects.equals(this.recovery, other.recovery) + && Objects.equals(this.refresh, other.refresh) + && Objects.equals(this.requestCache, other.requestCache) + && Objects.equals(this.search, other.search) + && Objects.equals(this.segments, other.segments) + && Objects.equals(this.store, other.store) + && Objects.equals(this.translog, other.translog) + && Objects.equals(this.warmer, other.warmer); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java index ba06a8e121..e2d10ddb06 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStats.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -44,40 +51,46 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.IndicesStats @JsonpDeserializable -public class IndicesStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final IndexStats primaries; - private final Map> shards; + @Nonnull + private final Map> shards; + @Nonnull private final IndexStats total; - @Nullable + @Nonnull private final String uuid; // --------------------------------------------------------------------------------------------- private IndicesStats(Builder builder) { - this.primaries = ApiTypeHelper.requireNonNull(builder.primaries, this, "primaries"); this.shards = ApiTypeHelper.unmodifiable(builder.shards); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.uuid = builder.uuid; - + this.uuid = ApiTypeHelper.requireNonNull(builder.uuid, this, "uuid"); } - public static IndicesStats of(Function> fn) { + public static IndicesStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code primaries} */ + @Nonnull public final IndexStats primaries() { return this.primaries; } @@ -85,21 +98,23 @@ public final IndexStats primaries() { /** * API name: {@code shards} */ - public final Map> shards() { + @Nonnull + public final Map> shards() { return this.shards; } /** * Required - API name: {@code total} */ + @Nonnull public final IndexStats total() { return this.total; } /** - * API name: {@code uuid} + * Required - API name: {@code uuid} */ - @Nullable + @Nonnull public final String uuid() { return this.uuid; } @@ -107,6 +122,7 @@ public final String uuid() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -114,59 +130,81 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("primaries"); this.primaries.serialize(generator, mapper); if (ApiTypeHelper.isDefined(this.shards)) { generator.writeKey("shards"); generator.writeStartObject(); - for (Map.Entry> item0 : this.shards.entrySet()) { + for (Map.Entry> item0 : this.shards.entrySet()) { generator.writeKey(item0.getKey()); generator.writeStartArray(); if (item0.getValue() != null) { - for (ShardStats item1 : item0.getValue()) { + for (IndexShardStats item1 : item0.getValue()) { item1.serialize(generator, mapper); - } } generator.writeEnd(); - } generator.writeEnd(); - } + generator.writeKey("total"); this.total.serialize(generator, mapper); - if (this.uuid != null) { - generator.writeKey("uuid"); - generator.write(this.uuid); + generator.writeKey("uuid"); + generator.write(this.uuid); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link IndicesStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private IndexStats primaries; - @Nullable - private Map> shards; - + private Map> shards; private IndexStats total; - - @Nullable private String uuid; + public Builder() {} + + private Builder(IndicesStats o) { + this.primaries = o.primaries; + this.shards = _mapCopy(o.shards); + this.total = o.total; + this.uuid = o.uuid; + } + + private Builder(Builder o) { + this.primaries = o.primaries; + this.shards = _mapCopy(o.shards); + this.total = o.total; + this.uuid = o.uuid; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code primaries} */ + @Nonnull public final Builder primaries(IndexStats value) { this.primaries = value; return this; @@ -175,26 +213,33 @@ public final Builder primaries(IndexStats value) { /** * Required - API name: {@code primaries} */ + @Nonnull public final Builder primaries(Function> fn) { - return this.primaries(fn.apply(new IndexStats.Builder()).build()); + return primaries(fn.apply(new IndexStats.Builder()).build()); } /** * API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ - public final Builder shards(Map> map) { + @Nonnull + public final Builder shards(Map> map) { this.shards = _mapPutAll(this.shards, map); return this; } /** * API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ - public final Builder shards(String key, List value) { + @Nonnull + public final Builder shards(String key, List value) { this.shards = _mapPut(this.shards, key, value); return this; } @@ -202,6 +247,7 @@ public final Builder shards(String key, List value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(IndexStats value) { this.total = value; return this; @@ -210,14 +256,16 @@ public final Builder total(IndexStats value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(Function> fn) { - return this.total(fn.apply(new IndexStats.Builder()).build()); + return total(fn.apply(new IndexStats.Builder()).build()); } /** - * API name: {@code uuid} + * Required - API name: {@code uuid} */ - public final Builder uuid(@Nullable String value) { + @Nonnull + public final Builder uuid(String value) { this.uuid = value; return this; } @@ -225,9 +273,10 @@ public final Builder uuid(@Nullable String value) { /** * Builds a {@link IndicesStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndicesStats build() { _checkSingleUse(); @@ -246,16 +295,34 @@ public IndicesStats build() { ); protected static void setupIndicesStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::primaries, IndexStats._DESERIALIZER, "primaries"); op.add( Builder::shards, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(ShardStats._DESERIALIZER)), + JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(IndexShardStats._DESERIALIZER)), "shards" ); op.add(Builder::total, IndexStats._DESERIALIZER, "total"); op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.primaries.hashCode(); + result = 31 * result + Objects.hashCode(this.shards); + result = 31 * result + this.total.hashCode(); + result = 31 * result + this.uuid.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesStats other = (IndicesStats) o; + return this.primaries.equals(other.primaries) + && Objects.equals(this.shards, other.shards) + && this.total.equals(other.total) + && this.uuid.equals(other.uuid); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStatsMetric.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStatsMetric.java new file mode 100644 index 0000000000..eeb5834762 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/IndicesStatsMetric.java @@ -0,0 +1,95 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices.stats; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: indices.stats.Metric + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum IndicesStatsMetric implements JsonEnum { + All("_all"), + + Completion("completion"), + + Docs("docs"), + + Fielddata("fielddata"), + + Flush("flush"), + + Get("get"), + + Indexing("indexing"), + + Merge("merge"), + + QueryCache("query_cache"), + + Recovery("recovery"), + + Refresh("refresh"), + + RequestCache("request_cache"), + + Search("search"), + + Segments("segments"), + + Store("store"), + + Suggest("suggest"), + + Translog("translog"), + + Warmer("warmer"); + + private final String jsonValue; + + IndicesStatsMetric(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(IndicesStatsMetric.values()); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java index a75948cfe6..583ed90970 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardCommit.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,33 +48,37 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardCommit @JsonpDeserializable -public class ShardCommit implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardCommit implements PlainJsonSerializable, ToCopyableBuilder { + private final int generation; + @Nonnull private final String id; private final long numDocs; + @Nonnull private final Map userData; // --------------------------------------------------------------------------------------------- private ShardCommit(Builder builder) { - this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.numDocs = ApiTypeHelper.requireNonNull(builder.numDocs, this, "numDocs"); this.userData = ApiTypeHelper.unmodifiableRequired(builder.userData, this, "userData"); - } - public static ShardCommit of(Function> fn) { + public static ShardCommit of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -82,6 +92,7 @@ public final int generation() { /** * Required - API name: {@code id} */ + @Nonnull public final String id() { return this.id; } @@ -96,6 +107,7 @@ public final long numDocs() { /** * Required - API name: {@code user_data} */ + @Nonnull public final Map userData() { return this.userData; } @@ -103,6 +115,7 @@ public final Map userData() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,7 +123,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("generation"); generator.write(this.generation); @@ -120,38 +132,63 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("num_docs"); generator.write(this.numDocs); - if (ApiTypeHelper.isDefined(this.userData)) { - generator.writeKey("user_data"); - generator.writeStartObject(); - for (Map.Entry item0 : this.userData.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("user_data"); + generator.writeStartObject(); + for (Map.Entry item0 : this.userData.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardCommit}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer generation; - private String id; - private Long numDocs; - private Map userData; + public Builder() {} + + private Builder(ShardCommit o) { + this.generation = o.generation; + this.id = o.id; + this.numDocs = o.numDocs; + this.userData = _mapCopy(o.userData); + } + + private Builder(Builder o) { + this.generation = o.generation; + this.id = o.id; + this.numDocs = o.numDocs; + this.userData = _mapCopy(o.userData); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code generation} */ + @Nonnull public final Builder generation(int value) { this.generation = value; return this; @@ -160,6 +197,7 @@ public final Builder generation(int value) { /** * Required - API name: {@code id} */ + @Nonnull public final Builder id(String value) { this.id = value; return this; @@ -168,6 +206,7 @@ public final Builder id(String value) { /** * Required - API name: {@code num_docs} */ + @Nonnull public final Builder numDocs(long value) { this.numDocs = value; return this; @@ -175,9 +214,12 @@ public final Builder numDocs(long value) { /** * Required - API name: {@code user_data} + * *

- * Adds all entries of map to userData. + * Adds all elements of map to userData. + *

*/ + @Nonnull public final Builder userData(Map map) { this.userData = _mapPutAll(this.userData, map); return this; @@ -185,9 +227,12 @@ public final Builder userData(Map map) { /** * Required - API name: {@code user_data} + * *

* Adds an entry to userData. + *

*/ + @Nonnull public final Builder userData(String key, String value) { this.userData = _mapPut(this.userData, key, value); return this; @@ -196,9 +241,10 @@ public final Builder userData(String key, String value) { /** * Builds a {@link ShardCommit}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardCommit build() { _checkSingleUse(); @@ -217,12 +263,30 @@ public ShardCommit build() { ); protected static void setupShardCommitDeserializer(ObjectDeserializer op) { - op.add(Builder::generation, JsonpDeserializer.integerDeserializer(), "generation"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::numDocs, JsonpDeserializer.longDeserializer(), "num_docs"); op.add(Builder::userData, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "user_data"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.generation); + result = 31 * result + this.id.hashCode(); + result = 31 * result + Long.hashCode(this.numDocs); + result = 31 * result + this.userData.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardCommit other = (ShardCommit) o; + return this.generation == other.generation + && this.id.equals(other.id) + && this.numDocs == other.numDocs + && this.userData.equals(other.userData); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java index 5f2c2e253d..a55b02f7ac 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardFileSizeInfo.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,66 +49,75 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardFileSizeInfo @JsonpDeserializable -public class ShardFileSizeInfo implements PlainJsonSerializable { - private final String description; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardFileSizeInfo implements PlainJsonSerializable, ToCopyableBuilder { - private final long sizeInBytes; + @Nullable + private final Long averageSizeInBytes; @Nullable - private final Long minSizeInBytes; + private final Long count; + + @Nonnull + private final String description; @Nullable private final Long maxSizeInBytes; @Nullable - private final Long averageSizeInBytes; + private final Long minSizeInBytes; @Nullable - private final Long count; + private final String size; + + private final long sizeInBytes; // --------------------------------------------------------------------------------------------- private ShardFileSizeInfo(Builder builder) { - - this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - this.minSizeInBytes = builder.minSizeInBytes; - this.maxSizeInBytes = builder.maxSizeInBytes; this.averageSizeInBytes = builder.averageSizeInBytes; this.count = builder.count; - + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.maxSizeInBytes = builder.maxSizeInBytes; + this.minSizeInBytes = builder.minSizeInBytes; + this.size = builder.size; + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); } - public static ShardFileSizeInfo of(Function> fn) { + public static ShardFileSizeInfo of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code description} + * API name: {@code average_size_in_bytes} */ - public final String description() { - return this.description; + @Nullable + public final Long averageSizeInBytes() { + return this.averageSizeInBytes; } /** - * Required - API name: {@code size_in_bytes} + * API name: {@code count} */ - public final long sizeInBytes() { - return this.sizeInBytes; + @Nullable + public final Long count() { + return this.count; } /** - * API name: {@code min_size_in_bytes} + * Required - API name: {@code description} */ - @Nullable - public final Long minSizeInBytes() { - return this.minSizeInBytes; + @Nonnull + public final String description() { + return this.description; } /** @@ -113,24 +129,32 @@ public final Long maxSizeInBytes() { } /** - * API name: {@code average_size_in_bytes} + * API name: {@code min_size_in_bytes} */ @Nullable - public final Long averageSizeInBytes() { - return this.averageSizeInBytes; + public final Long minSizeInBytes() { + return this.minSizeInBytes; } /** - * API name: {@code count} + * API name: {@code size} */ @Nullable - public final Long count() { - return this.count; + public final String size() { + return this.size; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -138,113 +162,166 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.averageSizeInBytes != null) { + generator.writeKey("average_size_in_bytes"); + generator.write(this.averageSizeInBytes); + } + + if (this.count != null) { + generator.writeKey("count"); + generator.write(this.count); + } generator.writeKey("description"); generator.write(this.description); - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - if (this.minSizeInBytes != null) { - generator.writeKey("min_size_in_bytes"); - generator.write(this.minSizeInBytes); - - } if (this.maxSizeInBytes != null) { generator.writeKey("max_size_in_bytes"); generator.write(this.maxSizeInBytes); - } - if (this.averageSizeInBytes != null) { - generator.writeKey("average_size_in_bytes"); - generator.write(this.averageSizeInBytes); + if (this.minSizeInBytes != null) { + generator.writeKey("min_size_in_bytes"); + generator.write(this.minSizeInBytes); } - if (this.count != null) { - generator.writeKey("count"); - generator.write(this.count); + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); } + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardFileSizeInfo}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long averageSizeInBytes; + @Nullable + private Long count; private String description; - - private Long sizeInBytes; - + @Nullable + private Long maxSizeInBytes; @Nullable private Long minSizeInBytes; - @Nullable - private Long maxSizeInBytes; + private String size; + private Long sizeInBytes; - @Nullable - private Long averageSizeInBytes; + public Builder() {} - @Nullable - private Long count; + private Builder(ShardFileSizeInfo o) { + this.averageSizeInBytes = o.averageSizeInBytes; + this.count = o.count; + this.description = o.description; + this.maxSizeInBytes = o.maxSizeInBytes; + this.minSizeInBytes = o.minSizeInBytes; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + private Builder(Builder o) { + this.averageSizeInBytes = o.averageSizeInBytes; + this.count = o.count; + this.description = o.description; + this.maxSizeInBytes = o.maxSizeInBytes; + this.minSizeInBytes = o.minSizeInBytes; + this.size = o.size; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code description} + * API name: {@code average_size_in_bytes} */ - public final Builder description(String value) { - this.description = value; + @Nonnull + public final Builder averageSizeInBytes(@Nullable Long value) { + this.averageSizeInBytes = value; return this; } /** - * Required - API name: {@code size_in_bytes} + * API name: {@code count} */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; + @Nonnull + public final Builder count(@Nullable Long value) { + this.count = value; return this; } /** - * API name: {@code min_size_in_bytes} + * Required - API name: {@code description} */ - public final Builder minSizeInBytes(@Nullable Long value) { - this.minSizeInBytes = value; + @Nonnull + public final Builder description(String value) { + this.description = value; return this; } /** * API name: {@code max_size_in_bytes} */ + @Nonnull public final Builder maxSizeInBytes(@Nullable Long value) { this.maxSizeInBytes = value; return this; } /** - * API name: {@code average_size_in_bytes} + * API name: {@code min_size_in_bytes} */ - public final Builder averageSizeInBytes(@Nullable Long value) { - this.averageSizeInBytes = value; + @Nonnull + public final Builder minSizeInBytes(@Nullable Long value) { + this.minSizeInBytes = value; return this; } /** - * API name: {@code count} + * API name: {@code size} */ - public final Builder count(@Nullable Long value) { - this.count = value; + @Nonnull + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + @Nonnull + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; return this; } /** * Builds a {@link ShardFileSizeInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardFileSizeInfo build() { _checkSingleUse(); @@ -263,14 +340,39 @@ public ShardFileSizeInfo build() { ); protected static void setupShardFileSizeInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - op.add(Builder::minSizeInBytes, JsonpDeserializer.longDeserializer(), "min_size_in_bytes"); - op.add(Builder::maxSizeInBytes, JsonpDeserializer.longDeserializer(), "max_size_in_bytes"); op.add(Builder::averageSizeInBytes, JsonpDeserializer.longDeserializer(), "average_size_in_bytes"); op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::maxSizeInBytes, JsonpDeserializer.longDeserializer(), "max_size_in_bytes"); + op.add(Builder::minSizeInBytes, JsonpDeserializer.longDeserializer(), "min_size_in_bytes"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.averageSizeInBytes); + result = 31 * result + Objects.hashCode(this.count); + result = 31 * result + this.description.hashCode(); + result = 31 * result + Objects.hashCode(this.maxSizeInBytes); + result = 31 * result + Objects.hashCode(this.minSizeInBytes); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardFileSizeInfo other = (ShardFileSizeInfo) o; + return Objects.equals(this.averageSizeInBytes, other.averageSizeInBytes) + && Objects.equals(this.count, other.count) + && this.description.equals(other.description) + && Objects.equals(this.maxSizeInBytes, other.maxSizeInBytes) + && Objects.equals(this.minSizeInBytes, other.minSizeInBytes) + && Objects.equals(this.size, other.size) + && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java index ebdc236750..90f64c6eeb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardLease.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,39 +47,44 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardLease @JsonpDeserializable -public class ShardLease implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardLease implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String id; private final long retainingSeqNo; - private final long timestamp; - + @Nonnull private final String source; + private final long timestamp; + // --------------------------------------------------------------------------------------------- private ShardLease(Builder builder) { - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.retainingSeqNo = ApiTypeHelper.requireNonNull(builder.retainingSeqNo, this, "retainingSeqNo"); - this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - + this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); } - public static ShardLease of(Function> fn) { + public static ShardLease of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code id} */ + @Nonnull public final String id() { return this.id; } @@ -86,22 +97,24 @@ public final long retainingSeqNo() { } /** - * Required - API name: {@code timestamp} + * Required - API name: {@code source} */ - public final long timestamp() { - return this.timestamp; + @Nonnull + public final String source() { + return this.source; } /** - * Required - API name: {@code source} + * Required - API name: {@code timestamp} */ - public final String source() { - return this.source; + public final long timestamp() { + return this.timestamp; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,39 +122,67 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("id"); generator.write(this.id); generator.writeKey("retaining_seq_no"); generator.write(this.retainingSeqNo); - generator.writeKey("timestamp"); - generator.write(this.timestamp); - generator.writeKey("source"); generator.write(this.source); + generator.writeKey("timestamp"); + generator.write(this.timestamp); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardLease}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String id; - private Long retainingSeqNo; - + private String source; private Long timestamp; - private String source; + public Builder() {} + + private Builder(ShardLease o) { + this.id = o.id; + this.retainingSeqNo = o.retainingSeqNo; + this.source = o.source; + this.timestamp = o.timestamp; + } + + private Builder(Builder o) { + this.id = o.id; + this.retainingSeqNo = o.retainingSeqNo; + this.source = o.source; + this.timestamp = o.timestamp; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code id} */ + @Nonnull public final Builder id(String value) { this.id = value; return this; @@ -150,33 +191,37 @@ public final Builder id(String value) { /** * Required - API name: {@code retaining_seq_no} */ + @Nonnull public final Builder retainingSeqNo(long value) { this.retainingSeqNo = value; return this; } /** - * Required - API name: {@code timestamp} + * Required - API name: {@code source} */ - public final Builder timestamp(long value) { - this.timestamp = value; + @Nonnull + public final Builder source(String value) { + this.source = value; return this; } /** - * Required - API name: {@code source} + * Required - API name: {@code timestamp} */ - public final Builder source(String value) { - this.source = value; + @Nonnull + public final Builder timestamp(long value) { + this.timestamp = value; return this; } /** * Builds a {@link ShardLease}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardLease build() { _checkSingleUse(); @@ -195,12 +240,30 @@ public ShardLease build() { ); protected static void setupShardLeaseDeserializer(ObjectDeserializer op) { - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::retainingSeqNo, JsonpDeserializer.longDeserializer(), "retaining_seq_no"); - op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); + op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.id.hashCode(); + result = 31 * result + Long.hashCode(this.retainingSeqNo); + result = 31 * result + this.source.hashCode(); + result = 31 * result + Long.hashCode(this.timestamp); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardLease other = (ShardLease) o; + return this.id.equals(other.id) + && this.retainingSeqNo == other.retainingSeqNo + && this.source.equals(other.source) + && this.timestamp == other.timestamp; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java index a27d3b5faa..51cd3d3222 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardPath.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,36 +47,41 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardPath @JsonpDeserializable -public class ShardPath implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardPath implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String dataPath; private final boolean isCustomDataPath; + @Nonnull private final String statePath; // --------------------------------------------------------------------------------------------- private ShardPath(Builder builder) { - this.dataPath = ApiTypeHelper.requireNonNull(builder.dataPath, this, "dataPath"); this.isCustomDataPath = ApiTypeHelper.requireNonNull(builder.isCustomDataPath, this, "isCustomDataPath"); this.statePath = ApiTypeHelper.requireNonNull(builder.statePath, this, "statePath"); - } - public static ShardPath of(Function> fn) { + public static ShardPath of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code data_path} */ + @Nonnull public final String dataPath() { return this.dataPath; } @@ -85,6 +96,7 @@ public final boolean isCustomDataPath() { /** * Required - API name: {@code state_path} */ + @Nonnull public final String statePath() { return this.statePath; } @@ -92,6 +104,7 @@ public final String statePath() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +112,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("data_path"); generator.write(this.dataPath); @@ -108,25 +120,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("state_path"); generator.write(this.statePath); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardPath}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String dataPath; - private Boolean isCustomDataPath; - private String statePath; + public Builder() {} + + private Builder(ShardPath o) { + this.dataPath = o.dataPath; + this.isCustomDataPath = o.isCustomDataPath; + this.statePath = o.statePath; + } + + private Builder(Builder o) { + this.dataPath = o.dataPath; + this.isCustomDataPath = o.isCustomDataPath; + this.statePath = o.statePath; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code data_path} */ + @Nonnull public final Builder dataPath(String value) { this.dataPath = value; return this; @@ -135,6 +175,7 @@ public final Builder dataPath(String value) { /** * Required - API name: {@code is_custom_data_path} */ + @Nonnull public final Builder isCustomDataPath(boolean value) { this.isCustomDataPath = value; return this; @@ -143,6 +184,7 @@ public final Builder isCustomDataPath(boolean value) { /** * Required - API name: {@code state_path} */ + @Nonnull public final Builder statePath(String value) { this.statePath = value; return this; @@ -151,9 +193,10 @@ public final Builder statePath(String value) { /** * Builds a {@link ShardPath}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardPath build() { _checkSingleUse(); @@ -172,11 +215,27 @@ public ShardPath build() { ); protected static void setupShardPathDeserializer(ObjectDeserializer op) { - op.add(Builder::dataPath, JsonpDeserializer.stringDeserializer(), "data_path"); op.add(Builder::isCustomDataPath, JsonpDeserializer.booleanDeserializer(), "is_custom_data_path"); op.add(Builder::statePath, JsonpDeserializer.stringDeserializer(), "state_path"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.dataPath.hashCode(); + result = 31 * result + Boolean.hashCode(this.isCustomDataPath); + result = 31 * result + this.statePath.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardPath other = (ShardPath) o; + return this.dataPath.equals(other.dataPath) + && this.isCustomDataPath == other.isCustomDataPath + && this.statePath.equals(other.statePath); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java index edaa6d145b..2d79f2ae1f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRetentionLeases.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,33 +48,44 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardRetentionLeases @JsonpDeserializable -public class ShardRetentionLeases implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardRetentionLeases implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final List leases; + private final long primaryTerm; private final long version; - private final List leases; - // --------------------------------------------------------------------------------------------- private ShardRetentionLeases(Builder builder) { - + this.leases = ApiTypeHelper.unmodifiableRequired(builder.leases, this, "leases"); this.primaryTerm = ApiTypeHelper.requireNonNull(builder.primaryTerm, this, "primaryTerm"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - this.leases = ApiTypeHelper.unmodifiableRequired(builder.leases, this, "leases"); - } - public static ShardRetentionLeases of(Function> fn) { + public static ShardRetentionLeases of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - API name: {@code leases} + */ + @Nonnull + public final List leases() { + return this.leases; + } + /** * Required - API name: {@code primary_term} */ @@ -83,16 +100,10 @@ public final long version() { return this.version; } - /** - * Required - API name: {@code leases} - */ - public final List leases() { - return this.leases; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -100,60 +111,69 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("leases"); + generator.writeStartArray(); + for (ShardLease item0 : this.leases) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); generator.writeKey("primary_term"); generator.write(this.primaryTerm); generator.writeKey("version"); generator.write(this.version); + } - if (ApiTypeHelper.isDefined(this.leases)) { - generator.writeKey("leases"); - generator.writeStartArray(); - for (ShardLease item0 : this.leases) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ShardRetentionLeases}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List leases; private Long primaryTerm; - private Long version; - private List leases; + public Builder() {} - /** - * Required - API name: {@code primary_term} - */ - public final Builder primaryTerm(long value) { - this.primaryTerm = value; - return this; + private Builder(ShardRetentionLeases o) { + this.leases = _listCopy(o.leases); + this.primaryTerm = o.primaryTerm; + this.version = o.version; } - /** - * Required - API name: {@code version} - */ - public final Builder version(long value) { - this.version = value; - return this; + private Builder(Builder o) { + this.leases = _listCopy(o.leases); + this.primaryTerm = o.primaryTerm; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code leases} + * *

* Adds all elements of list to leases. + *

*/ + @Nonnull public final Builder leases(List list) { this.leases = _listAddAll(this.leases, list); return this; @@ -161,9 +181,12 @@ public final Builder leases(List list) { /** * Required - API name: {@code leases} + * *

* Adds one or more values to leases. + *

*/ + @Nonnull public final Builder leases(ShardLease value, ShardLease... values) { this.leases = _listAdd(this.leases, value, values); return this; @@ -171,19 +194,41 @@ public final Builder leases(ShardLease value, ShardLease... values) { /** * Required - API name: {@code leases} + * *

* Adds a value to leases using a builder lambda. + *

*/ + @Nonnull public final Builder leases(Function> fn) { return leases(fn.apply(new ShardLease.Builder()).build()); } + /** + * Required - API name: {@code primary_term} + */ + @Nonnull + public final Builder primaryTerm(long value) { + this.primaryTerm = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final Builder version(long value) { + this.version = value; + return this; + } + /** * Builds a {@link ShardRetentionLeases}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardRetentionLeases build() { _checkSingleUse(); @@ -202,11 +247,25 @@ public ShardRetentionLeases build() { ); protected static void setupShardRetentionLeasesDeserializer(ObjectDeserializer op) { - + op.add(Builder::leases, JsonpDeserializer.arrayDeserializer(ShardLease._DESERIALIZER), "leases"); op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "primary_term"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(Builder::leases, JsonpDeserializer.arrayDeserializer(ShardLease._DESERIALIZER), "leases"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.leases.hashCode(); + result = 31 * result + Long.hashCode(this.primaryTerm); + result = 31 * result + Long.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardRetentionLeases other = (ShardRetentionLeases) o; + return this.leases.equals(other.leases) && this.primaryTerm == other.primaryTerm && this.version == other.version; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java index 8e483f3348..c65f2e1cda 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRouting.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,18 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardRouting @JsonpDeserializable -public class ShardRouting implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardRouting implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String node; private final boolean primary; @@ -56,26 +68,26 @@ public class ShardRouting implements PlainJsonSerializable { @Nullable private final String relocatingNode; + @Nonnull private final ShardRoutingState state; // --------------------------------------------------------------------------------------------- private ShardRouting(Builder builder) { - this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); this.relocatingNode = builder.relocatingNode; this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); - } - public static ShardRouting of(Function> fn) { + public static ShardRouting of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code node} */ + @Nonnull public final String node() { return this.node; } @@ -98,6 +110,7 @@ public final String relocatingNode() { /** * Required - API name: {@code state} */ + @Nonnull public final ShardRoutingState state() { return this.state; } @@ -105,6 +118,7 @@ public final ShardRoutingState state() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,7 +126,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("node"); generator.write(this.node); @@ -122,32 +135,61 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.relocatingNode != null) { generator.writeKey("relocating_node"); generator.write(this.relocatingNode); - } + generator.writeKey("state"); this.state.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardRouting}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String node; - private Boolean primary; - @Nullable private String relocatingNode; - private ShardRoutingState state; + public Builder() {} + + private Builder(ShardRouting o) { + this.node = o.node; + this.primary = o.primary; + this.relocatingNode = o.relocatingNode; + this.state = o.state; + } + + private Builder(Builder o) { + this.node = o.node; + this.primary = o.primary; + this.relocatingNode = o.relocatingNode; + this.state = o.state; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code node} */ + @Nonnull public final Builder node(String value) { this.node = value; return this; @@ -156,6 +198,7 @@ public final Builder node(String value) { /** * Required - API name: {@code primary} */ + @Nonnull public final Builder primary(boolean value) { this.primary = value; return this; @@ -164,6 +207,7 @@ public final Builder primary(boolean value) { /** * API name: {@code relocating_node} */ + @Nonnull public final Builder relocatingNode(@Nullable String value) { this.relocatingNode = value; return this; @@ -172,6 +216,7 @@ public final Builder relocatingNode(@Nullable String value) { /** * Required - API name: {@code state} */ + @Nonnull public final Builder state(ShardRoutingState value) { this.state = value; return this; @@ -180,9 +225,10 @@ public final Builder state(ShardRoutingState value) { /** * Builds a {@link ShardRouting}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardRouting build() { _checkSingleUse(); @@ -201,12 +247,30 @@ public ShardRouting build() { ); protected static void setupShardRoutingDeserializer(ObjectDeserializer op) { - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::relocatingNode, JsonpDeserializer.stringDeserializer(), "relocating_node"); op.add(Builder::state, ShardRoutingState._DESERIALIZER, "state"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.node.hashCode(); + result = 31 * result + Boolean.hashCode(this.primary); + result = 31 * result + Objects.hashCode(this.relocatingNode); + result = 31 * result + this.state.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardRouting other = (ShardRouting) o; + return this.node.equals(other.node) + && this.primary == other.primary + && Objects.equals(this.relocatingNode, other.relocatingNode) + && this.state.equals(other.state); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java index 264c7a518e..fe96b252d9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardRoutingState.java @@ -30,22 +30,28 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: indices.stats.ShardRoutingState + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ShardRoutingState implements JsonEnum { - Unassigned("UNASSIGNED"), - Initializing("INITIALIZING"), - Started("STARTED"), - Relocating("RELOCATING"), - ; + Started("STARTED"), + + Unassigned("UNASSIGNED"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java index 178f185c94..734f4691a8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/stats/ShardSequenceNumber.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.stats.ShardSequenceNumber @JsonpDeserializable -public class ShardSequenceNumber implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardSequenceNumber implements PlainJsonSerializable, ToCopyableBuilder { + private final long globalCheckpoint; private final long localCheckpoint; @@ -57,14 +67,12 @@ public class ShardSequenceNumber implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ShardSequenceNumber(Builder builder) { - this.globalCheckpoint = ApiTypeHelper.requireNonNull(builder.globalCheckpoint, this, "globalCheckpoint"); this.localCheckpoint = ApiTypeHelper.requireNonNull(builder.localCheckpoint, this, "localCheckpoint"); this.maxSeqNo = ApiTypeHelper.requireNonNull(builder.maxSeqNo, this, "maxSeqNo"); - } - public static ShardSequenceNumber of(Function> fn) { + public static ShardSequenceNumber of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -92,6 +100,7 @@ public final long maxSeqNo() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +108,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("global_checkpoint"); generator.write(this.globalCheckpoint); @@ -108,25 +116,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("max_seq_no"); generator.write(this.maxSeqNo); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardSequenceNumber}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long globalCheckpoint; - private Long localCheckpoint; - private Long maxSeqNo; + public Builder() {} + + private Builder(ShardSequenceNumber o) { + this.globalCheckpoint = o.globalCheckpoint; + this.localCheckpoint = o.localCheckpoint; + this.maxSeqNo = o.maxSeqNo; + } + + private Builder(Builder o) { + this.globalCheckpoint = o.globalCheckpoint; + this.localCheckpoint = o.localCheckpoint; + this.maxSeqNo = o.maxSeqNo; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code global_checkpoint} */ + @Nonnull public final Builder globalCheckpoint(long value) { this.globalCheckpoint = value; return this; @@ -135,6 +171,7 @@ public final Builder globalCheckpoint(long value) { /** * Required - API name: {@code local_checkpoint} */ + @Nonnull public final Builder localCheckpoint(long value) { this.localCheckpoint = value; return this; @@ -143,6 +180,7 @@ public final Builder localCheckpoint(long value) { /** * Required - API name: {@code max_seq_no} */ + @Nonnull public final Builder maxSeqNo(long value) { this.maxSeqNo = value; return this; @@ -151,9 +189,10 @@ public final Builder maxSeqNo(long value) { /** * Builds a {@link ShardSequenceNumber}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardSequenceNumber build() { _checkSingleUse(); @@ -172,11 +211,27 @@ public ShardSequenceNumber build() { ); protected static void setupShardSequenceNumberDeserializer(ObjectDeserializer op) { - op.add(Builder::globalCheckpoint, JsonpDeserializer.longDeserializer(), "global_checkpoint"); op.add(Builder::localCheckpoint, JsonpDeserializer.longDeserializer(), "local_checkpoint"); op.add(Builder::maxSeqNo, JsonpDeserializer.longDeserializer(), "max_seq_no"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.globalCheckpoint); + result = 31 * result + Long.hashCode(this.localCheckpoint); + result = 31 * result + Long.hashCode(this.maxSeqNo); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardSequenceNumber other = (ShardSequenceNumber) o; + return this.globalCheckpoint == other.globalCheckpoint + && this.localCheckpoint == other.localCheckpoint + && this.maxSeqNo == other.maxSeqNo; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java index 36b901525b..adeb395a55 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/validate_query/IndicesValidationExplanation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.validate_query; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,19 +49,27 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.validate_query.IndicesValidationExplanation @JsonpDeserializable -public class IndicesValidationExplanation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesValidationExplanation + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final String error; @Nullable private final String explanation; + @Nonnull private final String index; private final boolean valid; @@ -62,15 +77,15 @@ public class IndicesValidationExplanation implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private IndicesValidationExplanation(Builder builder) { - this.error = builder.error; this.explanation = builder.explanation; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.valid = ApiTypeHelper.requireNonNull(builder.valid, this, "valid"); - } - public static IndicesValidationExplanation of(Function> fn) { + public static IndicesValidationExplanation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -93,6 +108,7 @@ public final String explanation() { /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } @@ -107,6 +123,7 @@ public final boolean valid() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -114,45 +131,73 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.error != null) { generator.writeKey("error"); generator.write(this.error); - } + if (this.explanation != null) { generator.writeKey("explanation"); generator.write(this.explanation); - } + generator.writeKey("index"); generator.write(this.index); generator.writeKey("valid"); generator.write(this.valid); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndicesValidationExplanation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String error; - @Nullable private String explanation; - private String index; - private Boolean valid; + public Builder() {} + + private Builder(IndicesValidationExplanation o) { + this.error = o.error; + this.explanation = o.explanation; + this.index = o.index; + this.valid = o.valid; + } + + private Builder(Builder o) { + this.error = o.error; + this.explanation = o.explanation; + this.index = o.index; + this.valid = o.valid; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code error} */ + @Nonnull public final Builder error(@Nullable String value) { this.error = value; return this; @@ -161,6 +206,7 @@ public final Builder error(@Nullable String value) { /** * API name: {@code explanation} */ + @Nonnull public final Builder explanation(@Nullable String value) { this.explanation = value; return this; @@ -169,6 +215,7 @@ public final Builder explanation(@Nullable String value) { /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -177,6 +224,7 @@ public final Builder index(String value) { /** * Required - API name: {@code valid} */ + @Nonnull public final Builder valid(boolean value) { this.valid = value; return this; @@ -185,9 +233,10 @@ public final Builder valid(boolean value) { /** * Builds a {@link IndicesValidationExplanation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndicesValidationExplanation build() { _checkSingleUse(); @@ -206,12 +255,30 @@ public IndicesValidationExplanation build() { ); protected static void setupIndicesValidationExplanationDeserializer(ObjectDeserializer op) { - op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); op.add(Builder::explanation, JsonpDeserializer.stringDeserializer(), "explanation"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::valid, JsonpDeserializer.booleanDeserializer(), "valid"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.error); + result = 31 * result + Objects.hashCode(this.explanation); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Boolean.hashCode(this.valid); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesValidationExplanation other = (IndicesValidationExplanation) o; + return Objects.equals(this.error, other.error) + && Objects.equals(this.explanation, other.explanation) + && this.index.equals(other.index) + && this.valid == other.valid; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java deleted file mode 100644 index 1b580be694..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java +++ /dev/null @@ -1,347 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: _types.BulkStats - -@JsonpDeserializable -public class BulkStats implements PlainJsonSerializable { - private final long totalOperations; - - @Nullable - private final String totalTime; - - private final long totalTimeInMillis; - - @Nullable - private final String totalSize; - - private final long totalSizeInBytes; - - @Nullable - private final String avgTime; - - private final long avgTimeInMillis; - - @Nullable - private final String avgSize; - - private final long avgSizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private BulkStats(Builder builder) { - - this.totalOperations = ApiTypeHelper.requireNonNull(builder.totalOperations, this, "totalOperations"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - this.totalSize = builder.totalSize; - this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); - this.avgTime = builder.avgTime; - this.avgTimeInMillis = ApiTypeHelper.requireNonNull(builder.avgTimeInMillis, this, "avgTimeInMillis"); - this.avgSize = builder.avgSize; - this.avgSizeInBytes = ApiTypeHelper.requireNonNull(builder.avgSizeInBytes, this, "avgSizeInBytes"); - - } - - public static BulkStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code total_operations} - */ - public final long totalOperations() { - return this.totalOperations; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * API name: {@code total_size} - */ - @Nullable - public final String totalSize() { - return this.totalSize; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final long totalSizeInBytes() { - return this.totalSizeInBytes; - } - - /** - * API name: {@code avg_time} - */ - @Nullable - public final String avgTime() { - return this.avgTime; - } - - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final long avgTimeInMillis() { - return this.avgTimeInMillis; - } - - /** - * API name: {@code avg_size} - */ - @Nullable - public final String avgSize() { - return this.avgSize; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final long avgSizeInBytes() { - return this.avgSizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("total_operations"); - generator.write(this.totalOperations); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - if (this.totalSize != null) { - generator.writeKey("total_size"); - generator.write(this.totalSize); - - } - generator.writeKey("total_size_in_bytes"); - generator.write(this.totalSizeInBytes); - - if (this.avgTime != null) { - generator.writeKey("avg_time"); - generator.write(this.avgTime); - - } - generator.writeKey("avg_time_in_millis"); - generator.write(this.avgTimeInMillis); - - if (this.avgSize != null) { - generator.writeKey("avg_size"); - generator.write(this.avgSize); - - } - generator.writeKey("avg_size_in_bytes"); - generator.write(this.avgSizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long totalOperations; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - @Nullable - private String totalSize; - - private Long totalSizeInBytes; - - @Nullable - private String avgTime; - - private Long avgTimeInMillis; - - @Nullable - private String avgSize; - - private Long avgSizeInBytes; - - /** - * Required - API name: {@code total_operations} - */ - public final Builder totalOperations(long value) { - this.totalOperations = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_size} - */ - public final Builder totalSize(@Nullable String value) { - this.totalSize = value; - return this; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final Builder totalSizeInBytes(long value) { - this.totalSizeInBytes = value; - return this; - } - - /** - * API name: {@code avg_time} - */ - public final Builder avgTime(@Nullable String value) { - this.avgTime = value; - return this; - } - - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final Builder avgTimeInMillis(long value) { - this.avgTimeInMillis = value; - return this; - } - - /** - * API name: {@code avg_size} - */ - public final Builder avgSize(@Nullable String value) { - this.avgSize = value; - return this; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final Builder avgSizeInBytes(long value) { - this.avgSizeInBytes = value; - return this; - } - - /** - * Builds a {@link BulkStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkStats build() { - _checkSingleUse(); - - return new BulkStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - BulkStats::setupBulkStatsDeserializer - ); - - protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); - op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); - op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); - op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); - op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/SearchStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/SearchStats.java deleted file mode 100644 index 69efa95b89..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/SearchStats.java +++ /dev/null @@ -1,484 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types; - -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: _types.SearchStats - -@JsonpDeserializable -public class SearchStats implements PlainJsonSerializable { - private final long fetchCurrent; - - private final long fetchTimeInMillis; - - private final long fetchTotal; - - @Nullable - private final Long openContexts; - - private final long queryCurrent; - - private final long queryTimeInMillis; - - private final long queryTotal; - - private final long scrollCurrent; - - private final long scrollTimeInMillis; - - private final long scrollTotal; - - private final long suggestCurrent; - - private final long suggestTimeInMillis; - - private final long suggestTotal; - - private final Map groups; - - // --------------------------------------------------------------------------------------------- - - private SearchStats(Builder builder) { - - this.fetchCurrent = ApiTypeHelper.requireNonNull(builder.fetchCurrent, this, "fetchCurrent"); - this.fetchTimeInMillis = ApiTypeHelper.requireNonNull(builder.fetchTimeInMillis, this, "fetchTimeInMillis"); - this.fetchTotal = ApiTypeHelper.requireNonNull(builder.fetchTotal, this, "fetchTotal"); - this.openContexts = builder.openContexts; - this.queryCurrent = ApiTypeHelper.requireNonNull(builder.queryCurrent, this, "queryCurrent"); - this.queryTimeInMillis = ApiTypeHelper.requireNonNull(builder.queryTimeInMillis, this, "queryTimeInMillis"); - this.queryTotal = ApiTypeHelper.requireNonNull(builder.queryTotal, this, "queryTotal"); - this.scrollCurrent = ApiTypeHelper.requireNonNull(builder.scrollCurrent, this, "scrollCurrent"); - this.scrollTimeInMillis = ApiTypeHelper.requireNonNull(builder.scrollTimeInMillis, this, "scrollTimeInMillis"); - this.scrollTotal = ApiTypeHelper.requireNonNull(builder.scrollTotal, this, "scrollTotal"); - this.suggestCurrent = ApiTypeHelper.requireNonNull(builder.suggestCurrent, this, "suggestCurrent"); - this.suggestTimeInMillis = ApiTypeHelper.requireNonNull(builder.suggestTimeInMillis, this, "suggestTimeInMillis"); - this.suggestTotal = ApiTypeHelper.requireNonNull(builder.suggestTotal, this, "suggestTotal"); - this.groups = ApiTypeHelper.unmodifiable(builder.groups); - - } - - public static SearchStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code fetch_current} - */ - public final long fetchCurrent() { - return this.fetchCurrent; - } - - /** - * Required - API name: {@code fetch_time_in_millis} - */ - public final long fetchTimeInMillis() { - return this.fetchTimeInMillis; - } - - /** - * Required - API name: {@code fetch_total} - */ - public final long fetchTotal() { - return this.fetchTotal; - } - - /** - * API name: {@code open_contexts} - */ - @Nullable - public final Long openContexts() { - return this.openContexts; - } - - /** - * Required - API name: {@code query_current} - */ - public final long queryCurrent() { - return this.queryCurrent; - } - - /** - * Required - API name: {@code query_time_in_millis} - */ - public final long queryTimeInMillis() { - return this.queryTimeInMillis; - } - - /** - * Required - API name: {@code query_total} - */ - public final long queryTotal() { - return this.queryTotal; - } - - /** - * Required - API name: {@code scroll_current} - */ - public final long scrollCurrent() { - return this.scrollCurrent; - } - - /** - * Required - API name: {@code scroll_time_in_millis} - */ - public final long scrollTimeInMillis() { - return this.scrollTimeInMillis; - } - - /** - * Required - API name: {@code scroll_total} - */ - public final long scrollTotal() { - return this.scrollTotal; - } - - /** - * Required - API name: {@code suggest_current} - */ - public final long suggestCurrent() { - return this.suggestCurrent; - } - - /** - * Required - API name: {@code suggest_time_in_millis} - */ - public final long suggestTimeInMillis() { - return this.suggestTimeInMillis; - } - - /** - * Required - API name: {@code suggest_total} - */ - public final long suggestTotal() { - return this.suggestTotal; - } - - /** - * API name: {@code groups} - */ - public final Map groups() { - return this.groups; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("fetch_current"); - generator.write(this.fetchCurrent); - - generator.writeKey("fetch_time_in_millis"); - generator.write(this.fetchTimeInMillis); - - generator.writeKey("fetch_total"); - generator.write(this.fetchTotal); - - if (this.openContexts != null) { - generator.writeKey("open_contexts"); - generator.write(this.openContexts); - - } - generator.writeKey("query_current"); - generator.write(this.queryCurrent); - - generator.writeKey("query_time_in_millis"); - generator.write(this.queryTimeInMillis); - - generator.writeKey("query_total"); - generator.write(this.queryTotal); - - generator.writeKey("scroll_current"); - generator.write(this.scrollCurrent); - - generator.writeKey("scroll_time_in_millis"); - generator.write(this.scrollTimeInMillis); - - generator.writeKey("scroll_total"); - generator.write(this.scrollTotal); - - generator.writeKey("suggest_current"); - generator.write(this.suggestCurrent); - - generator.writeKey("suggest_time_in_millis"); - generator.write(this.suggestTimeInMillis); - - generator.writeKey("suggest_total"); - generator.write(this.suggestTotal); - - if (ApiTypeHelper.isDefined(this.groups)) { - generator.writeKey("groups"); - generator.writeStartObject(); - for (Map.Entry item0 : this.groups.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SearchStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long fetchCurrent; - - private Long fetchTimeInMillis; - - private Long fetchTotal; - - @Nullable - private Long openContexts; - - private Long queryCurrent; - - private Long queryTimeInMillis; - - private Long queryTotal; - - private Long scrollCurrent; - - private Long scrollTimeInMillis; - - private Long scrollTotal; - - private Long suggestCurrent; - - private Long suggestTimeInMillis; - - private Long suggestTotal; - - @Nullable - private Map groups; - - /** - * Required - API name: {@code fetch_current} - */ - public final Builder fetchCurrent(long value) { - this.fetchCurrent = value; - return this; - } - - /** - * Required - API name: {@code fetch_time_in_millis} - */ - public final Builder fetchTimeInMillis(long value) { - this.fetchTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code fetch_total} - */ - public final Builder fetchTotal(long value) { - this.fetchTotal = value; - return this; - } - - /** - * API name: {@code open_contexts} - */ - public final Builder openContexts(@Nullable Long value) { - this.openContexts = value; - return this; - } - - /** - * Required - API name: {@code query_current} - */ - public final Builder queryCurrent(long value) { - this.queryCurrent = value; - return this; - } - - /** - * Required - API name: {@code query_time_in_millis} - */ - public final Builder queryTimeInMillis(long value) { - this.queryTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code query_total} - */ - public final Builder queryTotal(long value) { - this.queryTotal = value; - return this; - } - - /** - * Required - API name: {@code scroll_current} - */ - public final Builder scrollCurrent(long value) { - this.scrollCurrent = value; - return this; - } - - /** - * Required - API name: {@code scroll_time_in_millis} - */ - public final Builder scrollTimeInMillis(long value) { - this.scrollTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code scroll_total} - */ - public final Builder scrollTotal(long value) { - this.scrollTotal = value; - return this; - } - - /** - * Required - API name: {@code suggest_current} - */ - public final Builder suggestCurrent(long value) { - this.suggestCurrent = value; - return this; - } - - /** - * Required - API name: {@code suggest_time_in_millis} - */ - public final Builder suggestTimeInMillis(long value) { - this.suggestTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code suggest_total} - */ - public final Builder suggestTotal(long value) { - this.suggestTotal = value; - return this; - } - - /** - * API name: {@code groups} - *

- * Adds all entries of map to groups. - */ - public final Builder groups(Map map) { - this.groups = _mapPutAll(this.groups, map); - return this; - } - - /** - * API name: {@code groups} - *

- * Adds an entry to groups. - */ - public final Builder groups(String key, SearchStats value) { - this.groups = _mapPut(this.groups, key, value); - return this; - } - - /** - * API name: {@code groups} - *

- * Adds an entry to groups using a builder lambda. - */ - public final Builder groups(String key, Function> fn) { - return groups(key, fn.apply(new SearchStats.Builder()).build()); - } - - /** - * Builds a {@link SearchStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SearchStats build() { - _checkSingleUse(); - - return new SearchStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SearchStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - SearchStats::setupSearchStatsDeserializer - ); - - protected static void setupSearchStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::fetchCurrent, JsonpDeserializer.longDeserializer(), "fetch_current"); - op.add(Builder::fetchTimeInMillis, JsonpDeserializer.longDeserializer(), "fetch_time_in_millis"); - op.add(Builder::fetchTotal, JsonpDeserializer.longDeserializer(), "fetch_total"); - op.add(Builder::openContexts, JsonpDeserializer.longDeserializer(), "open_contexts"); - op.add(Builder::queryCurrent, JsonpDeserializer.longDeserializer(), "query_current"); - op.add(Builder::queryTimeInMillis, JsonpDeserializer.longDeserializer(), "query_time_in_millis"); - op.add(Builder::queryTotal, JsonpDeserializer.longDeserializer(), "query_total"); - op.add(Builder::scrollCurrent, JsonpDeserializer.longDeserializer(), "scroll_current"); - op.add(Builder::scrollTimeInMillis, JsonpDeserializer.longDeserializer(), "scroll_time_in_millis"); - op.add(Builder::scrollTotal, JsonpDeserializer.longDeserializer(), "scroll_total"); - op.add(Builder::suggestCurrent, JsonpDeserializer.longDeserializer(), "suggest_current"); - op.add(Builder::suggestTimeInMillis, JsonpDeserializer.longDeserializer(), "suggest_time_in_millis"); - op.add(Builder::suggestTotal, JsonpDeserializer.longDeserializer(), "suggest_total"); - op.add(Builder::groups, JsonpDeserializer.stringMapDeserializer(SearchStats._DESERIALIZER), "groups"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/SegmentsStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/SegmentsStats.java deleted file mode 100644 index a3c6448918..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/SegmentsStats.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types; - -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch.indices.stats.ShardFileSizeInfo; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: _types.SegmentsStats - -@JsonpDeserializable -public class SegmentsStats implements PlainJsonSerializable { - private final int count; - - @Nullable - private final String docValuesMemory; - - private final long docValuesMemoryInBytes; - - private final Map fileSizes; - - @Nullable - private final String fixedBitSet; - - private final long fixedBitSetMemoryInBytes; - - @Nullable - private final String indexWriterMemory; - - @Nullable - private final Long indexWriterMaxMemoryInBytes; - - private final long indexWriterMemoryInBytes; - - private final long maxUnsafeAutoIdTimestamp; - - @Nullable - private final String memory; - - private final long memoryInBytes; - - @Nullable - private final String normsMemory; - - private final long normsMemoryInBytes; - - @Nullable - private final String pointsMemory; - - private final long pointsMemoryInBytes; - - @Nullable - private final String storedMemory; - - private final long storedFieldsMemoryInBytes; - - private final long termsMemoryInBytes; - - @Nullable - private final String termsMemory; - - @Nullable - private final String termVectoryMemory; - - private final long termVectorsMemoryInBytes; - - @Nullable - private final String versionMapMemory; - - private final long versionMapMemoryInBytes; - - // --------------------------------------------------------------------------------------------- - - private SegmentsStats(Builder builder) { - - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.docValuesMemory = builder.docValuesMemory; - this.docValuesMemoryInBytes = ApiTypeHelper.requireNonNull(builder.docValuesMemoryInBytes, this, "docValuesMemoryInBytes"); - this.fileSizes = ApiTypeHelper.unmodifiableRequired(builder.fileSizes, this, "fileSizes"); - this.fixedBitSet = builder.fixedBitSet; - this.fixedBitSetMemoryInBytes = ApiTypeHelper.requireNonNull(builder.fixedBitSetMemoryInBytes, this, "fixedBitSetMemoryInBytes"); - this.indexWriterMemory = builder.indexWriterMemory; - this.indexWriterMaxMemoryInBytes = builder.indexWriterMaxMemoryInBytes; - this.indexWriterMemoryInBytes = ApiTypeHelper.requireNonNull(builder.indexWriterMemoryInBytes, this, "indexWriterMemoryInBytes"); - this.maxUnsafeAutoIdTimestamp = ApiTypeHelper.requireNonNull(builder.maxUnsafeAutoIdTimestamp, this, "maxUnsafeAutoIdTimestamp"); - this.memory = builder.memory; - this.memoryInBytes = ApiTypeHelper.requireNonNull(builder.memoryInBytes, this, "memoryInBytes"); - this.normsMemory = builder.normsMemory; - this.normsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.normsMemoryInBytes, this, "normsMemoryInBytes"); - this.pointsMemory = builder.pointsMemory; - this.pointsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.pointsMemoryInBytes, this, "pointsMemoryInBytes"); - this.storedMemory = builder.storedMemory; - this.storedFieldsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.storedFieldsMemoryInBytes, this, "storedFieldsMemoryInBytes"); - this.termsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.termsMemoryInBytes, this, "termsMemoryInBytes"); - this.termsMemory = builder.termsMemory; - this.termVectoryMemory = builder.termVectoryMemory; - this.termVectorsMemoryInBytes = ApiTypeHelper.requireNonNull(builder.termVectorsMemoryInBytes, this, "termVectorsMemoryInBytes"); - this.versionMapMemory = builder.versionMapMemory; - this.versionMapMemoryInBytes = ApiTypeHelper.requireNonNull(builder.versionMapMemoryInBytes, this, "versionMapMemoryInBytes"); - - } - - public static SegmentsStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code count} - */ - public final int count() { - return this.count; - } - - /** - * API name: {@code doc_values_memory} - */ - @Nullable - public final String docValuesMemory() { - return this.docValuesMemory; - } - - /** - * Required - API name: {@code doc_values_memory_in_bytes} - */ - public final long docValuesMemoryInBytes() { - return this.docValuesMemoryInBytes; - } - - /** - * Required - API name: {@code file_sizes} - */ - public final Map fileSizes() { - return this.fileSizes; - } - - /** - * API name: {@code fixed_bit_set} - */ - @Nullable - public final String fixedBitSet() { - return this.fixedBitSet; - } - - /** - * Required - API name: {@code fixed_bit_set_memory_in_bytes} - */ - public final long fixedBitSetMemoryInBytes() { - return this.fixedBitSetMemoryInBytes; - } - - /** - * API name: {@code index_writer_memory} - */ - @Nullable - public final String indexWriterMemory() { - return this.indexWriterMemory; - } - - /** - * API name: {@code index_writer_max_memory_in_bytes} - */ - @Nullable - public final Long indexWriterMaxMemoryInBytes() { - return this.indexWriterMaxMemoryInBytes; - } - - /** - * Required - API name: {@code index_writer_memory_in_bytes} - */ - public final long indexWriterMemoryInBytes() { - return this.indexWriterMemoryInBytes; - } - - /** - * Required - API name: {@code max_unsafe_auto_id_timestamp} - */ - public final long maxUnsafeAutoIdTimestamp() { - return this.maxUnsafeAutoIdTimestamp; - } - - /** - * API name: {@code memory} - */ - @Nullable - public final String memory() { - return this.memory; - } - - /** - * Required - API name: {@code memory_in_bytes} - */ - public final long memoryInBytes() { - return this.memoryInBytes; - } - - /** - * API name: {@code norms_memory} - */ - @Nullable - public final String normsMemory() { - return this.normsMemory; - } - - /** - * Required - API name: {@code norms_memory_in_bytes} - */ - public final long normsMemoryInBytes() { - return this.normsMemoryInBytes; - } - - /** - * API name: {@code points_memory} - */ - @Nullable - public final String pointsMemory() { - return this.pointsMemory; - } - - /** - * Required - API name: {@code points_memory_in_bytes} - */ - public final long pointsMemoryInBytes() { - return this.pointsMemoryInBytes; - } - - /** - * API name: {@code stored_memory} - */ - @Nullable - public final String storedMemory() { - return this.storedMemory; - } - - /** - * Required - API name: {@code stored_fields_memory_in_bytes} - */ - public final long storedFieldsMemoryInBytes() { - return this.storedFieldsMemoryInBytes; - } - - /** - * Required - API name: {@code terms_memory_in_bytes} - */ - public final long termsMemoryInBytes() { - return this.termsMemoryInBytes; - } - - /** - * API name: {@code terms_memory} - */ - @Nullable - public final String termsMemory() { - return this.termsMemory; - } - - /** - * API name: {@code term_vectory_memory} - */ - @Nullable - public final String termVectoryMemory() { - return this.termVectoryMemory; - } - - /** - * Required - API name: {@code term_vectors_memory_in_bytes} - */ - public final long termVectorsMemoryInBytes() { - return this.termVectorsMemoryInBytes; - } - - /** - * API name: {@code version_map_memory} - */ - @Nullable - public final String versionMapMemory() { - return this.versionMapMemory; - } - - /** - * Required - API name: {@code version_map_memory_in_bytes} - */ - public final long versionMapMemoryInBytes() { - return this.versionMapMemoryInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("count"); - generator.write(this.count); - - if (this.docValuesMemory != null) { - generator.writeKey("doc_values_memory"); - generator.write(this.docValuesMemory); - - } - generator.writeKey("doc_values_memory_in_bytes"); - generator.write(this.docValuesMemoryInBytes); - - if (ApiTypeHelper.isDefined(this.fileSizes)) { - generator.writeKey("file_sizes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fileSizes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.fixedBitSet != null) { - generator.writeKey("fixed_bit_set"); - generator.write(this.fixedBitSet); - - } - generator.writeKey("fixed_bit_set_memory_in_bytes"); - generator.write(this.fixedBitSetMemoryInBytes); - - if (this.indexWriterMemory != null) { - generator.writeKey("index_writer_memory"); - generator.write(this.indexWriterMemory); - - } - if (this.indexWriterMaxMemoryInBytes != null) { - generator.writeKey("index_writer_max_memory_in_bytes"); - generator.write(this.indexWriterMaxMemoryInBytes); - - } - generator.writeKey("index_writer_memory_in_bytes"); - generator.write(this.indexWriterMemoryInBytes); - - generator.writeKey("max_unsafe_auto_id_timestamp"); - generator.write(this.maxUnsafeAutoIdTimestamp); - - if (this.memory != null) { - generator.writeKey("memory"); - generator.write(this.memory); - - } - generator.writeKey("memory_in_bytes"); - generator.write(this.memoryInBytes); - - if (this.normsMemory != null) { - generator.writeKey("norms_memory"); - generator.write(this.normsMemory); - - } - generator.writeKey("norms_memory_in_bytes"); - generator.write(this.normsMemoryInBytes); - - if (this.pointsMemory != null) { - generator.writeKey("points_memory"); - generator.write(this.pointsMemory); - - } - generator.writeKey("points_memory_in_bytes"); - generator.write(this.pointsMemoryInBytes); - - if (this.storedMemory != null) { - generator.writeKey("stored_memory"); - generator.write(this.storedMemory); - - } - generator.writeKey("stored_fields_memory_in_bytes"); - generator.write(this.storedFieldsMemoryInBytes); - - generator.writeKey("terms_memory_in_bytes"); - generator.write(this.termsMemoryInBytes); - - if (this.termsMemory != null) { - generator.writeKey("terms_memory"); - generator.write(this.termsMemory); - - } - if (this.termVectoryMemory != null) { - generator.writeKey("term_vectory_memory"); - generator.write(this.termVectoryMemory); - - } - generator.writeKey("term_vectors_memory_in_bytes"); - generator.write(this.termVectorsMemoryInBytes); - - if (this.versionMapMemory != null) { - generator.writeKey("version_map_memory"); - generator.write(this.versionMapMemory); - - } - generator.writeKey("version_map_memory_in_bytes"); - generator.write(this.versionMapMemoryInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SegmentsStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer count; - - @Nullable - private String docValuesMemory; - - private Long docValuesMemoryInBytes; - - private Map fileSizes; - - @Nullable - private String fixedBitSet; - - private Long fixedBitSetMemoryInBytes; - - @Nullable - private String indexWriterMemory; - - @Nullable - private Long indexWriterMaxMemoryInBytes; - - private Long indexWriterMemoryInBytes; - - private Long maxUnsafeAutoIdTimestamp; - - @Nullable - private String memory; - - private Long memoryInBytes; - - @Nullable - private String normsMemory; - - private Long normsMemoryInBytes; - - @Nullable - private String pointsMemory; - - private Long pointsMemoryInBytes; - - @Nullable - private String storedMemory; - - private Long storedFieldsMemoryInBytes; - - private Long termsMemoryInBytes; - - @Nullable - private String termsMemory; - - @Nullable - private String termVectoryMemory; - - private Long termVectorsMemoryInBytes; - - @Nullable - private String versionMapMemory; - - private Long versionMapMemoryInBytes; - - /** - * Required - API name: {@code count} - */ - public final Builder count(int value) { - this.count = value; - return this; - } - - /** - * API name: {@code doc_values_memory} - */ - public final Builder docValuesMemory(@Nullable String value) { - this.docValuesMemory = value; - return this; - } - - /** - * Required - API name: {@code doc_values_memory_in_bytes} - */ - public final Builder docValuesMemoryInBytes(long value) { - this.docValuesMemoryInBytes = value; - return this; - } - - /** - * Required - API name: {@code file_sizes} - *

- * Adds all entries of map to fileSizes. - */ - public final Builder fileSizes(Map map) { - this.fileSizes = _mapPutAll(this.fileSizes, map); - return this; - } - - /** - * Required - API name: {@code file_sizes} - *

- * Adds an entry to fileSizes. - */ - public final Builder fileSizes(String key, ShardFileSizeInfo value) { - this.fileSizes = _mapPut(this.fileSizes, key, value); - return this; - } - - /** - * Required - API name: {@code file_sizes} - *

- * Adds an entry to fileSizes using a builder lambda. - */ - public final Builder fileSizes(String key, Function> fn) { - return fileSizes(key, fn.apply(new ShardFileSizeInfo.Builder()).build()); - } - - /** - * API name: {@code fixed_bit_set} - */ - public final Builder fixedBitSet(@Nullable String value) { - this.fixedBitSet = value; - return this; - } - - /** - * Required - API name: {@code fixed_bit_set_memory_in_bytes} - */ - public final Builder fixedBitSetMemoryInBytes(long value) { - this.fixedBitSetMemoryInBytes = value; - return this; - } - - /** - * API name: {@code index_writer_memory} - */ - public final Builder indexWriterMemory(@Nullable String value) { - this.indexWriterMemory = value; - return this; - } - - /** - * API name: {@code index_writer_max_memory_in_bytes} - */ - public final Builder indexWriterMaxMemoryInBytes(@Nullable Long value) { - this.indexWriterMaxMemoryInBytes = value; - return this; - } - - /** - * Required - API name: {@code index_writer_memory_in_bytes} - */ - public final Builder indexWriterMemoryInBytes(long value) { - this.indexWriterMemoryInBytes = value; - return this; - } - - /** - * Required - API name: {@code max_unsafe_auto_id_timestamp} - */ - public final Builder maxUnsafeAutoIdTimestamp(long value) { - this.maxUnsafeAutoIdTimestamp = value; - return this; - } - - /** - * API name: {@code memory} - */ - public final Builder memory(@Nullable String value) { - this.memory = value; - return this; - } - - /** - * Required - API name: {@code memory_in_bytes} - */ - public final Builder memoryInBytes(long value) { - this.memoryInBytes = value; - return this; - } - - /** - * API name: {@code norms_memory} - */ - public final Builder normsMemory(@Nullable String value) { - this.normsMemory = value; - return this; - } - - /** - * Required - API name: {@code norms_memory_in_bytes} - */ - public final Builder normsMemoryInBytes(long value) { - this.normsMemoryInBytes = value; - return this; - } - - /** - * API name: {@code points_memory} - */ - public final Builder pointsMemory(@Nullable String value) { - this.pointsMemory = value; - return this; - } - - /** - * Required - API name: {@code points_memory_in_bytes} - */ - public final Builder pointsMemoryInBytes(long value) { - this.pointsMemoryInBytes = value; - return this; - } - - /** - * API name: {@code stored_memory} - */ - public final Builder storedMemory(@Nullable String value) { - this.storedMemory = value; - return this; - } - - /** - * Required - API name: {@code stored_fields_memory_in_bytes} - */ - public final Builder storedFieldsMemoryInBytes(long value) { - this.storedFieldsMemoryInBytes = value; - return this; - } - - /** - * Required - API name: {@code terms_memory_in_bytes} - */ - public final Builder termsMemoryInBytes(long value) { - this.termsMemoryInBytes = value; - return this; - } - - /** - * API name: {@code terms_memory} - */ - public final Builder termsMemory(@Nullable String value) { - this.termsMemory = value; - return this; - } - - /** - * API name: {@code term_vectory_memory} - */ - public final Builder termVectoryMemory(@Nullable String value) { - this.termVectoryMemory = value; - return this; - } - - /** - * Required - API name: {@code term_vectors_memory_in_bytes} - */ - public final Builder termVectorsMemoryInBytes(long value) { - this.termVectorsMemoryInBytes = value; - return this; - } - - /** - * API name: {@code version_map_memory} - */ - public final Builder versionMapMemory(@Nullable String value) { - this.versionMapMemory = value; - return this; - } - - /** - * Required - API name: {@code version_map_memory_in_bytes} - */ - public final Builder versionMapMemoryInBytes(long value) { - this.versionMapMemoryInBytes = value; - return this; - } - - /** - * Builds a {@link SegmentsStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SegmentsStats build() { - _checkSingleUse(); - - return new SegmentsStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SegmentsStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - SegmentsStats::setupSegmentsStatsDeserializer - ); - - protected static void setupSegmentsStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); - op.add(Builder::docValuesMemory, JsonpDeserializer.stringDeserializer(), "doc_values_memory"); - op.add(Builder::docValuesMemoryInBytes, JsonpDeserializer.longDeserializer(), "doc_values_memory_in_bytes"); - op.add(Builder::fileSizes, JsonpDeserializer.stringMapDeserializer(ShardFileSizeInfo._DESERIALIZER), "file_sizes"); - op.add(Builder::fixedBitSet, JsonpDeserializer.stringDeserializer(), "fixed_bit_set"); - op.add(Builder::fixedBitSetMemoryInBytes, JsonpDeserializer.longDeserializer(), "fixed_bit_set_memory_in_bytes"); - op.add(Builder::indexWriterMemory, JsonpDeserializer.stringDeserializer(), "index_writer_memory"); - op.add(Builder::indexWriterMaxMemoryInBytes, JsonpDeserializer.longDeserializer(), "index_writer_max_memory_in_bytes"); - op.add(Builder::indexWriterMemoryInBytes, JsonpDeserializer.longDeserializer(), "index_writer_memory_in_bytes"); - op.add(Builder::maxUnsafeAutoIdTimestamp, JsonpDeserializer.longDeserializer(), "max_unsafe_auto_id_timestamp"); - op.add(Builder::memory, JsonpDeserializer.stringDeserializer(), "memory"); - op.add(Builder::memoryInBytes, JsonpDeserializer.longDeserializer(), "memory_in_bytes"); - op.add(Builder::normsMemory, JsonpDeserializer.stringDeserializer(), "norms_memory"); - op.add(Builder::normsMemoryInBytes, JsonpDeserializer.longDeserializer(), "norms_memory_in_bytes"); - op.add(Builder::pointsMemory, JsonpDeserializer.stringDeserializer(), "points_memory"); - op.add(Builder::pointsMemoryInBytes, JsonpDeserializer.longDeserializer(), "points_memory_in_bytes"); - op.add(Builder::storedMemory, JsonpDeserializer.stringDeserializer(), "stored_memory"); - op.add(Builder::storedFieldsMemoryInBytes, JsonpDeserializer.longDeserializer(), "stored_fields_memory_in_bytes"); - op.add(Builder::termsMemoryInBytes, JsonpDeserializer.longDeserializer(), "terms_memory_in_bytes"); - op.add(Builder::termsMemory, JsonpDeserializer.stringDeserializer(), "terms_memory"); - op.add(Builder::termVectoryMemory, JsonpDeserializer.stringDeserializer(), "term_vectory_memory"); - op.add(Builder::termVectorsMemoryInBytes, JsonpDeserializer.longDeserializer(), "term_vectors_memory_in_bytes"); - op.add(Builder::versionMapMemory, JsonpDeserializer.stringDeserializer(), "version_map_memory"); - op.add(Builder::versionMapMemoryInBytes, JsonpDeserializer.longDeserializer(), "version_map_memory_in_bytes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java deleted file mode 100644 index 14473d8e24..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeResponse.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.ShardsOperationResponseBase; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: indices.forcemerge.Response - -@JsonpDeserializable -public class ForcemergeResponse extends ShardsOperationResponseBase { - // --------------------------------------------------------------------------------------------- - - private ForcemergeResponse(Builder builder) { - super(builder); - - } - - public static ForcemergeResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ForcemergeResponse}. - */ - - public static class Builder extends ShardsOperationResponseBase.AbstractBuilder implements ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ForcemergeResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ForcemergeResponse build() { - _checkSingleUse(); - - return new ForcemergeResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ForcemergeResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ForcemergeResponse::setupForcemergeResponseDeserializer - ); - - protected static void setupForcemergeResponseDeserializer(ObjectDeserializer op) { - ShardsOperationResponseBase.setupShardsOperationResponseBaseDeserializer(op); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java deleted file mode 100644 index 31c8497f7b..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.Collections; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.get_upgrade.Request - -/** - * DEPRECATED Returns a progress status of current upgrade. - * - */ - -public class GetUpgradeRequest extends RequestBase { - @Nullable - private final String index; - - // --------------------------------------------------------------------------------------------- - - private GetUpgradeRequest(Builder builder) { - - this.index = builder.index; - - } - - public static GetUpgradeRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices - *

- * API name: {@code index} - */ - @Nullable - public final String index() { - return this.index; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetUpgradeRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String index; - - /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices - *

- * API name: {@code index} - */ - public final Builder index(@Nullable String value) { - this.index = value; - return this; - } - - /** - * Builds a {@link GetUpgradeRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetUpgradeRequest build() { - _checkSingleUse(); - - return new GetUpgradeRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_upgrade}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (request.index() != null) propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_upgrade"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_upgrade"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, - SimpleEndpoint.emptyMap(), - false, - GetUpgradeResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java deleted file mode 100644 index a290895165..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeResponse.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.get_upgrade.Response - -@JsonpDeserializable -public class GetUpgradeResponse implements PlainJsonSerializable { - private final List overlapping; - - @Nullable - private final TemplateMapping template; - - // --------------------------------------------------------------------------------------------- - - private GetUpgradeResponse(Builder builder) { - - this.overlapping = ApiTypeHelper.unmodifiable(builder.overlapping); - this.template = builder.template; - - } - - public static GetUpgradeResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Any templates that were superseded by the specified template. - *

- * API name: {@code overlapping} - */ - public final List overlapping() { - return this.overlapping; - } - - /** - * The settings, mappings, and aliases that would be applied to matching - * indices. - *

- * API name: {@code template} - */ - @Nullable - public final TemplateMapping template() { - return this.template; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.overlapping)) { - generator.writeKey("overlapping"); - generator.writeStartArray(); - for (OverlappingIndexTemplate item0 : this.overlapping) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.template != null) { - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetUpgradeResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private List overlapping; - - @Nullable - private TemplateMapping template; - - /** - * Any templates that were superseded by the specified template. - *

- * API name: {@code overlapping} - *

- * Adds all elements of list to overlapping. - */ - public final Builder overlapping(List list) { - this.overlapping = _listAddAll(this.overlapping, list); - return this; - } - - /** - * Any templates that were superseded by the specified template. - *

- * API name: {@code overlapping} - *

- * Adds one or more values to overlapping. - */ - public final Builder overlapping(OverlappingIndexTemplate value, OverlappingIndexTemplate... values) { - this.overlapping = _listAdd(this.overlapping, value, values); - return this; - } - - /** - * Any templates that were superseded by the specified template. - *

- * API name: {@code overlapping} - *

- * Adds a value to overlapping using a builder lambda. - */ - public final Builder overlapping(Function> fn) { - return overlapping(fn.apply(new OverlappingIndexTemplate.Builder()).build()); - } - - /** - * The settings, mappings, and aliases that would be applied to matching - * indices. - *

- * API name: {@code template} - */ - public final Builder template(@Nullable TemplateMapping value) { - this.template = value; - return this; - } - - /** - * The settings, mappings, and aliases that would be applied to matching - * indices. - *

- * API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new TemplateMapping.Builder()).build()); - } - - /** - * Builds a {@link GetUpgradeResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetUpgradeResponse build() { - _checkSingleUse(); - - return new GetUpgradeResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetUpgradeResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetUpgradeResponse::setupGetUpgradeResponseDeserializer - ); - - protected static void setupGetUpgradeResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::overlapping, JsonpDeserializer.arrayDeserializer(OverlappingIndexTemplate._DESERIALIZER), "overlapping"); - op.add(Builder::template, TemplateMapping._DESERIALIZER, "template"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java deleted file mode 100644 index d8a94582ce..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java +++ /dev/null @@ -1,443 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.ExpandWildcard; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.opensearch._types.WaitForActiveShards; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.open.Request - -/** - * Opens an index. - * - */ - -public class OpenRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Deprecated - @Nullable - private final Time masterTimeout; - - @Nullable - private final Time clusterManagerTimeout; - - @Nullable - private final Time timeout; - - @Nullable - private final WaitForActiveShards waitForActiveShards; - - // --------------------------------------------------------------------------------------------- - - private OpenRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.timeout = builder.timeout; - this.waitForActiveShards = builder.waitForActiveShards; - - } - - public static OpenRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - A comma separated list of indices to open - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Deprecated - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Sets the number of active shards to wait for before the operation returns. - *

- * API name: {@code wait_for_active_shards} - */ - @Nullable - public final WaitForActiveShards waitForActiveShards() { - return this.waitForActiveShards; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OpenRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Deprecated - @Nullable - private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - - @Nullable - private Time timeout; - - @Nullable - private WaitForActiveShards waitForActiveShards; - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - A comma separated list of indices to open - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - A comma separated list of indices to open - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Sets the number of active shards to wait for before the operation returns. - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { - this.waitForActiveShards = value; - return this; - } - - /** - * Sets the number of active shards to wait for before the operation returns. - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); - } - - /** - * Builds a {@link OpenRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public OpenRequest build() { - _checkSingleUse(); - - return new OpenRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.open}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_open"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.clusterManagerTimeout != null) { - params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, - SimpleEndpoint.emptyMap(), - false, - OpenResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenResponse.java deleted file mode 100644 index fa348fb709..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenResponse.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: indices.open.Response - -@JsonpDeserializable -public class OpenResponse extends AcknowledgedResponseBase { - private final boolean shardsAcknowledged; - - // --------------------------------------------------------------------------------------------- - - private OpenResponse(Builder builder) { - super(builder); - - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - - } - - public static OpenResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OpenResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { - private Boolean shardsAcknowledged; - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link OpenResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public OpenResponse build() { - _checkSingleUse(); - - return new OpenResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link OpenResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - OpenResponse::setupOpenResponseDeserializer - ); - - protected static void setupOpenResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java index 0e81568856..08cb96de58 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java @@ -61,157 +61,6 @@ public OpenSearchIndicesAsyncClient withTransportOptions(@Nullable TransportOpti return new OpenSearchIndicesAsyncClient(this.transport, transportOptions); } - // ----- Endpoint: indices.clone - - /** - * Clones an index - * - */ - - public CompletableFuture clone(CloneIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneIndexRequest, - CloneIndexResponse, - ErrorResponse>) CloneIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Clones an index - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneIndexRequest} - * - */ - - public final CompletableFuture clone(Function> fn) - throws IOException, OpenSearchException { - return clone(fn.apply(new CloneIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.close - - /** - * Closes an index. - * - * - */ - - public CompletableFuture close(CloseIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloseIndexRequest, - CloseIndexResponse, - ErrorResponse>) CloseIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Closes an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloseIndexRequest} - * - */ - - public final CompletableFuture close(Function> fn) - throws IOException, OpenSearchException { - return close(fn.apply(new CloseIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.flush - - /** - * Performs the flush operation on one or more indices. - * - * - */ - - public CompletableFuture flush(FlushRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - FlushRequest, - FlushResponse, - ErrorResponse>) FlushRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Performs the flush operation on one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link FlushRequest} - * - */ - - public final CompletableFuture flush(Function> fn) throws IOException, - OpenSearchException { - return flush(fn.apply(new FlushRequest.Builder()).build()); - } - - /** - * Performs the flush operation on one or more indices. - * - * - */ - - public CompletableFuture flush() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new FlushRequest.Builder().build(), FlushRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.forcemerge - - /** - * Performs the force merge operation on one or more indices. - * - * - */ - - public CompletableFuture forcemerge(ForcemergeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ForcemergeRequest, - ForcemergeResponse, - ErrorResponse>) ForcemergeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Performs the force merge operation on one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ForcemergeRequest} - * - */ - - public final CompletableFuture forcemerge(Function> fn) - throws IOException, OpenSearchException { - return forcemerge(fn.apply(new ForcemergeRequest.Builder()).build()); - } - - /** - * Performs the force merge operation on one or more indices. - * - * - */ - - public CompletableFuture forcemerge() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ForcemergeRequest.Builder().build(), - ForcemergeRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.get_field_mapping /** @@ -245,524 +94,4 @@ public final CompletableFuture getFieldMapping( ) throws IOException, OpenSearchException { return getFieldMapping(fn.apply(new GetFieldMappingRequest.Builder()).build()); } - - // ----- Endpoint: indices.get_upgrade - - /** - * DEPRECATED Returns a progress status of current upgrade. - * - * - */ - - public CompletableFuture getUpgrade(GetUpgradeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetUpgradeRequest, - GetUpgradeResponse, - ErrorResponse>) GetUpgradeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * DEPRECATED Returns a progress status of current upgrade. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetUpgradeRequest} - * - */ - - public final CompletableFuture getUpgrade(Function> fn) - throws IOException, OpenSearchException { - return getUpgrade(fn.apply(new GetUpgradeRequest.Builder()).build()); - } - - /** - * DEPRECATED Returns a progress status of current upgrade. - * - * - */ - - public CompletableFuture getUpgrade() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetUpgradeRequest.Builder().build(), - GetUpgradeRequest._ENDPOINT, - this.transportOptions - ); - } - - // ----- Endpoint: indices.open - - /** - * Opens an index. - * - * - */ - - public CompletableFuture open(OpenRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - OpenRequest, - OpenResponse, - ErrorResponse>) OpenRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Opens an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link OpenRequest} - * - */ - - public final CompletableFuture open(Function> fn) throws IOException, - OpenSearchException { - return open(fn.apply(new OpenRequest.Builder()).build()); - } - - // ----- Endpoint: indices.recovery - - /** - * Returns information about ongoing index shard recoveries. - * - * - */ - - public CompletableFuture recovery(RecoveryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RecoveryRequest, - RecoveryResponse, - ErrorResponse>) RecoveryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about ongoing index shard recoveries. - * - * @param fn - * a function that initializes a builder to create the - * {@link RecoveryRequest} - * - */ - - public final CompletableFuture recovery(Function> fn) - throws IOException, OpenSearchException { - return recovery(fn.apply(new RecoveryRequest.Builder()).build()); - } - - /** - * Returns information about ongoing index shard recoveries. - * - * - */ - - public CompletableFuture recovery() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new RecoveryRequest.Builder().build(), RecoveryRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.refresh - - /** - * Performs the refresh operation in one or more indices. - * - * - */ - - public CompletableFuture refresh(RefreshRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RefreshRequest, - RefreshResponse, - ErrorResponse>) RefreshRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Performs the refresh operation in one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link RefreshRequest} - * - */ - - public final CompletableFuture refresh(Function> fn) - throws IOException, OpenSearchException { - return refresh(fn.apply(new RefreshRequest.Builder()).build()); - } - - /** - * Performs the refresh operation in one or more indices. - * - * - */ - - public CompletableFuture refresh() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new RefreshRequest.Builder().build(), RefreshRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.resolve_index - - /** - * Returns information about any matching indices, aliases, and data streams - * - * - */ - - public CompletableFuture resolveIndex(ResolveIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ResolveIndexRequest, - ResolveIndexResponse, - ErrorResponse>) ResolveIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about any matching indices, aliases, and data streams - * - * @param fn - * a function that initializes a builder to create the - * {@link ResolveIndexRequest} - * - */ - - public final CompletableFuture resolveIndex( - Function> fn - ) throws IOException, OpenSearchException { - return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.rollover - - /** - * Updates an alias to point to a new index when the existing index is - * considered to be too large or too old. - * - * - */ - - public CompletableFuture rollover(RolloverRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RolloverRequest, - RolloverResponse, - ErrorResponse>) RolloverRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Updates an alias to point to a new index when the existing index is - * considered to be too large or too old. - * - * @param fn - * a function that initializes a builder to create the - * {@link RolloverRequest} - * - */ - - public final CompletableFuture rollover(Function> fn) - throws IOException, OpenSearchException { - return rollover(fn.apply(new RolloverRequest.Builder()).build()); - } - - // ----- Endpoint: indices.segments - - /** - * Provides low-level information about segments in a Lucene index. - * - * - */ - - public CompletableFuture segments(SegmentsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SegmentsRequest, - SegmentsResponse, - ErrorResponse>) SegmentsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Provides low-level information about segments in a Lucene index. - * - * @param fn - * a function that initializes a builder to create the - * {@link SegmentsRequest} - * - */ - - public final CompletableFuture segments(Function> fn) - throws IOException, OpenSearchException { - return segments(fn.apply(new SegmentsRequest.Builder()).build()); - } - - /** - * Provides low-level information about segments in a Lucene index. - * - * - */ - - public CompletableFuture segments() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new SegmentsRequest.Builder().build(), SegmentsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.shard_stores - - /** - * Provides store information for shard copies of indices. - * - * - */ - - public CompletableFuture shardStores(ShardStoresRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ShardStoresRequest, - ShardStoresResponse, - ErrorResponse>) ShardStoresRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Provides store information for shard copies of indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ShardStoresRequest} - * - */ - - public final CompletableFuture shardStores( - Function> fn - ) throws IOException, OpenSearchException { - return shardStores(fn.apply(new ShardStoresRequest.Builder()).build()); - } - - /** - * Provides store information for shard copies of indices. - * - * - */ - - public CompletableFuture shardStores() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ShardStoresRequest.Builder().build(), - ShardStoresRequest._ENDPOINT, - this.transportOptions - ); - } - - // ----- Endpoint: indices.shrink - - /** - * Allow to shrink an existing index into a new index with fewer primary shards. - * - * - */ - - public CompletableFuture shrink(ShrinkRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ShrinkRequest, - ShrinkResponse, - ErrorResponse>) ShrinkRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allow to shrink an existing index into a new index with fewer primary shards. - * - * @param fn - * a function that initializes a builder to create the - * {@link ShrinkRequest} - * - */ - - public final CompletableFuture shrink(Function> fn) - throws IOException, OpenSearchException { - return shrink(fn.apply(new ShrinkRequest.Builder()).build()); - } - - // ----- Endpoint: indices.split - - /** - * Allows you to split an existing index into a new index with more primary - * shards. - * - * - */ - - public CompletableFuture split(SplitRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SplitRequest, - SplitResponse, - ErrorResponse>) SplitRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows you to split an existing index into a new index with more primary - * shards. - * - * @param fn - * a function that initializes a builder to create the - * {@link SplitRequest} - * - */ - - public final CompletableFuture split(Function> fn) throws IOException, - OpenSearchException { - return split(fn.apply(new SplitRequest.Builder()).build()); - } - - // ----- Endpoint: indices.stats - - /** - * Provides statistics on operations happening in an index. - * - * - */ - - public CompletableFuture stats(IndicesStatsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - IndicesStatsRequest, - IndicesStatsResponse, - ErrorResponse>) IndicesStatsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Provides statistics on operations happening in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndicesStatsRequest} - * - */ - - public final CompletableFuture stats(Function> fn) - throws IOException, OpenSearchException { - return stats(fn.apply(new IndicesStatsRequest.Builder()).build()); - } - - /** - * Provides statistics on operations happening in an index. - * - * - */ - - public CompletableFuture stats() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new IndicesStatsRequest.Builder().build(), - IndicesStatsRequest._ENDPOINT, - this.transportOptions - ); - } - - // ----- Endpoint: indices.upgrade - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * - */ - - public CompletableFuture upgrade(UpgradeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - UpgradeRequest, - UpgradeResponse, - ErrorResponse>) UpgradeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpgradeRequest} - * - */ - - public final CompletableFuture upgrade(Function> fn) - throws IOException, OpenSearchException { - return upgrade(fn.apply(new UpgradeRequest.Builder()).build()); - } - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * - */ - - public CompletableFuture upgrade() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new UpgradeRequest.Builder().build(), UpgradeRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.validate_query - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * - */ - - public CompletableFuture validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ValidateQueryRequest, - ValidateQueryResponse, - ErrorResponse>) ValidateQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * @param fn - * a function that initializes a builder to create the - * {@link ValidateQueryRequest} - * - */ - - public final CompletableFuture validateQuery( - Function> fn - ) throws IOException, OpenSearchException { - return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); - } - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * - */ - - public CompletableFuture validateQuery() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ValidateQueryRequest.Builder().build(), - ValidateQueryRequest._ENDPOINT, - this.transportOptions - ); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java index c75eb2eef6..a3ab9b4811 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java @@ -60,153 +60,6 @@ public OpenSearchIndicesClient withTransportOptions(@Nullable TransportOptions t return new OpenSearchIndicesClient(this.transport, transportOptions); } - // ----- Endpoint: indices.clone - - /** - * Clones an index - * - */ - - public CloneIndexResponse clone(CloneIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneIndexRequest, - CloneIndexResponse, - ErrorResponse>) CloneIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Clones an index - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneIndexRequest} - * - */ - - public final CloneIndexResponse clone(Function> fn) throws IOException, - OpenSearchException { - return clone(fn.apply(new CloneIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.close - - /** - * Closes an index. - * - * - */ - - public CloseIndexResponse close(CloseIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloseIndexRequest, - CloseIndexResponse, - ErrorResponse>) CloseIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Closes an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloseIndexRequest} - * - */ - - public final CloseIndexResponse close(Function> fn) throws IOException, - OpenSearchException { - return close(fn.apply(new CloseIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.flush - - /** - * Performs the flush operation on one or more indices. - * - * - */ - - public FlushResponse flush(FlushRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - FlushRequest, - FlushResponse, - ErrorResponse>) FlushRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Performs the flush operation on one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link FlushRequest} - * - */ - - public final FlushResponse flush(Function> fn) throws IOException, - OpenSearchException { - return flush(fn.apply(new FlushRequest.Builder()).build()); - } - - /** - * Performs the flush operation on one or more indices. - * - * - */ - - public FlushResponse flush() throws IOException, OpenSearchException { - return this.transport.performRequest(new FlushRequest.Builder().build(), FlushRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.forcemerge - - /** - * Performs the force merge operation on one or more indices. - * - * - */ - - public ForcemergeResponse forcemerge(ForcemergeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ForcemergeRequest, - ForcemergeResponse, - ErrorResponse>) ForcemergeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Performs the force merge operation on one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ForcemergeRequest} - * - */ - - public final ForcemergeResponse forcemerge(Function> fn) throws IOException, - OpenSearchException { - return forcemerge(fn.apply(new ForcemergeRequest.Builder()).build()); - } - - /** - * Performs the force merge operation on one or more indices. - * - * - */ - - public ForcemergeResponse forcemerge() throws IOException, OpenSearchException { - return this.transport.performRequest(new ForcemergeRequest.Builder().build(), ForcemergeRequest._ENDPOINT, this.transportOptions); - } - // ----- Endpoint: indices.get_field_mapping /** @@ -238,512 +91,4 @@ public final GetFieldMappingResponse getFieldMapping(Function endpoint = (JsonEndpoint< - GetUpgradeRequest, - GetUpgradeResponse, - ErrorResponse>) GetUpgradeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * DEPRECATED Returns a progress status of current upgrade. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetUpgradeRequest} - * - */ - - public final GetUpgradeResponse getUpgrade(Function> fn) throws IOException, - OpenSearchException { - return getUpgrade(fn.apply(new GetUpgradeRequest.Builder()).build()); - } - - /** - * DEPRECATED Returns a progress status of current upgrade. - * - * - */ - - public GetUpgradeResponse getUpgrade() throws IOException, OpenSearchException { - return this.transport.performRequest(new GetUpgradeRequest.Builder().build(), GetUpgradeRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.open - - /** - * Opens an index. - * - * - */ - - public OpenResponse open(OpenRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - OpenRequest, - OpenResponse, - ErrorResponse>) OpenRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Opens an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link OpenRequest} - * - */ - - public final OpenResponse open(Function> fn) throws IOException, OpenSearchException { - return open(fn.apply(new OpenRequest.Builder()).build()); - } - - // ----- Endpoint: indices.recovery - - /** - * Returns information about ongoing index shard recoveries. - * - * - */ - - public RecoveryResponse recovery(RecoveryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RecoveryRequest, - RecoveryResponse, - ErrorResponse>) RecoveryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about ongoing index shard recoveries. - * - * @param fn - * a function that initializes a builder to create the - * {@link RecoveryRequest} - * - */ - - public final RecoveryResponse recovery(Function> fn) throws IOException, - OpenSearchException { - return recovery(fn.apply(new RecoveryRequest.Builder()).build()); - } - - /** - * Returns information about ongoing index shard recoveries. - * - * - */ - - public RecoveryResponse recovery() throws IOException, OpenSearchException { - return this.transport.performRequest(new RecoveryRequest.Builder().build(), RecoveryRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.refresh - - /** - * Performs the refresh operation in one or more indices. - * - * - */ - - public RefreshResponse refresh(RefreshRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RefreshRequest, - RefreshResponse, - ErrorResponse>) RefreshRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Performs the refresh operation in one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link RefreshRequest} - * - */ - - public final RefreshResponse refresh(Function> fn) throws IOException, - OpenSearchException { - return refresh(fn.apply(new RefreshRequest.Builder()).build()); - } - - /** - * Performs the refresh operation in one or more indices. - * - * - */ - - public RefreshResponse refresh() throws IOException, OpenSearchException { - return this.transport.performRequest(new RefreshRequest.Builder().build(), RefreshRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.resolve_index - - /** - * Returns information about any matching indices, aliases, and data streams - * - * - */ - - public ResolveIndexResponse resolveIndex(ResolveIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ResolveIndexRequest, - ResolveIndexResponse, - ErrorResponse>) ResolveIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about any matching indices, aliases, and data streams - * - * @param fn - * a function that initializes a builder to create the - * {@link ResolveIndexRequest} - * - */ - - public final ResolveIndexResponse resolveIndex(Function> fn) - throws IOException, OpenSearchException { - return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.rollover - - /** - * Updates an alias to point to a new index when the existing index is - * considered to be too large or too old. - * - * - */ - - public RolloverResponse rollover(RolloverRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RolloverRequest, - RolloverResponse, - ErrorResponse>) RolloverRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Updates an alias to point to a new index when the existing index is - * considered to be too large or too old. - * - * @param fn - * a function that initializes a builder to create the - * {@link RolloverRequest} - * - */ - - public final RolloverResponse rollover(Function> fn) throws IOException, - OpenSearchException { - return rollover(fn.apply(new RolloverRequest.Builder()).build()); - } - - // ----- Endpoint: indices.segments - - /** - * Provides low-level information about segments in a Lucene index. - * - * - */ - - public SegmentsResponse segments(SegmentsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SegmentsRequest, - SegmentsResponse, - ErrorResponse>) SegmentsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Provides low-level information about segments in a Lucene index. - * - * @param fn - * a function that initializes a builder to create the - * {@link SegmentsRequest} - * - */ - - public final SegmentsResponse segments(Function> fn) throws IOException, - OpenSearchException { - return segments(fn.apply(new SegmentsRequest.Builder()).build()); - } - - /** - * Provides low-level information about segments in a Lucene index. - * - * - */ - - public SegmentsResponse segments() throws IOException, OpenSearchException { - return this.transport.performRequest(new SegmentsRequest.Builder().build(), SegmentsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.shard_stores - - /** - * Provides store information for shard copies of indices. - * - * - */ - - public ShardStoresResponse shardStores(ShardStoresRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ShardStoresRequest, - ShardStoresResponse, - ErrorResponse>) ShardStoresRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Provides store information for shard copies of indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ShardStoresRequest} - * - */ - - public final ShardStoresResponse shardStores(Function> fn) - throws IOException, OpenSearchException { - return shardStores(fn.apply(new ShardStoresRequest.Builder()).build()); - } - - /** - * Provides store information for shard copies of indices. - * - * - */ - - public ShardStoresResponse shardStores() throws IOException, OpenSearchException { - return this.transport.performRequest(new ShardStoresRequest.Builder().build(), ShardStoresRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.shrink - - /** - * Allow to shrink an existing index into a new index with fewer primary shards. - * - * - */ - - public ShrinkResponse shrink(ShrinkRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ShrinkRequest, - ShrinkResponse, - ErrorResponse>) ShrinkRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allow to shrink an existing index into a new index with fewer primary shards. - * - * @param fn - * a function that initializes a builder to create the - * {@link ShrinkRequest} - * - */ - - public final ShrinkResponse shrink(Function> fn) throws IOException, - OpenSearchException { - return shrink(fn.apply(new ShrinkRequest.Builder()).build()); - } - - // ----- Endpoint: indices.split - - /** - * Allows you to split an existing index into a new index with more primary - * shards. - * - * - */ - - public SplitResponse split(SplitRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SplitRequest, - SplitResponse, - ErrorResponse>) SplitRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows you to split an existing index into a new index with more primary - * shards. - * - * @param fn - * a function that initializes a builder to create the - * {@link SplitRequest} - * - */ - - public final SplitResponse split(Function> fn) throws IOException, - OpenSearchException { - return split(fn.apply(new SplitRequest.Builder()).build()); - } - - // ----- Endpoint: indices.stats - - /** - * Provides statistics on operations happening in an index. - * - * - */ - - public IndicesStatsResponse stats(IndicesStatsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - IndicesStatsRequest, - IndicesStatsResponse, - ErrorResponse>) IndicesStatsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Provides statistics on operations happening in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndicesStatsRequest} - * - */ - - public final IndicesStatsResponse stats(Function> fn) - throws IOException, OpenSearchException { - return stats(fn.apply(new IndicesStatsRequest.Builder()).build()); - } - - /** - * Provides statistics on operations happening in an index. - * - * - */ - - public IndicesStatsResponse stats() throws IOException, OpenSearchException { - return this.transport.performRequest( - new IndicesStatsRequest.Builder().build(), - IndicesStatsRequest._ENDPOINT, - this.transportOptions - ); - } - - // ----- Endpoint: indices.upgrade - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * - */ - - public UpgradeResponse upgrade(UpgradeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - UpgradeRequest, - UpgradeResponse, - ErrorResponse>) UpgradeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpgradeRequest} - * - */ - - public final UpgradeResponse upgrade(Function> fn) throws IOException, - OpenSearchException { - return upgrade(fn.apply(new UpgradeRequest.Builder()).build()); - } - - /** - * DEPRECATED Upgrades to the current version of Lucene. - * - * - */ - - public UpgradeResponse upgrade() throws IOException, OpenSearchException { - return this.transport.performRequest(new UpgradeRequest.Builder().build(), UpgradeRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.validate_query - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * - */ - - public ValidateQueryResponse validateQuery(ValidateQueryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ValidateQueryRequest, - ValidateQueryResponse, - ErrorResponse>) ValidateQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * @param fn - * a function that initializes a builder to create the - * {@link ValidateQueryRequest} - * - */ - - public final ValidateQueryResponse validateQuery(Function> fn) - throws IOException, OpenSearchException { - return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); - } - - /** - * Allows a user to validate a potentially expensive query without executing it. - * - * - */ - - public ValidateQueryResponse validateQuery() throws IOException, OpenSearchException { - return this.transport.performRequest( - new ValidateQueryRequest.Builder().build(), - ValidateQueryRequest._ENDPOINT, - this.transportOptions - ); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OverlappingIndexTemplate.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OverlappingIndexTemplate.java deleted file mode 100644 index 2ba73f5aa9..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OverlappingIndexTemplate.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices._types.OverlappingIndexTemplate - -@JsonpDeserializable -public class OverlappingIndexTemplate implements PlainJsonSerializable { - private final String name; - - private final List indexPatterns; - - // --------------------------------------------------------------------------------------------- - - private OverlappingIndexTemplate(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); - - } - - public static OverlappingIndexTemplate of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OverlappingIndexTemplate}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - @Nullable - private List indexPatterns; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, values); - return this; - } - - /** - * Builds a {@link OverlappingIndexTemplate}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public OverlappingIndexTemplate build() { - _checkSingleUse(); - - return new OverlappingIndexTemplate(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link OverlappingIndexTemplate} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - OverlappingIndexTemplate::setupOverlappingIndexTemplateDeserializer - ); - - protected static void setupOverlappingIndexTemplateDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index_patterns"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java deleted file mode 100644 index 71d8b706cd..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/UpgradeResponse.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: indices.upgrade.Response - -@JsonpDeserializable -public class UpgradeResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private UpgradeResponse(Builder builder) { - super(builder); - - } - - public static UpgradeResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link UpgradeResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link UpgradeResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public UpgradeResponse build() { - _checkSingleUse(); - - return new UpgradeResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link UpgradeResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - UpgradeResponse::setupUpgradeResponseDeserializer - ); - - protected static void setupUpgradeResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java deleted file mode 100644 index 1918f464b6..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/recovery/RecoveryStartStatus.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.recovery; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.recovery.RecoveryStartStatus - -@JsonpDeserializable -public class RecoveryStartStatus implements PlainJsonSerializable { - private final long checkIndexTime; - - private final String totalTimeInMillis; - - // --------------------------------------------------------------------------------------------- - - private RecoveryStartStatus(Builder builder) { - - this.checkIndexTime = ApiTypeHelper.requireNonNull(builder.checkIndexTime, this, "checkIndexTime"); - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - - } - - public static RecoveryStartStatus of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code check_index_time} - */ - public final long checkIndexTime() { - return this.checkIndexTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final String totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("check_index_time"); - generator.write(this.checkIndexTime); - - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RecoveryStartStatus}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long checkIndexTime; - - private String totalTimeInMillis; - - /** - * Required - API name: {@code check_index_time} - */ - public final Builder checkIndexTime(long value) { - this.checkIndexTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(String value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link RecoveryStartStatus}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RecoveryStartStatus build() { - _checkSingleUse(); - - return new RecoveryStartStatus(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RecoveryStartStatus} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - RecoveryStartStatus::setupRecoveryStartStatusDeserializer - ); - - protected static void setupRecoveryStartStatusDeserializer(ObjectDeserializer op) { - - op.add(Builder::checkIndexTime, JsonpDeserializer.longDeserializer(), "check_index_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMapping.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMapping.java deleted file mode 100644 index 0869f58eaf..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMapping.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.rollover; - -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; -import org.opensearch.client.json.UnionDeserializer; -import org.opensearch.client.opensearch._types.mapping.TypeMapping; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; -import org.opensearch.client.util.TaggedUnion; -import org.opensearch.client.util.TaggedUnionUtils; - -// typedef: indices.rollover.IndexRolloverMapping - -@JsonpDeserializable -public class IndexRolloverMapping implements TaggedUnion, JsonpSerializable { - - public enum Kind { - ByType, - Single - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private IndexRolloverMapping(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private IndexRolloverMapping(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static IndexRolloverMapping of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code by_type}? - */ - public boolean isByType() { - return _kind == Kind.ByType; - } - - /** - * Get the {@code by_type} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code by_type} kind. - */ - public Map byType() { - return TaggedUnionUtils.get(this, Kind.ByType); - } - - /** - * Is this variant instance of kind {@code single}? - */ - public boolean isSingle() { - return _kind == Kind.Single; - } - - /** - * Get the {@code single} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code single} kind. - */ - public TypeMapping single() { - return TaggedUnionUtils.get(this, Kind.Single); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case ByType: - generator.writeStartObject(); - for (Map.Entry item0 : ((Map) this._value).entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - break; - } - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder byType(Map v) { - this._kind = Kind.ByType; - this._value = v; - return this; - } - - public ObjectBuilder single(TypeMapping v) { - this._kind = Kind.Single; - this._value = v; - return this; - } - - public ObjectBuilder single(Function> fn) { - return this.single(fn.apply(new TypeMapping.Builder()).build()); - } - - public IndexRolloverMapping build() { - _checkSingleUse(); - return new IndexRolloverMapping(this); - } - - } - - private static JsonpDeserializer buildIndexRolloverMappingDeserializer() { - return new UnionDeserializer.Builder(IndexRolloverMapping::new, false).addMember( - Kind.ByType, - JsonpDeserializer.stringMapDeserializer(TypeMapping._DESERIALIZER) - ).addMember(Kind.Single, TypeMapping._DESERIALIZER).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( - IndexRolloverMapping::buildIndexRolloverMappingDeserializer - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMappingBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMappingBuilders.java deleted file mode 100644 index aafd1149b2..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/IndexRolloverMappingBuilders.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.rollover; - -import org.opensearch.client.opensearch._types.mapping.TypeMapping; - -/** - * Builders for {@link IndexRolloverMapping} variants. - *

- * Variants by_type are not available here as they don't have a - * dedicated class. Use {@link IndexRolloverMapping}'s builder for these. - * - */ -public class IndexRolloverMappingBuilders { - private IndexRolloverMappingBuilders() {} - - /** - * Creates a builder for the {@link TypeMapping single} - * {@code IndexRolloverMapping} variant. - */ - public static TypeMapping.Builder single() { - return new TypeMapping.Builder(); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java deleted file mode 100644 index c08d56203f..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/rollover/RolloverConditions.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.rollover; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.rollover.RolloverConditions - -@JsonpDeserializable -public class RolloverConditions implements PlainJsonSerializable { - @Nullable - private final Time maxAge; - - @Nullable - private final Long maxDocs; - - @Nullable - private final String maxSize; - - @Nullable - private final String maxPrimaryShardSize; - - // --------------------------------------------------------------------------------------------- - - private RolloverConditions(Builder builder) { - - this.maxAge = builder.maxAge; - this.maxDocs = builder.maxDocs; - this.maxSize = builder.maxSize; - this.maxPrimaryShardSize = builder.maxPrimaryShardSize; - - } - - public static RolloverConditions of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code max_age} - */ - @Nullable - public final Time maxAge() { - return this.maxAge; - } - - /** - * API name: {@code max_docs} - */ - @Nullable - public final Long maxDocs() { - return this.maxDocs; - } - - /** - * API name: {@code max_size} - */ - @Nullable - public final String maxSize() { - return this.maxSize; - } - - /** - * API name: {@code max_primary_shard_size} - */ - @Nullable - public final String maxPrimaryShardSize() { - return this.maxPrimaryShardSize; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.maxAge != null) { - generator.writeKey("max_age"); - this.maxAge.serialize(generator, mapper); - - } - if (this.maxDocs != null) { - generator.writeKey("max_docs"); - generator.write(this.maxDocs); - - } - if (this.maxSize != null) { - generator.writeKey("max_size"); - generator.write(this.maxSize); - - } - if (this.maxPrimaryShardSize != null) { - generator.writeKey("max_primary_shard_size"); - generator.write(this.maxPrimaryShardSize); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RolloverConditions}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Time maxAge; - - @Nullable - private Long maxDocs; - - @Nullable - private String maxSize; - - @Nullable - private String maxPrimaryShardSize; - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(@Nullable Time value) { - this.maxAge = value; - return this; - } - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(Function> fn) { - return this.maxAge(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_docs} - */ - public final Builder maxDocs(@Nullable Long value) { - this.maxDocs = value; - return this; - } - - /** - * API name: {@code max_size} - */ - public final Builder maxSize(@Nullable String value) { - this.maxSize = value; - return this; - } - - /** - * API name: {@code max_primary_shard_size} - */ - public final Builder maxPrimaryShardSize(@Nullable String value) { - this.maxPrimaryShardSize = value; - return this; - } - - /** - * Builds a {@link RolloverConditions}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RolloverConditions build() { - _checkSingleUse(); - - return new RolloverConditions(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RolloverConditions} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - RolloverConditions::setupRolloverConditionsDeserializer - ); - - protected static void setupRolloverConditionsDeserializer(ObjectDeserializer op) { - - op.add(Builder::maxAge, Time._DESERIALIZER, "max_age"); - op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); - op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); - op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java deleted file mode 100644 index 79cdbcd993..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/IndexStats.java +++ /dev/null @@ -1,884 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.BulkStats; -import org.opensearch.client.opensearch._types.CompletionStats; -import org.opensearch.client.opensearch._types.DocStats; -import org.opensearch.client.opensearch._types.FielddataStats; -import org.opensearch.client.opensearch._types.FlushStats; -import org.opensearch.client.opensearch._types.GetStats; -import org.opensearch.client.opensearch._types.IndexingStats; -import org.opensearch.client.opensearch._types.MergesStats; -import org.opensearch.client.opensearch._types.QueryCacheStats; -import org.opensearch.client.opensearch._types.RecoveryStats; -import org.opensearch.client.opensearch._types.RefreshStats; -import org.opensearch.client.opensearch._types.RequestCacheStats; -import org.opensearch.client.opensearch._types.SearchStats; -import org.opensearch.client.opensearch._types.SegmentsStats; -import org.opensearch.client.opensearch._types.StoreStats; -import org.opensearch.client.opensearch._types.TranslogStats; -import org.opensearch.client.opensearch._types.WarmerStats; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.stats.IndexStats - -@JsonpDeserializable -public class IndexStats implements PlainJsonSerializable { - @Nullable - private final CompletionStats completion; - - @Nullable - private final DocStats docs; - - @Nullable - private final FielddataStats fielddata; - - @Nullable - private final FlushStats flush; - - @Nullable - private final GetStats get; - - @Nullable - private final IndexingStats indexing; - - @Nullable - private final MergesStats merges; - - @Nullable - private final QueryCacheStats queryCache; - - @Nullable - private final RecoveryStats recovery; - - @Nullable - private final RefreshStats refresh; - - @Nullable - private final RequestCacheStats requestCache; - - @Nullable - private final SearchStats search; - - @Nullable - private final SegmentsStats segments; - - @Nullable - private final StoreStats store; - - @Nullable - private final TranslogStats translog; - - @Nullable - private final WarmerStats warmer; - - @Nullable - private final BulkStats bulk; - - @Nullable - private final ShardsTotalStats shards; - - // --------------------------------------------------------------------------------------------- - - private IndexStats(Builder builder) { - - this.completion = builder.completion; - this.docs = builder.docs; - this.fielddata = builder.fielddata; - this.flush = builder.flush; - this.get = builder.get; - this.indexing = builder.indexing; - this.merges = builder.merges; - this.queryCache = builder.queryCache; - this.recovery = builder.recovery; - this.refresh = builder.refresh; - this.requestCache = builder.requestCache; - this.search = builder.search; - this.segments = builder.segments; - this.store = builder.store; - this.translog = builder.translog; - this.warmer = builder.warmer; - this.bulk = builder.bulk; - this.shards = builder.shards; - - } - - public static IndexStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Contains statistics about completions across all shards assigned to the node. - *

- * API name: {@code completion} - */ - @Nullable - public final CompletionStats completion() { - return this.completion; - } - - /** - * Contains statistics about documents across all primary shards assigned to the - * node. - *

- * API name: {@code docs} - */ - @Nullable - public final DocStats docs() { - return this.docs; - } - - /** - * Contains statistics about the field data cache across all shards assigned to - * the node. - *

- * API name: {@code fielddata} - */ - @Nullable - public final FielddataStats fielddata() { - return this.fielddata; - } - - /** - * Contains statistics about flush operations for the node. - *

- * API name: {@code flush} - */ - @Nullable - public final FlushStats flush() { - return this.flush; - } - - /** - * Contains statistics about get operations for the node. - *

- * API name: {@code get} - */ - @Nullable - public final GetStats get() { - return this.get; - } - - /** - * Contains statistics about indexing operations for the node. - *

- * API name: {@code indexing} - */ - @Nullable - public final IndexingStats indexing() { - return this.indexing; - } - - /** - * Contains statistics about merge operations for the node. - *

- * API name: {@code merges} - */ - @Nullable - public final MergesStats merges() { - return this.merges; - } - - /** - * Contains statistics about the query cache across all shards assigned to the - * node. - *

- * API name: {@code query_cache} - */ - @Nullable - public final QueryCacheStats queryCache() { - return this.queryCache; - } - - /** - * Contains statistics about recovery operations for the node. - *

- * API name: {@code recovery} - */ - @Nullable - public final RecoveryStats recovery() { - return this.recovery; - } - - /** - * Contains statistics about refresh operations for the node. - *

- * API name: {@code refresh} - */ - @Nullable - public final RefreshStats refresh() { - return this.refresh; - } - - /** - * Contains statistics about the request cache across all shards assigned to the - * node. - *

- * API name: {@code request_cache} - */ - @Nullable - public final RequestCacheStats requestCache() { - return this.requestCache; - } - - /** - * Contains statistics about search operations for the node. - *

- * API name: {@code search} - */ - @Nullable - public final SearchStats search() { - return this.search; - } - - /** - * Contains statistics about segments across all shards assigned to the node. - *

- * API name: {@code segments} - */ - @Nullable - public final SegmentsStats segments() { - return this.segments; - } - - /** - * Contains statistics about the size of shards assigned to the node. - *

- * API name: {@code store} - */ - @Nullable - public final StoreStats store() { - return this.store; - } - - /** - * Contains statistics about transaction log operations for the node. - *

- * API name: {@code translog} - */ - @Nullable - public final TranslogStats translog() { - return this.translog; - } - - /** - * Contains statistics about index warming operations for the node. - *

- * API name: {@code warmer} - */ - @Nullable - public final WarmerStats warmer() { - return this.warmer; - } - - /** - * API name: {@code bulk} - */ - @Nullable - public final BulkStats bulk() { - return this.bulk; - } - - /** - * API name: {@code shards} - */ - @Nullable - public final ShardsTotalStats shards() { - return this.shards; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.completion != null) { - generator.writeKey("completion"); - this.completion.serialize(generator, mapper); - - } - if (this.docs != null) { - generator.writeKey("docs"); - this.docs.serialize(generator, mapper); - - } - if (this.fielddata != null) { - generator.writeKey("fielddata"); - this.fielddata.serialize(generator, mapper); - - } - if (this.flush != null) { - generator.writeKey("flush"); - this.flush.serialize(generator, mapper); - - } - if (this.get != null) { - generator.writeKey("get"); - this.get.serialize(generator, mapper); - - } - if (this.indexing != null) { - generator.writeKey("indexing"); - this.indexing.serialize(generator, mapper); - - } - if (this.merges != null) { - generator.writeKey("merges"); - this.merges.serialize(generator, mapper); - - } - if (this.queryCache != null) { - generator.writeKey("query_cache"); - this.queryCache.serialize(generator, mapper); - - } - if (this.recovery != null) { - generator.writeKey("recovery"); - this.recovery.serialize(generator, mapper); - - } - if (this.refresh != null) { - generator.writeKey("refresh"); - this.refresh.serialize(generator, mapper); - - } - if (this.requestCache != null) { - generator.writeKey("request_cache"); - this.requestCache.serialize(generator, mapper); - - } - if (this.search != null) { - generator.writeKey("search"); - this.search.serialize(generator, mapper); - - } - if (this.segments != null) { - generator.writeKey("segments"); - this.segments.serialize(generator, mapper); - - } - if (this.store != null) { - generator.writeKey("store"); - this.store.serialize(generator, mapper); - - } - if (this.translog != null) { - generator.writeKey("translog"); - this.translog.serialize(generator, mapper); - - } - if (this.warmer != null) { - generator.writeKey("warmer"); - this.warmer.serialize(generator, mapper); - - } - if (this.bulk != null) { - generator.writeKey("bulk"); - this.bulk.serialize(generator, mapper); - - } - if (this.shards != null) { - generator.writeKey("shards"); - this.shards.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private CompletionStats completion; - - @Nullable - private DocStats docs; - - @Nullable - private FielddataStats fielddata; - - @Nullable - private FlushStats flush; - - @Nullable - private GetStats get; - - @Nullable - private IndexingStats indexing; - - @Nullable - private MergesStats merges; - - @Nullable - private QueryCacheStats queryCache; - - @Nullable - private RecoveryStats recovery; - - @Nullable - private RefreshStats refresh; - - @Nullable - private RequestCacheStats requestCache; - - @Nullable - private SearchStats search; - - @Nullable - private SegmentsStats segments; - - @Nullable - private StoreStats store; - - @Nullable - private TranslogStats translog; - - @Nullable - private WarmerStats warmer; - - @Nullable - private BulkStats bulk; - - @Nullable - private ShardsTotalStats shards; - - /** - * Contains statistics about completions across all shards assigned to the node. - *

- * API name: {@code completion} - */ - public final Builder completion(@Nullable CompletionStats value) { - this.completion = value; - return this; - } - - /** - * Contains statistics about completions across all shards assigned to the node. - *

- * API name: {@code completion} - */ - public final Builder completion(Function> fn) { - return this.completion(fn.apply(new CompletionStats.Builder()).build()); - } - - /** - * Contains statistics about documents across all primary shards assigned to the - * node. - *

- * API name: {@code docs} - */ - public final Builder docs(@Nullable DocStats value) { - this.docs = value; - return this; - } - - /** - * Contains statistics about documents across all primary shards assigned to the - * node. - *

- * API name: {@code docs} - */ - public final Builder docs(Function> fn) { - return this.docs(fn.apply(new DocStats.Builder()).build()); - } - - /** - * Contains statistics about the field data cache across all shards assigned to - * the node. - *

- * API name: {@code fielddata} - */ - public final Builder fielddata(@Nullable FielddataStats value) { - this.fielddata = value; - return this; - } - - /** - * Contains statistics about the field data cache across all shards assigned to - * the node. - *

- * API name: {@code fielddata} - */ - public final Builder fielddata(Function> fn) { - return this.fielddata(fn.apply(new FielddataStats.Builder()).build()); - } - - /** - * Contains statistics about flush operations for the node. - *

- * API name: {@code flush} - */ - public final Builder flush(@Nullable FlushStats value) { - this.flush = value; - return this; - } - - /** - * Contains statistics about flush operations for the node. - *

- * API name: {@code flush} - */ - public final Builder flush(Function> fn) { - return this.flush(fn.apply(new FlushStats.Builder()).build()); - } - - /** - * Contains statistics about get operations for the node. - *

- * API name: {@code get} - */ - public final Builder get(@Nullable GetStats value) { - this.get = value; - return this; - } - - /** - * Contains statistics about get operations for the node. - *

- * API name: {@code get} - */ - public final Builder get(Function> fn) { - return this.get(fn.apply(new GetStats.Builder()).build()); - } - - /** - * Contains statistics about indexing operations for the node. - *

- * API name: {@code indexing} - */ - public final Builder indexing(@Nullable IndexingStats value) { - this.indexing = value; - return this; - } - - /** - * Contains statistics about indexing operations for the node. - *

- * API name: {@code indexing} - */ - public final Builder indexing(Function> fn) { - return this.indexing(fn.apply(new IndexingStats.Builder()).build()); - } - - /** - * Contains statistics about merge operations for the node. - *

- * API name: {@code merges} - */ - public final Builder merges(@Nullable MergesStats value) { - this.merges = value; - return this; - } - - /** - * Contains statistics about merge operations for the node. - *

- * API name: {@code merges} - */ - public final Builder merges(Function> fn) { - return this.merges(fn.apply(new MergesStats.Builder()).build()); - } - - /** - * Contains statistics about the query cache across all shards assigned to the - * node. - *

- * API name: {@code query_cache} - */ - public final Builder queryCache(@Nullable QueryCacheStats value) { - this.queryCache = value; - return this; - } - - /** - * Contains statistics about the query cache across all shards assigned to the - * node. - *

- * API name: {@code query_cache} - */ - public final Builder queryCache(Function> fn) { - return this.queryCache(fn.apply(new QueryCacheStats.Builder()).build()); - } - - /** - * Contains statistics about recovery operations for the node. - *

- * API name: {@code recovery} - */ - public final Builder recovery(@Nullable RecoveryStats value) { - this.recovery = value; - return this; - } - - /** - * Contains statistics about recovery operations for the node. - *

- * API name: {@code recovery} - */ - public final Builder recovery(Function> fn) { - return this.recovery(fn.apply(new RecoveryStats.Builder()).build()); - } - - /** - * Contains statistics about refresh operations for the node. - *

- * API name: {@code refresh} - */ - public final Builder refresh(@Nullable RefreshStats value) { - this.refresh = value; - return this; - } - - /** - * Contains statistics about refresh operations for the node. - *

- * API name: {@code refresh} - */ - public final Builder refresh(Function> fn) { - return this.refresh(fn.apply(new RefreshStats.Builder()).build()); - } - - /** - * Contains statistics about the request cache across all shards assigned to the - * node. - *

- * API name: {@code request_cache} - */ - public final Builder requestCache(@Nullable RequestCacheStats value) { - this.requestCache = value; - return this; - } - - /** - * Contains statistics about the request cache across all shards assigned to the - * node. - *

- * API name: {@code request_cache} - */ - public final Builder requestCache(Function> fn) { - return this.requestCache(fn.apply(new RequestCacheStats.Builder()).build()); - } - - /** - * Contains statistics about search operations for the node. - *

- * API name: {@code search} - */ - public final Builder search(@Nullable SearchStats value) { - this.search = value; - return this; - } - - /** - * Contains statistics about search operations for the node. - *

- * API name: {@code search} - */ - public final Builder search(Function> fn) { - return this.search(fn.apply(new SearchStats.Builder()).build()); - } - - /** - * Contains statistics about segments across all shards assigned to the node. - *

- * API name: {@code segments} - */ - public final Builder segments(@Nullable SegmentsStats value) { - this.segments = value; - return this; - } - - /** - * Contains statistics about segments across all shards assigned to the node. - *

- * API name: {@code segments} - */ - public final Builder segments(Function> fn) { - return this.segments(fn.apply(new SegmentsStats.Builder()).build()); - } - - /** - * Contains statistics about the size of shards assigned to the node. - *

- * API name: {@code store} - */ - public final Builder store(@Nullable StoreStats value) { - this.store = value; - return this; - } - - /** - * Contains statistics about the size of shards assigned to the node. - *

- * API name: {@code store} - */ - public final Builder store(Function> fn) { - return this.store(fn.apply(new StoreStats.Builder()).build()); - } - - /** - * Contains statistics about transaction log operations for the node. - *

- * API name: {@code translog} - */ - public final Builder translog(@Nullable TranslogStats value) { - this.translog = value; - return this; - } - - /** - * Contains statistics about transaction log operations for the node. - *

- * API name: {@code translog} - */ - public final Builder translog(Function> fn) { - return this.translog(fn.apply(new TranslogStats.Builder()).build()); - } - - /** - * Contains statistics about index warming operations for the node. - *

- * API name: {@code warmer} - */ - public final Builder warmer(@Nullable WarmerStats value) { - this.warmer = value; - return this; - } - - /** - * Contains statistics about index warming operations for the node. - *

- * API name: {@code warmer} - */ - public final Builder warmer(Function> fn) { - return this.warmer(fn.apply(new WarmerStats.Builder()).build()); - } - - /** - * API name: {@code bulk} - */ - public final Builder bulk(@Nullable BulkStats value) { - this.bulk = value; - return this; - } - - /** - * API name: {@code bulk} - */ - public final Builder bulk(Function> fn) { - return this.bulk(fn.apply(new BulkStats.Builder()).build()); - } - - /** - * API name: {@code shards} - */ - public final Builder shards(@Nullable ShardsTotalStats value) { - this.shards = value; - return this; - } - - /** - * API name: {@code shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardsTotalStats.Builder()).build()); - } - - /** - * Builds a {@link IndexStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexStats build() { - _checkSingleUse(); - - return new IndexStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - IndexStats::setupIndexStatsDeserializer - ); - - protected static void setupIndexStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::completion, CompletionStats._DESERIALIZER, "completion"); - op.add(Builder::docs, DocStats._DESERIALIZER, "docs"); - op.add(Builder::fielddata, FielddataStats._DESERIALIZER, "fielddata"); - op.add(Builder::flush, FlushStats._DESERIALIZER, "flush"); - op.add(Builder::get, GetStats._DESERIALIZER, "get"); - op.add(Builder::indexing, IndexingStats._DESERIALIZER, "indexing"); - op.add(Builder::merges, MergesStats._DESERIALIZER, "merges"); - op.add(Builder::queryCache, QueryCacheStats._DESERIALIZER, "query_cache"); - op.add(Builder::recovery, RecoveryStats._DESERIALIZER, "recovery"); - op.add(Builder::refresh, RefreshStats._DESERIALIZER, "refresh"); - op.add(Builder::requestCache, RequestCacheStats._DESERIALIZER, "request_cache"); - op.add(Builder::search, SearchStats._DESERIALIZER, "search"); - op.add(Builder::segments, SegmentsStats._DESERIALIZER, "segments"); - op.add(Builder::store, StoreStats._DESERIALIZER, "store"); - op.add(Builder::translog, TranslogStats._DESERIALIZER, "translog"); - op.add(Builder::warmer, WarmerStats._DESERIALIZER, "warmer"); - op.add(Builder::bulk, BulkStats._DESERIALIZER, "bulk"); - op.add(Builder::shards, ShardsTotalStats._DESERIALIZER, "shards"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardQueryCache.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardQueryCache.java deleted file mode 100644 index 498d2cf8ef..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardQueryCache.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.stats.ShardQueryCache - -@JsonpDeserializable -public class ShardQueryCache implements PlainJsonSerializable { - private final long cacheCount; - - private final long cacheSize; - - private final long evictions; - - private final long hitCount; - - private final long memorySizeInBytes; - - private final long missCount; - - private final long totalCount; - - // --------------------------------------------------------------------------------------------- - - private ShardQueryCache(Builder builder) { - - this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); - this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); - - } - - public static ShardQueryCache of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code cache_count} - */ - public final long cacheCount() { - return this.cacheCount; - } - - /** - * Required - API name: {@code cache_size} - */ - public final long cacheSize() { - return this.cacheSize; - } - - /** - * Required - API name: {@code evictions} - */ - public final long evictions() { - return this.evictions; - } - - /** - * Required - API name: {@code hit_count} - */ - public final long hitCount() { - return this.hitCount; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * Required - API name: {@code miss_count} - */ - public final long missCount() { - return this.missCount; - } - - /** - * Required - API name: {@code total_count} - */ - public final long totalCount() { - return this.totalCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("cache_count"); - generator.write(this.cacheCount); - - generator.writeKey("cache_size"); - generator.write(this.cacheSize); - - generator.writeKey("evictions"); - generator.write(this.evictions); - - generator.writeKey("hit_count"); - generator.write(this.hitCount); - - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - generator.writeKey("miss_count"); - generator.write(this.missCount); - - generator.writeKey("total_count"); - generator.write(this.totalCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ShardQueryCache}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long cacheCount; - - private Long cacheSize; - - private Long evictions; - - private Long hitCount; - - private Long memorySizeInBytes; - - private Long missCount; - - private Long totalCount; - - /** - * Required - API name: {@code cache_count} - */ - public final Builder cacheCount(long value) { - this.cacheCount = value; - return this; - } - - /** - * Required - API name: {@code cache_size} - */ - public final Builder cacheSize(long value) { - this.cacheSize = value; - return this; - } - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(long value) { - this.evictions = value; - return this; - } - - /** - * Required - API name: {@code hit_count} - */ - public final Builder hitCount(long value) { - this.hitCount = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code miss_count} - */ - public final Builder missCount(long value) { - this.missCount = value; - return this; - } - - /** - * Required - API name: {@code total_count} - */ - public final Builder totalCount(long value) { - this.totalCount = value; - return this; - } - - /** - * Builds a {@link ShardQueryCache}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ShardQueryCache build() { - _checkSingleUse(); - - return new ShardQueryCache(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ShardQueryCache} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ShardQueryCache::setupShardQueryCacheDeserializer - ); - - protected static void setupShardQueryCacheDeserializer(ObjectDeserializer op) { - - op.add(Builder::cacheCount, JsonpDeserializer.longDeserializer(), "cache_count"); - op.add(Builder::cacheSize, JsonpDeserializer.longDeserializer(), "cache_size"); - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); - op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); - op.add(Builder::totalCount, JsonpDeserializer.longDeserializer(), "total_count"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java deleted file mode 100644 index 7f7fca54b1..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java +++ /dev/null @@ -1,848 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.BulkStats; -import org.opensearch.client.opensearch._types.CompletionStats; -import org.opensearch.client.opensearch._types.DocStats; -import org.opensearch.client.opensearch._types.FielddataStats; -import org.opensearch.client.opensearch._types.FlushStats; -import org.opensearch.client.opensearch._types.GetStats; -import org.opensearch.client.opensearch._types.IndexingStats; -import org.opensearch.client.opensearch._types.MergesStats; -import org.opensearch.client.opensearch._types.RecoveryStats; -import org.opensearch.client.opensearch._types.RefreshStats; -import org.opensearch.client.opensearch._types.RequestCacheStats; -import org.opensearch.client.opensearch._types.SearchStats; -import org.opensearch.client.opensearch._types.SegmentsStats; -import org.opensearch.client.opensearch._types.StoreStats; -import org.opensearch.client.opensearch._types.TranslogStats; -import org.opensearch.client.opensearch._types.WarmerStats; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.stats.ShardStats - -@JsonpDeserializable -public class ShardStats implements PlainJsonSerializable { - private final ShardCommit commit; - - private final CompletionStats completion; - - private final DocStats docs; - - private final FielddataStats fielddata; - - private final FlushStats flush; - - private final GetStats get; - - private final IndexingStats indexing; - - private final MergesStats merges; - - private final ShardPath shardPath; - - private final ShardQueryCache queryCache; - - private final RecoveryStats recovery; - - private final RefreshStats refresh; - - private final RequestCacheStats requestCache; - - private final ShardRetentionLeases retentionLeases; - - private final ShardRouting routing; - - private final SearchStats search; - - private final SegmentsStats segments; - - private final ShardSequenceNumber seqNo; - - private final StoreStats store; - - private final TranslogStats translog; - - private final WarmerStats warmer; - - @Nullable - private final BulkStats bulk; - - @Nullable - private final ShardsTotalStats shards; - - // --------------------------------------------------------------------------------------------- - - private ShardStats(Builder builder) { - - this.commit = ApiTypeHelper.requireNonNull(builder.commit, this, "commit"); - this.completion = ApiTypeHelper.requireNonNull(builder.completion, this, "completion"); - this.docs = ApiTypeHelper.requireNonNull(builder.docs, this, "docs"); - this.fielddata = ApiTypeHelper.requireNonNull(builder.fielddata, this, "fielddata"); - this.flush = ApiTypeHelper.requireNonNull(builder.flush, this, "flush"); - this.get = ApiTypeHelper.requireNonNull(builder.get, this, "get"); - this.indexing = ApiTypeHelper.requireNonNull(builder.indexing, this, "indexing"); - this.merges = ApiTypeHelper.requireNonNull(builder.merges, this, "merges"); - this.shardPath = ApiTypeHelper.requireNonNull(builder.shardPath, this, "shardPath"); - this.queryCache = ApiTypeHelper.requireNonNull(builder.queryCache, this, "queryCache"); - this.recovery = ApiTypeHelper.requireNonNull(builder.recovery, this, "recovery"); - this.refresh = ApiTypeHelper.requireNonNull(builder.refresh, this, "refresh"); - this.requestCache = ApiTypeHelper.requireNonNull(builder.requestCache, this, "requestCache"); - this.retentionLeases = ApiTypeHelper.requireNonNull(builder.retentionLeases, this, "retentionLeases"); - this.routing = ApiTypeHelper.requireNonNull(builder.routing, this, "routing"); - this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); - this.segments = ApiTypeHelper.requireNonNull(builder.segments, this, "segments"); - this.seqNo = ApiTypeHelper.requireNonNull(builder.seqNo, this, "seqNo"); - this.store = ApiTypeHelper.requireNonNull(builder.store, this, "store"); - this.translog = ApiTypeHelper.requireNonNull(builder.translog, this, "translog"); - this.warmer = ApiTypeHelper.requireNonNull(builder.warmer, this, "warmer"); - this.bulk = builder.bulk; - this.shards = builder.shards; - } - - public static ShardStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code commit} - */ - public final ShardCommit commit() { - return this.commit; - } - - /** - * Required - API name: {@code completion} - */ - public final CompletionStats completion() { - return this.completion; - } - - /** - * Required - API name: {@code docs} - */ - public final DocStats docs() { - return this.docs; - } - - /** - * Required - API name: {@code fielddata} - */ - public final FielddataStats fielddata() { - return this.fielddata; - } - - /** - * Required - API name: {@code flush} - */ - public final FlushStats flush() { - return this.flush; - } - - /** - * Required - API name: {@code get} - */ - public final GetStats get() { - return this.get; - } - - /** - * Required - API name: {@code indexing} - */ - public final IndexingStats indexing() { - return this.indexing; - } - - /** - * Required - API name: {@code merges} - */ - public final MergesStats merges() { - return this.merges; - } - - /** - * Required - API name: {@code shard_path} - */ - public final ShardPath shardPath() { - return this.shardPath; - } - - /** - * Required - API name: {@code query_cache} - */ - public final ShardQueryCache queryCache() { - return this.queryCache; - } - - /** - * Required - API name: {@code recovery} - */ - public final RecoveryStats recovery() { - return this.recovery; - } - - /** - * Required - API name: {@code refresh} - */ - public final RefreshStats refresh() { - return this.refresh; - } - - /** - * Required - API name: {@code request_cache} - */ - public final RequestCacheStats requestCache() { - return this.requestCache; - } - - /** - * Required - API name: {@code retention_leases} - */ - public final ShardRetentionLeases retentionLeases() { - return this.retentionLeases; - } - - /** - * Required - API name: {@code routing} - */ - public final ShardRouting routing() { - return this.routing; - } - - /** - * Required - API name: {@code search} - */ - public final SearchStats search() { - return this.search; - } - - /** - * Required - API name: {@code segments} - */ - public final SegmentsStats segments() { - return this.segments; - } - - /** - * Required - API name: {@code seq_no} - */ - public final ShardSequenceNumber seqNo() { - return this.seqNo; - } - - /** - * Required - API name: {@code store} - */ - public final StoreStats store() { - return this.store; - } - - /** - * Required - API name: {@code translog} - */ - public final TranslogStats translog() { - return this.translog; - } - - /** - * Required - API name: {@code warmer} - */ - public final WarmerStats warmer() { - return this.warmer; - } - - /** - * API name: {@code bulk} - */ - @Nullable - public final BulkStats bulk() { - return this.bulk; - } - - /** - * API name: {@code shards} - */ - @Nullable - public final ShardsTotalStats shards() { - return this.shards; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("commit"); - this.commit.serialize(generator, mapper); - - generator.writeKey("completion"); - this.completion.serialize(generator, mapper); - - generator.writeKey("docs"); - this.docs.serialize(generator, mapper); - - generator.writeKey("fielddata"); - this.fielddata.serialize(generator, mapper); - - generator.writeKey("flush"); - this.flush.serialize(generator, mapper); - - generator.writeKey("get"); - this.get.serialize(generator, mapper); - - generator.writeKey("indexing"); - this.indexing.serialize(generator, mapper); - - generator.writeKey("merges"); - this.merges.serialize(generator, mapper); - - generator.writeKey("shard_path"); - this.shardPath.serialize(generator, mapper); - - generator.writeKey("query_cache"); - this.queryCache.serialize(generator, mapper); - - generator.writeKey("recovery"); - this.recovery.serialize(generator, mapper); - - generator.writeKey("refresh"); - this.refresh.serialize(generator, mapper); - - generator.writeKey("request_cache"); - this.requestCache.serialize(generator, mapper); - - generator.writeKey("retention_leases"); - this.retentionLeases.serialize(generator, mapper); - - generator.writeKey("routing"); - this.routing.serialize(generator, mapper); - - generator.writeKey("search"); - this.search.serialize(generator, mapper); - - generator.writeKey("segments"); - this.segments.serialize(generator, mapper); - - generator.writeKey("seq_no"); - this.seqNo.serialize(generator, mapper); - - generator.writeKey("store"); - this.store.serialize(generator, mapper); - - generator.writeKey("translog"); - this.translog.serialize(generator, mapper); - - generator.writeKey("warmer"); - this.warmer.serialize(generator, mapper); - - if (this.bulk != null) { - generator.writeKey("bulk"); - this.bulk.serialize(generator, mapper); - - } - if (this.shards != null) { - generator.writeKey("shards"); - this.shards.serialize(generator, mapper); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ShardStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ShardCommit commit; - - private CompletionStats completion; - - private DocStats docs; - - private FielddataStats fielddata; - - private FlushStats flush; - - private GetStats get; - - private IndexingStats indexing; - - private MergesStats merges; - - private ShardPath shardPath; - - private ShardQueryCache queryCache; - - private RecoveryStats recovery; - - private RefreshStats refresh; - - private RequestCacheStats requestCache; - - private ShardRetentionLeases retentionLeases; - - private ShardRouting routing; - - private SearchStats search; - - private SegmentsStats segments; - - private ShardSequenceNumber seqNo; - - private StoreStats store; - - private TranslogStats translog; - - private WarmerStats warmer; - - @Nullable - private BulkStats bulk; - - @Nullable - private ShardsTotalStats shards; - - /** - * Required - API name: {@code commit} - */ - public final Builder commit(ShardCommit value) { - this.commit = value; - return this; - } - - /** - * Required - API name: {@code commit} - */ - public final Builder commit(Function> fn) { - return this.commit(fn.apply(new ShardCommit.Builder()).build()); - } - - /** - * Required - API name: {@code completion} - */ - public final Builder completion(CompletionStats value) { - this.completion = value; - return this; - } - - /** - * Required - API name: {@code completion} - */ - public final Builder completion(Function> fn) { - return this.completion(fn.apply(new CompletionStats.Builder()).build()); - } - - /** - * Required - API name: {@code docs} - */ - public final Builder docs(DocStats value) { - this.docs = value; - return this; - } - - /** - * Required - API name: {@code docs} - */ - public final Builder docs(Function> fn) { - return this.docs(fn.apply(new DocStats.Builder()).build()); - } - - /** - * Required - API name: {@code fielddata} - */ - public final Builder fielddata(FielddataStats value) { - this.fielddata = value; - return this; - } - - /** - * Required - API name: {@code fielddata} - */ - public final Builder fielddata(Function> fn) { - return this.fielddata(fn.apply(new FielddataStats.Builder()).build()); - } - - /** - * Required - API name: {@code flush} - */ - public final Builder flush(FlushStats value) { - this.flush = value; - return this; - } - - /** - * Required - API name: {@code flush} - */ - public final Builder flush(Function> fn) { - return this.flush(fn.apply(new FlushStats.Builder()).build()); - } - - /** - * Required - API name: {@code get} - */ - public final Builder get(GetStats value) { - this.get = value; - return this; - } - - /** - * Required - API name: {@code get} - */ - public final Builder get(Function> fn) { - return this.get(fn.apply(new GetStats.Builder()).build()); - } - - /** - * Required - API name: {@code indexing} - */ - public final Builder indexing(IndexingStats value) { - this.indexing = value; - return this; - } - - /** - * Required - API name: {@code indexing} - */ - public final Builder indexing(Function> fn) { - return this.indexing(fn.apply(new IndexingStats.Builder()).build()); - } - - /** - * Required - API name: {@code merges} - */ - public final Builder merges(MergesStats value) { - this.merges = value; - return this; - } - - /** - * Required - API name: {@code merges} - */ - public final Builder merges(Function> fn) { - return this.merges(fn.apply(new MergesStats.Builder()).build()); - } - - /** - * Required - API name: {@code shard_path} - */ - public final Builder shardPath(ShardPath value) { - this.shardPath = value; - return this; - } - - /** - * Required - API name: {@code shard_path} - */ - public final Builder shardPath(Function> fn) { - return this.shardPath(fn.apply(new ShardPath.Builder()).build()); - } - - /** - * Required - API name: {@code query_cache} - */ - public final Builder queryCache(ShardQueryCache value) { - this.queryCache = value; - return this; - } - - /** - * Required - API name: {@code query_cache} - */ - public final Builder queryCache(Function> fn) { - return this.queryCache(fn.apply(new ShardQueryCache.Builder()).build()); - } - - /** - * Required - API name: {@code recovery} - */ - public final Builder recovery(RecoveryStats value) { - this.recovery = value; - return this; - } - - /** - * Required - API name: {@code recovery} - */ - public final Builder recovery(Function> fn) { - return this.recovery(fn.apply(new RecoveryStats.Builder()).build()); - } - - /** - * Required - API name: {@code refresh} - */ - public final Builder refresh(RefreshStats value) { - this.refresh = value; - return this; - } - - /** - * Required - API name: {@code refresh} - */ - public final Builder refresh(Function> fn) { - return this.refresh(fn.apply(new RefreshStats.Builder()).build()); - } - - /** - * Required - API name: {@code request_cache} - */ - public final Builder requestCache(RequestCacheStats value) { - this.requestCache = value; - return this; - } - - /** - * Required - API name: {@code request_cache} - */ - public final Builder requestCache(Function> fn) { - return this.requestCache(fn.apply(new RequestCacheStats.Builder()).build()); - } - - /** - * Required - API name: {@code retention_leases} - */ - public final Builder retentionLeases(ShardRetentionLeases value) { - this.retentionLeases = value; - return this; - } - - /** - * Required - API name: {@code retention_leases} - */ - public final Builder retentionLeases(Function> fn) { - return this.retentionLeases(fn.apply(new ShardRetentionLeases.Builder()).build()); - } - - /** - * Required - API name: {@code routing} - */ - public final Builder routing(ShardRouting value) { - this.routing = value; - return this; - } - - /** - * Required - API name: {@code routing} - */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new ShardRouting.Builder()).build()); - } - - /** - * Required - API name: {@code search} - */ - public final Builder search(SearchStats value) { - this.search = value; - return this; - } - - /** - * Required - API name: {@code search} - */ - public final Builder search(Function> fn) { - return this.search(fn.apply(new SearchStats.Builder()).build()); - } - - /** - * Required - API name: {@code segments} - */ - public final Builder segments(SegmentsStats value) { - this.segments = value; - return this; - } - - /** - * Required - API name: {@code segments} - */ - public final Builder segments(Function> fn) { - return this.segments(fn.apply(new SegmentsStats.Builder()).build()); - } - - /** - * Required - API name: {@code seq_no} - */ - public final Builder seqNo(ShardSequenceNumber value) { - this.seqNo = value; - return this; - } - - /** - * Required - API name: {@code seq_no} - */ - public final Builder seqNo(Function> fn) { - return this.seqNo(fn.apply(new ShardSequenceNumber.Builder()).build()); - } - - /** - * Required - API name: {@code store} - */ - public final Builder store(StoreStats value) { - this.store = value; - return this; - } - - /** - * Required - API name: {@code store} - */ - public final Builder store(Function> fn) { - return this.store(fn.apply(new StoreStats.Builder()).build()); - } - - /** - * Required - API name: {@code translog} - */ - public final Builder translog(TranslogStats value) { - this.translog = value; - return this; - } - - /** - * Required - API name: {@code translog} - */ - public final Builder translog(Function> fn) { - return this.translog(fn.apply(new TranslogStats.Builder()).build()); - } - - /** - * Required - API name: {@code warmer} - */ - public final Builder warmer(WarmerStats value) { - this.warmer = value; - return this; - } - - /** - * Required - API name: {@code warmer} - */ - public final Builder warmer(Function> fn) { - return this.warmer(fn.apply(new WarmerStats.Builder()).build()); - } - - /** - * API name: {@code bulk} - */ - public final Builder bulk(@Nullable BulkStats value) { - this.bulk = value; - return this; - } - - /** - * API name: {@code bulk} - */ - public final Builder bulk(Function> fn) { - return this.bulk(fn.apply(new BulkStats.Builder()).build()); - } - - /** - * API name: {@code shards} - */ - public final Builder shards(ShardsTotalStats value) { - this.shards = value; - return this; - } - - /** - * API name: {@code shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardsTotalStats.Builder()).build()); - } - - /** - * Builds a {@link ShardStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ShardStats build() { - _checkSingleUse(); - - return new ShardStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ShardStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ShardStats::setupShardStatsDeserializer - ); - - protected static void setupShardStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::commit, ShardCommit._DESERIALIZER, "commit"); - op.add(Builder::completion, CompletionStats._DESERIALIZER, "completion"); - op.add(Builder::docs, DocStats._DESERIALIZER, "docs"); - op.add(Builder::fielddata, FielddataStats._DESERIALIZER, "fielddata"); - op.add(Builder::flush, FlushStats._DESERIALIZER, "flush"); - op.add(Builder::get, GetStats._DESERIALIZER, "get"); - op.add(Builder::indexing, IndexingStats._DESERIALIZER, "indexing"); - op.add(Builder::merges, MergesStats._DESERIALIZER, "merges"); - op.add(Builder::shardPath, ShardPath._DESERIALIZER, "shard_path"); - op.add(Builder::queryCache, ShardQueryCache._DESERIALIZER, "query_cache"); - op.add(Builder::recovery, RecoveryStats._DESERIALIZER, "recovery"); - op.add(Builder::refresh, RefreshStats._DESERIALIZER, "refresh"); - op.add(Builder::requestCache, RequestCacheStats._DESERIALIZER, "request_cache"); - op.add(Builder::retentionLeases, ShardRetentionLeases._DESERIALIZER, "retention_leases"); - op.add(Builder::routing, ShardRouting._DESERIALIZER, "routing"); - op.add(Builder::search, SearchStats._DESERIALIZER, "search"); - op.add(Builder::segments, SegmentsStats._DESERIALIZER, "segments"); - op.add(Builder::seqNo, ShardSequenceNumber._DESERIALIZER, "seq_no"); - op.add(Builder::store, StoreStats._DESERIALIZER, "store"); - op.add(Builder::translog, TranslogStats._DESERIALIZER, "translog"); - op.add(Builder::warmer, WarmerStats._DESERIALIZER, "warmer"); - op.add(Builder::bulk, BulkStats._DESERIALIZER, "bulk"); - op.add(Builder::shards, ShardsTotalStats._DESERIALIZER, "shards"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardsTotalStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardsTotalStats.java deleted file mode 100644 index 60d6cf4f4a..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardsTotalStats.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.indices.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.stats.ShardsTotalStats - -@JsonpDeserializable -public class ShardsTotalStats implements PlainJsonSerializable { - private final long totalCount; - - // --------------------------------------------------------------------------------------------- - - private ShardsTotalStats(Builder builder) { - - this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); - - } - - public static ShardsTotalStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code total_count} - */ - public final long totalCount() { - return this.totalCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("total_count"); - generator.write(this.totalCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ShardsTotalStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long totalCount; - - /** - * Required - API name: {@code total_count} - */ - public final Builder totalCount(long value) { - this.totalCount = value; - return this; - } - - /** - * Builds a {@link ShardsTotalStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ShardsTotalStats build() { - _checkSingleUse(); - - return new ShardsTotalStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ShardsTotalStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ShardsTotalStats::setupShardsTotalStatsDeserializer - ); - - protected static void setupShardsTotalStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::totalCount, JsonpDeserializer.longDeserializer(), "total_count"); - - } - -} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java index e86d347514..ddd25ff0bc 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java @@ -44,6 +44,7 @@ import org.opensearch.client.opensearch._types.GetStats; import org.opensearch.client.opensearch._types.IndexingStats; import org.opensearch.client.opensearch._types.MergesStats; +import org.opensearch.client.opensearch._types.QueryCacheStats; import org.opensearch.client.opensearch._types.RecoveryStats; import org.opensearch.client.opensearch._types.RefreshStats; import org.opensearch.client.opensearch._types.RequestCacheStats; @@ -52,14 +53,13 @@ import org.opensearch.client.opensearch._types.StoreStats; import org.opensearch.client.opensearch._types.TranslogStats; import org.opensearch.client.opensearch._types.WarmerStats; +import org.opensearch.client.opensearch.indices.stats.IndexShardStats; import org.opensearch.client.opensearch.indices.stats.ShardCommit; import org.opensearch.client.opensearch.indices.stats.ShardPath; -import org.opensearch.client.opensearch.indices.stats.ShardQueryCache; import org.opensearch.client.opensearch.indices.stats.ShardRetentionLeases; import org.opensearch.client.opensearch.indices.stats.ShardRouting; import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; import org.opensearch.client.opensearch.indices.stats.ShardSequenceNumber; -import org.opensearch.client.opensearch.indices.stats.ShardStats; import org.opensearch.client.util.MissingRequiredPropertyException; public class ShardStatsTest extends Assert { @@ -67,7 +67,7 @@ public class ShardStatsTest extends Assert { @Test public void testShardStatsBulkAndShardsPropertiesNotRequired() { - ShardStats.Builder builder = createShardsStatsBuilderWithRequiredFields(); + IndexShardStats.Builder builder = createShardsStatsBuilderWithRequiredFields(); try { builder.build(); @@ -76,10 +76,10 @@ public void testShardStatsBulkAndShardsPropertiesNotRequired() { } } - private ShardStats.Builder createShardsStatsBuilderWithRequiredFields() { + private IndexShardStats.Builder createShardsStatsBuilderWithRequiredFields() { ShardCommit commit = new ShardCommit.Builder().id("").generation(0).numDocs(0).userData(new HashMap<>()).build(); CompletionStats completion = new CompletionStats.Builder().sizeInBytes(0).build(); - DocStats docs = new DocStats.Builder().count(0).deleted(0).build(); + DocStats docs = new DocStats.Builder().count(0).deleted(0L).build(); FielddataStats fielddata = new FielddataStats.Builder().memorySizeInBytes(0).build(); FlushStats flush = new FlushStats.Builder().periodic(0).total(0).totalTimeInMillis(0).build(); GetStats get = new GetStats.Builder().current(0) @@ -100,7 +100,6 @@ private ShardStats.Builder createShardsStatsBuilderWithRequiredFields() { .indexTimeInMillis(0) .indexTotal(0) .indexFailed(0) - .types(new HashMap<>()) .build(); MergesStats merges = new MergesStats.Builder().current(0) .currentDocs(0) @@ -114,7 +113,7 @@ private ShardStats.Builder createShardsStatsBuilderWithRequiredFields() { .totalTimeInMillis(0) .build(); ShardPath shardPath = new ShardPath.Builder().dataPath("").isCustomDataPath(false).statePath("").build(); - ShardQueryCache queryCache = new ShardQueryCache.Builder().cacheCount(0) + QueryCacheStats queryCache = new QueryCacheStats.Builder().cacheCount(0) .cacheSize(0) .evictions(0) .hitCount(0) @@ -169,7 +168,7 @@ private ShardStats.Builder createShardsStatsBuilderWithRequiredFields() { .build(); WarmerStats warmer = new WarmerStats.Builder().current(0).total(0).totalTimeInMillis(0).build(); - ShardStats.Builder builder = new ShardStats.Builder(); + IndexShardStats.Builder builder = new IndexShardStats.Builder(); builder.commit(commit) .completion(completion) diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index e5f8b7b4d5..b9267937a3 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -9671,8 +9671,6 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' - requestBody: - $ref: '#/components/requestBodies/indices.upgrade' responses: '200': $ref: '#/components/responses/indices.upgrade___200' @@ -12411,8 +12409,6 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' - requestBody: - $ref: '#/components/requestBodies/indices.upgrade' responses: '200': $ref: '#/components/responses/indices.upgrade___200' @@ -20103,7 +20099,8 @@ components: Set this parameter to 1 to merge all segments into one segment. The default behavior is to perform the merge as necessary. schema: - type: number + type: integer + format: int64 style: form indices.forcemerge___query.only_expunge_deletes: in: query @@ -21247,10 +21244,10 @@ components: description: List of shard health statuses used to limit the request. schema: oneOf: - - $ref: '#/components/schemas/indices.shard_stores___Status' + - $ref: '#/components/schemas/indices.shard_stores___ShardStoreStatus' - type: array items: - $ref: '#/components/schemas/indices.shard_stores___Status' + $ref: '#/components/schemas/indices.shard_stores___ShardStoreStatus' style: form indices.shrink___path.index: in: path @@ -26637,8 +26634,7 @@ components: settings: description: Configuration options for the target index. type: object - additionalProperties: - type: object + additionalProperties: true description: The configuration for the target index (`settings` and `aliases`) indices.create: content: @@ -26846,8 +26842,7 @@ components: Configuration options for the index. Data streams do not support this parameter. type: object - additionalProperties: - type: object + additionalProperties: true description: The conditions that needs to be met for executing rollover indices.shrink: content: @@ -26865,8 +26860,7 @@ components: settings: description: Configuration options for the target index. type: object - additionalProperties: - type: object + additionalProperties: true description: The configuration for the target index (`settings` and `aliases`) indices.simulate_index_template: content: @@ -26940,11 +26934,6 @@ components: $ref: '#/components/schemas/indices.update_aliases___Action' description: The definition of `actions` to perform required: true - indices.upgrade: - content: - application/json: - schema: - $ref: '#/components/schemas/indices._common___UpgradeRequest' indices.validate_query: content: application/json: @@ -29300,37 +29289,35 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - index: - $ref: '#/components/schemas/_common___IndexName' - shards_acknowledged: - type: boolean - required: - - acknowledged - - index - - shards_acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + shards_acknowledged: + type: boolean + index: + $ref: '#/components/schemas/_common___IndexName' + required: + - index + - shards_acknowledged description: '' indices.close___200: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - indices: - type: object - additionalProperties: - $ref: '#/components/schemas/indices.close___CloseIndexResult' - shards_acknowledged: - type: boolean - required: - - acknowledged - - indices - - shards_acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + indices: + type: object + additionalProperties: + $ref: '#/components/schemas/indices.close___CloseIndexResult' + shards_acknowledged: + type: boolean + required: + - indices + - shards_acknowledged description: '' indices.create_data_stream___200: content: @@ -29644,32 +29631,31 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - conditions: - type: object - additionalProperties: - type: boolean - dry_run: - type: boolean - new_index: - type: string - old_index: - type: string - rolled_over: - type: boolean - shards_acknowledged: - type: boolean - required: - - acknowledged - - conditions - - dry_run - - new_index - - old_index - - rolled_over - - shards_acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + conditions: + type: object + additionalProperties: + type: boolean + dry_run: + type: boolean + new_index: + type: string + old_index: + type: string + rolled_over: + type: boolean + shards_acknowledged: + type: boolean + required: + - conditions + - dry_run + - new_index + - old_index + - rolled_over + - shards_acknowledged description: '' indices.segments___200: content: @@ -29704,18 +29690,17 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - shards_acknowledged: - type: boolean - index: - $ref: '#/components/schemas/_common___IndexName' - required: - - acknowledged - - index - - shards_acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + shards_acknowledged: + type: boolean + index: + $ref: '#/components/schemas/_common___IndexName' + required: + - index + - shards_acknowledged description: '' indices.simulate_index_template___200: content: @@ -29742,18 +29727,17 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - shards_acknowledged: - type: boolean - index: - $ref: '#/components/schemas/_common___IndexName' - required: - - acknowledged - - index - - shards_acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + shards_acknowledged: + type: boolean + index: + $ref: '#/components/schemas/_common___IndexName' + required: + - index + - shards_acknowledged description: '' indices.stats___200: content: @@ -29783,7 +29767,14 @@ components: content: application/json: schema: - $ref: '#/components/schemas/indices._common___IndexPostUpgradeStatus' + allOf: + - $ref: '#/components/schemas/_common___ShardsOperationResponseBase' + - type: object + properties: + upgraded_indices: + type: object + additionalProperties: + $ref: '#/components/schemas/indices._common___UpgradeVersionStatus' description: '' indices.validate_query___200: content: @@ -32429,13 +32420,15 @@ components: description: |- The total number of non-deleted documents across all primary shards assigned to the selected nodes. This number is based on documents in Lucene segments and may include documents from nested fields. - type: number + type: integer + format: int64 deleted: description: |- The total number of deleted documents across all primary shards assigned to the selected nodes. This number is based on the number of documents stored in Lucene segments. OpenSearch reclaims the disk space previously occupied by the deleted Lucene documents when a segment is merged. - type: number + type: integer + format: int64 required: - count _common___DocStatus: @@ -32547,7 +32540,8 @@ components: type: object properties: evictions: - type: number + type: integer + format: int64 memory_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' memory_size_in_bytes: @@ -32620,9 +32614,11 @@ components: type: object properties: periodic: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 total_time: $ref: '#/components/schemas/_common___Duration' total_time_in_millis: @@ -32740,25 +32736,29 @@ components: type: object properties: total: - type: number + type: integer + format: int64 getTime: $ref: '#/components/schemas/_common___Duration' time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' exists_total: - type: number + type: integer + format: int64 exists_time: $ref: '#/components/schemas/_common___Duration' exists_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' missing_total: - type: number + type: integer + format: int64 missing_time: $ref: '#/components/schemas/_common___Duration' missing_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' current: - type: number + type: integer + format: int64 required: - current - exists_time_in_millis @@ -32840,25 +32840,31 @@ components: type: object properties: index_total: - type: number + type: integer + format: int64 index_time: $ref: '#/components/schemas/_common___Duration' index_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' index_current: - type: number + type: integer + format: int64 index_failed: - type: number + type: integer + format: int64 delete_total: - type: number + type: integer + format: int64 delete_time: $ref: '#/components/schemas/_common___Duration' delete_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' delete_current: - type: number + type: integer + format: int64 noop_update_total: - type: number + type: integer + format: int64 is_throttled: type: boolean throttle_time: @@ -32983,21 +32989,25 @@ components: type: object properties: current: - type: number + type: integer + format: int64 current_docs: - type: number + type: integer + format: int64 current_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' current_size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' total: - type: number + type: integer + format: int64 total_auto_throttle: $ref: '#/components/schemas/_common___HumanReadableByteCount' total_auto_throttle_in_bytes: $ref: '#/components/schemas/_common___ByteCount' total_docs: - type: number + type: integer + format: int64 total_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' total_size_in_bytes: @@ -33015,7 +33025,8 @@ components: total_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' unreferenced_file_cleanups_performed: - type: number + type: integer + format: int64 required: - current - current_docs @@ -33301,16 +33312,20 @@ components: description: |- The total number of entries added to the query cache across all shards assigned to the selected nodes. This number includes all current and evicted entries. - type: number + type: integer + format: int64 cache_size: description: The total number of entries currently stored in the query cache across all shards assigned to the selected nodes. - type: number + type: integer + format: int64 evictions: description: The total number of query cache evictions across all shards assigned to the selected nodes. - type: number + type: integer + format: int64 hit_count: description: The total number of query cache hits across all shards assigned to the selected nodes. - type: number + type: integer + format: int64 memory_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' memory_size_in_bytes: @@ -33318,10 +33333,12 @@ components: $ref: '#/components/schemas/_common___ByteCount' miss_count: description: The total number of query cache misses across all shards assigned to the selected nodes. - type: number + type: integer + format: int64 total_count: description: The total number of hits and misses stored in the query cache across all shards assigned to the selected nodes. - type: number + type: integer + format: int64 required: - cache_count - cache_size @@ -33343,9 +33360,11 @@ components: type: object properties: current_as_source: - type: number + type: integer + format: int64 current_as_target: - type: number + type: integer + format: int64 throttle_time: $ref: '#/components/schemas/_common___Duration' throttle_time_in_millis: @@ -33366,15 +33385,18 @@ components: type: object properties: external_total: - type: number + type: integer + format: int64 external_total_time: $ref: '#/components/schemas/_common___Duration' external_total_time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' listeners: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 total_time: $ref: '#/components/schemas/_common___Duration' total_time_in_millis: @@ -33471,13 +33493,16 @@ components: properties: failed: description: The number of failed upload syncs to the remote translog store. - type: number + type: integer + format: int64 started: description: The number of upload syncs to the remote translog store that have started. - type: number + type: integer + format: int64 succeeded: description: The number of successful upload syncs to the remote translog store. - type: number + type: integer + format: int64 required: - failed - started @@ -33514,7 +33539,8 @@ components: properties: total_rejections: description: The total number of requests rejected due to segment store upload backpressure. - type: number + type: integer + format: int64 required: - total_rejections _common___RemoteStoreUploadRefreshSizeLagStats: @@ -33560,7 +33586,6 @@ components: $ref: '#/components/schemas/_common___RemoteStoreUploadDownloadStats' required: - max_refresh_time_lag_in_millis - - pressure - refresh_size_lag - total_time_spent_in_millis - total_upload_size @@ -33568,15 +33593,18 @@ components: type: object properties: evictions: - type: number + type: integer + format: int64 hit_count: - type: number + type: integer + format: int64 memory_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' memory_size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' miss_count: - type: number + type: integer + format: int64 required: - evictions - hit_count @@ -33590,9 +33618,11 @@ components: time_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' current: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 _common___ResourceStat: type: object properties: @@ -33757,10 +33787,12 @@ components: properties: open_contexts: description: The number of open search contexts. - type: number + type: integer + format: int64 query_current: description: The number of currently running shard query operations. - type: number + type: integer + format: int64 query_time: description: The total amount of time taken to complete all shard query operations. $ref: '#/components/schemas/_common___Duration' @@ -33769,10 +33801,12 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' query_total: description: The total number of shard query operations. - type: number + type: integer + format: int64 concurrent_query_total: description: The total number of query operations using concurrent segment search. - type: number + type: integer + format: int64 concurrent_query_time: $ref: '#/components/schemas/_common___Duration' concurrent_query_time_in_millis: @@ -33780,13 +33814,16 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' concurrent_query_current: description: The number of currently running query operations using concurrent segment search. - type: number + type: integer + format: int64 concurrent_avg_slice_count: description: The average slice count of all search requests. This is computed as the total slice count divided by the total number of concurrent search requests. - type: number + type: integer + format: int64 fetch_current: description: The number of currently running shard fetch operations. - type: number + type: integer + format: int64 fetch_time: description: The total amount of time taken to complete all shard fetch operations. $ref: '#/components/schemas/_common___Duration' @@ -33795,10 +33832,12 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' fetch_total: description: The total number of shard fetch operations. - type: number + type: integer + format: int64 scroll_current: description: The number of shard scroll operations that are currently running. - type: number + type: integer + format: int64 scroll_time: description: The total amount of time taken to complete all shard scroll operations. $ref: '#/components/schemas/_common___Duration' @@ -33807,10 +33846,12 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' scroll_total: description: The total number of shard scroll operations. - type: number + type: integer + format: int64 point_in_time_total: description: The total number of shard Point in Time (PIT) contexts created (completed and active) since the node last restarted. - type: number + type: integer + format: int64 point_in_time_time: $ref: '#/components/schemas/_common___Duration' point_in_time_time_in_millis: @@ -33818,10 +33859,12 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' point_in_time_current: description: The number of currently open shard PIT contexts. - type: number + type: integer + format: int64 suggest_current: description: The number of currently running shard suggest operations. - type: number + type: integer + format: int64 suggest_time: description: The total amount of time take to complete all shard suggest operations. $ref: '#/components/schemas/_common___Duration' @@ -33830,9 +33873,11 @@ components: $ref: '#/components/schemas/_common___DurationValueUnitMillis' suggest_total: description: The total number of shard suggest operations. - type: number + type: integer + format: int64 search_idle_reactivate_count_total: - type: number + type: integer + format: int64 request: type: object description: Statistics related to coordinator search operations for the node. @@ -33861,24 +33906,41 @@ components: - dfs_query_then_fetch - query_then_fetch _common___SegmentReplicationStats: - type: object - properties: - max_bytes_behind: - $ref: '#/components/schemas/_common___ByteCount' - max_replication_lag: - $ref: '#/components/schemas/_common___ByteCount' - total_bytes_behind: - $ref: '#/components/schemas/_common___ByteCount' - required: - - max_bytes_behind - - max_replication_lag - - total_bytes_behind + oneOf: + - x-version-added: 2.10.0 + x-version-removed: 2.12.0 + type: object + properties: + max_bytes_behind: + $ref: '#/components/schemas/_common___HumanReadableByteCount' + max_replication_lag: + $ref: '#/components/schemas/_common___Duration' + total_bytes_behind: + $ref: '#/components/schemas/_common___HumanReadableByteCount' + required: + - max_bytes_behind + - max_replication_lag + - total_bytes_behind + - x-version-added: 2.12.0 + type: object + properties: + max_bytes_behind: + $ref: '#/components/schemas/_common___ByteCount' + max_replication_lag: + $ref: '#/components/schemas/_common___DurationValueUnitMillis' + total_bytes_behind: + $ref: '#/components/schemas/_common___ByteCount' + required: + - max_bytes_behind + - max_replication_lag + - total_bytes_behind _common___SegmentsStats: type: object properties: count: description: The total number of segments across all shards assigned to the selected nodes. - type: number + type: integer + format: int32 doc_values_memory: $ref: '#/components/schemas/_common___HumanReadableByteCount' doc_values_memory_in_bytes: @@ -33905,7 +33967,7 @@ components: $ref: '#/components/schemas/_common___ByteCount' max_unsafe_auto_id_timestamp: description: The Unix timestamp, in milliseconds, of the most recently retried indexing request. - type: number + $ref: '#/components/schemas/_common___EpochTimeUnitMillis' memory: description: The total amount of memory used for segments across all shards assigned to the selected nodes. $ref: '#/components/schemas/_common___HumanReadableByteCount' @@ -34280,9 +34342,11 @@ components: type: object properties: earliest_last_modified_age: - type: number + type: integer + format: int64 operations: - type: number + type: integer + format: int32 remote_store: $ref: '#/components/schemas/_common___RemoteStoreTranslogStats' size: @@ -34290,7 +34354,8 @@ components: size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' uncommitted_operations: - type: number + type: integer + format: int32 uncommitted_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' uncommitted_size_in_bytes: @@ -34371,9 +34436,11 @@ components: type: object properties: current: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 total_time: $ref: '#/components/schemas/_common___Duration' total_time_in_millis: @@ -49763,15 +49830,6 @@ components: properties: index: $ref: '#/components/schemas/indices._common___SlowlogThresholdLevels' - indices._common___IndexPostUpgradeStatus: - type: object - properties: - _shards: - $ref: '#/components/schemas/_common___ShardStatistics' - upgraded_indices: - type: object - additionalProperties: - $ref: '#/components/schemas/indices._common___UpgradeVersionStatus' indices._common___IndexRouting: type: object properties: @@ -50736,22 +50794,6 @@ components: $ref: '#/components/schemas/_common___HumanReadableByteCount' age: $ref: '#/components/schemas/_common___Duration' - indices._common___UpgradeRequest: - type: object - properties: - allow_no_indices: - type: boolean - expand_wildcards: - type: string - enum: - - all - - closed - - none - - open - ignore_unavailable: - type: boolean - wait_for_completion: - type: boolean indices._common___UpgradeStatus: type: object properties: @@ -50983,11 +51025,13 @@ components: type: object properties: length: - type: number + type: integer + format: int64 name: type: string recovered: - type: number + type: integer + format: int64 required: - length - name @@ -51028,11 +51072,14 @@ components: percent: $ref: '#/components/schemas/_common___PercentageString' recovered: - type: number + type: integer + format: int64 reused: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 required: - percent - recovered @@ -51131,7 +51178,8 @@ components: type: object properties: id: - type: number + type: integer + format: int32 index: $ref: '#/components/schemas/indices.recovery___RecoveryIndexStatus' primary: @@ -51180,11 +51228,14 @@ components: percent: $ref: '#/components/schemas/_common___PercentageString' recovered: - type: number + type: integer + format: int32 total: - type: number + type: integer + format: int32 total_on_start: - type: number + type: integer + format: int32 total_time: $ref: '#/components/schemas/_common___Duration' total_time_in_millis: @@ -51260,9 +51311,11 @@ components: max_age_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' min_docs: - type: number + type: integer + format: int64 max_docs: - type: number + type: integer + format: int64 max_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' max_size_bytes: @@ -51280,9 +51333,11 @@ components: min_primary_shard_size_bytes: $ref: '#/components/schemas/_common___ByteCount' max_primary_shard_docs: - type: number + type: integer + format: int64 min_primary_shard_docs: - type: number + type: integer + format: int64 indices.segments___IndexSegment: type: object properties: @@ -51352,11 +51407,13 @@ components: type: object properties: num_committed_segments: - type: number + type: integer + format: int32 routing: $ref: '#/components/schemas/indices.segments___ShardSegmentRouting' num_search_segments: - type: number + type: integer + format: int32 segments: type: object additionalProperties: @@ -51385,6 +51442,7 @@ components: store_exception: $ref: '#/components/schemas/indices.shard_stores___ShardStoreException' additionalProperties: + title: nodes $ref: '#/components/schemas/_common___NodeAttributes' required: - allocation @@ -51404,6 +51462,20 @@ components: required: - reason - type + indices.shard_stores___ShardStoreStatus: + oneOf: + - type: string + const: all + description: Return all shards, regardless of health status. + - type: string + const: green + description: The primary shard and all replica shards are assigned. + - type: string + const: red + description: The primary shard is unassigned. + - type: string + const: yellow + description: One or more replica shards are unassigned. indices.shard_stores___ShardStoreWrapper: type: object properties: @@ -51413,13 +51485,6 @@ components: $ref: '#/components/schemas/indices.shard_stores___ShardStore' required: - stores - indices.shard_stores___Status: - type: string - enum: - - all - - green - - red - - yellow indices.simulate_template___Overlapping: type: object properties: @@ -51554,11 +51619,13 @@ components: type: object properties: generation: - type: number + type: integer + format: int32 id: $ref: '#/components/schemas/_common___Id' num_docs: - type: number + type: integer + format: int64 user_data: type: object additionalProperties: @@ -51584,7 +51651,8 @@ components: average_size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' count: - type: number + type: integer + format: int64 required: - description - size_in_bytes @@ -51596,7 +51664,8 @@ components: retaining_seq_no: $ref: '#/components/schemas/_common___SequenceNumber' timestamp: - type: number + type: integer + format: int64 source: type: string required: @@ -51621,7 +51690,8 @@ components: type: object properties: primary_term: - type: number + type: integer + format: int64 version: $ref: '#/components/schemas/_common___VersionNumber' leases: @@ -51660,9 +51730,11 @@ components: type: object properties: global_checkpoint: - type: number + type: integer + format: int64 local_checkpoint: - type: number + type: integer + format: int64 max_seq_no: $ref: '#/components/schemas/_common___SequenceNumber' required: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 229063da67..c210d89f17 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -14,10 +14,7 @@ import static org.opensearch.client.codegen.utils.matcher.Matcher.is; import static org.opensearch.client.codegen.utils.matcher.Matcher.isNot; import static org.opensearch.client.codegen.utils.matcher.Matcher.isNull; -import static org.opensearch.client.codegen.utils.matcher.Matcher.isOneOf; import static org.opensearch.client.codegen.utils.matcher.Matcher.or; -import static org.opensearch.client.codegen.utils.matcher.StringMatcher.contains; -import static org.opensearch.client.codegen.utils.matcher.StringMatcher.endsWith; import java.io.File; import java.io.IOException; @@ -49,19 +46,7 @@ public class CodeGenerator { private static final Matcher OPERATION_MATCHER = or( and(namespace(isNull()), name(is("info"))), namespace(is("dangling_indices")), - and( - namespace(is("indices")), - name( - or( - isOneOf("add_block", "analyze", "clear_cache", "create", "delete", "exists", "get"), - contains("alias"), - contains("data_stream"), - and(endsWith("mapping"), isNot("get_field_mapping")), - endsWith("settings"), - endsWith("template") - ) - ) - ), + and(namespace(is("indices")), name(isNot("get_field_mapping"))), and( namespace(is("ml")), name( diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java index 8f965bb14f..50864315b2 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java @@ -8,6 +8,7 @@ package org.opensearch.client.codegen.model; +import java.util.Objects; import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -16,12 +17,12 @@ public class Deprecation { @Nullable private final String description; - @Nullable + @Nonnull private final Semver version; - public Deprecation(@Nullable String description, @Nullable Semver version) { + public Deprecation(@Nullable String description, @Nonnull Semver version) { this.description = description; - this.version = version; + this.version = Objects.requireNonNull(version, "version must not be null"); } @Nonnull @@ -30,7 +31,7 @@ public Optional getDescription() { } @Nonnull - public Optional getVersion() { - return Optional.ofNullable(version); + public Semver getVersion() { + return version; } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 336d53bd0c..ec6112fe38 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -209,6 +210,19 @@ public Type getJsonEndpointType() { return Types.Client.Transport.JsonEndpoint(getType(), getResponseType(), Types.Client.OpenSearch._Types.ErrorResponse); } + public Deprecation getDeprecation() { + var deprecations = new ArrayList(httpPaths.size()); + for (var httpPath : httpPaths) { + var deprecation = httpPath.getDeprecation(); + if (deprecation == null) { + return null; + } + deprecations.add(deprecation); + } + deprecations.sort(Comparator.comparing(Deprecation::getVersion)); + return deprecations.get(deprecations.size() - 1); + } + @Nonnull private static String requestClassName(@Nonnull OperationGroup operationGroup) { return classBaseName(operationGroup) + "Request"; @@ -222,7 +236,12 @@ private static String responseClassName(@Nonnull OperationGroup operationGroup) @Nonnull private static String classBaseName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); + switch (operationGroup.toString()) { + case "indices.clone": + return "CloneIndex"; + case "indices.close": + return "CloseIndex"; case "indices.create": return "CreateIndex"; case "indices.delete": @@ -233,6 +252,8 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { return "GetIndicesSettings"; case "indices.put_settings": return "PutIndicesSettings"; + case "indices.stats": + return "IndicesStats"; case "snapshot.clone": return "CloneSnapshot"; case "snapshot.create": diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 5277e76afe..219e8e5692 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; import org.apache.commons.lang3.NotImplementedException; @@ -575,7 +576,9 @@ private Type mapTypeInner(OpenApiSchema schema) { return mapAllOf(allOf.get()); } - var types = schema.getTypes().orElse(null); + var types = schema.getTypes() + .map(ts -> ts.stream().filter(t -> t != OpenApiSchemaType.Null).collect(Collectors.toSet())) + .orElse(null); if (types == null || types.size() != 1) { return Types.Client.Json.JsonData; @@ -601,7 +604,7 @@ private Type mapTypeInner(OpenApiSchema schema) { private Type mapOneOf(List oneOf) { if (isOneOfSingleAndArray(oneOf)) { - return mapType(oneOf.get(1)); + return mapType(oneOf.stream().filter(OpenApiSchema::isArray).findFirst().orElseThrow()); } var types = OpenApiSchema.determineTypes(oneOf); @@ -716,13 +719,24 @@ private static boolean isOneOfSingleAndArray(List oneOf) { if (oneOf.size() != 2) { return false; } + var first = oneOf.get(0); var second = oneOf.get(1); - if (!second.isArray()) { + + OpenApiSchema array; + OpenApiSchema single; + + if (first.isArray()) { + array = first; + single = second; + } else if (second.isArray()) { + array = second; + single = first; + } else { return false; } - var first = oneOf.get(0); - var items = second.getItems().orElseThrow(); - return first.getTypes().equals(items.getTypes()) && first.get$ref().equals(items.get$ref()); + + var items = array.getItems().orElseThrow(); + return single.getTypes().equals(items.getTypes()) && single.get$ref().equals(items.get$ref()); } private static boolean isEnum(OpenApiSchema schema) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 81e66f4613..ee1dd130ec 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -62,6 +62,8 @@ private static JsonPointer schema(String namespace, String name) { so -> so.withMappedType(t -> t.withPackage(Types.Client.OpenSearch._Types.PACKAGE).withName("SortOptions")) ) + .with(schema("_common", "GetStats"), so -> so.withProperties(p -> p.with("getTime", po -> po.withName("time")))) + .with( schema("_common.aggregations", "AggregationContainer"), so -> so.withClassName("Aggregation").withShouldGenerate(ShouldGenerate.Never) @@ -121,6 +123,8 @@ private static JsonPointer schema(String namespace, String name) { return Set.of("index." + k); } })) + + .with(schema("indices.stats", "Metric"), so -> so.withClassName("IndicesStatsMetric")) ) .build(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java index 0489c44bd4..23f3c38060 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java @@ -115,7 +115,7 @@ public Optional getVersionAdded() { @Nonnull public Optional getDeprecation() { - if (versionDeprecated == null && deprecationMessage == null) return Optional.empty(); + if (versionDeprecated == null) return Optional.empty(); return Optional.of(new Deprecation(deprecationMessage, versionDeprecated)); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java index 45e0178b46..2df682bcfc 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java @@ -87,7 +87,7 @@ public boolean isDeprecated() { @Nonnull public Optional getDeprecation() { - if (versionDeprecated == null && deprecationMessage == null) return Optional.empty(); + if (versionDeprecated == null) return Optional.empty(); return Optional.of(new Deprecation(deprecationMessage, versionDeprecated)); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java index 6c26b42bcd..467a0b5f49 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java @@ -32,6 +32,9 @@ public static String fieldName(@Nonnull String name) { if (reservedWords.contains(name)) { name += "_"; } + if (Character.isDigit(name.charAt(0))) { + name = "_" + name; + } return name; } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache index 5160e90ed9..e0cbb3b14d 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache @@ -33,6 +33,9 @@ /** * {{description}} */ + {{#deprecation}} + @Deprecated + {{/deprecation}} public {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}() throws {{TYPES.Java.Io.IOException}}, {{TYPES.Client.OpenSearch._Types.OpenSearchException}} { return this.transport.performRequest{{#async}}Async{{/async}}({{type}}._INSTANCE, {{type}}._ENDPOINT, this.transportOptions); } @@ -41,6 +44,9 @@ /** * {{description}} */ + {{#deprecation}} + @Deprecated + {{/deprecation}} public {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}({{type}} request) throws {{TYPES.Java.Io.IOException}}, {{TYPES.Client.OpenSearch._Types.OpenSearchException}} { return this.transport.performRequest{{#async}}Async{{/async}}(request, {{type.name}}._ENDPOINT, this.transportOptions); } @@ -50,6 +56,9 @@ * * @param fn a function that initializes a builder to create the {@link {{type}}} */ + {{#deprecation}} + @Deprecated + {{/deprecation}} public final {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}({{type.builderFnType}} fn) throws IOException, OpenSearchException { return {{#camelCase}}{{id}}{{/camelCase}}(fn.apply(new {{type.builderType}}()).build()); @@ -59,6 +68,9 @@ /** * {{description}} */ + {{#deprecation}} + @Deprecated + {{/deprecation}} public final {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}() throws IOException, OpenSearchException { return {{#camelCase}}{{id}}{{/camelCase}}(new {{type.builderType}}().build());