From 7444423055b1826b147a1c104d96793aee5281f8 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Mon, 24 Jan 2022 15:58:18 +0100 Subject: [PATCH] [codegen] Update to latest API specification --- .../DateOrEpochMillis.java} | 103 +- .../DateOrEpochMillisBuilders.java} | 24 +- .../elasticsearch/_types/EmptyTransform.java | 65 - .../elasticsearch/_types/ScriptTransform.java | 84 +- .../elasticsearch/_types/SortOptions.java | 3 +- .../elasticsearch/_types/Transform.java | 23 +- .../_types/TransformBuilders.java | 12 +- .../elasticsearch/_types/TransformEmpty.java | 64 - .../aggregations/BucketPathAggregation.java | 15 +- .../ClassificationInferenceOptions.java | 6 +- .../_types/aggregations/RangeBucket.java | 33 + .../RegressionInferenceOptions.java | 6 +- .../_types/query_dsl/SpanGapQuery.java | 3 +- .../async_search/AsyncSearch.java | 20 +- .../ElasticsearchAsyncSearchAsyncClient.java | 16 +- .../ElasticsearchAsyncSearchClient.java | 16 +- .../async_search/SubmitRequest.java | 38 +- .../ElasticsearchAutoscalingAsyncClient.java | 14 +- .../ElasticsearchAutoscalingClient.java | 14 +- .../cat/ElasticsearchCatAsyncClient.java | 24 +- .../cat/ElasticsearchCatClient.java | 24 +- .../cat/indices/IndicesRecord.java | 2179 +---------------- .../elasticsearch/cat/nodes/NodesRecord.java | 66 - .../cat/shards/ShardsRecord.java | 66 - .../elasticsearch/core/FieldCapsRequest.java | 42 +- .../elasticsearch/core/SearchRequest.java | 38 +- .../elasticsearch/core/SearchResponse.java | 20 +- .../core/bulk/BulkOperation.java | 11 +- .../elasticsearch/core/bulk/UpdateAction.java | 414 ++++ .../core/bulk/UpdateOperation.java | 75 +- .../elasticsearch/core/reindex/Source.java | 35 +- .../AggregationProfileDelegateDebug.java | 285 --- .../core/search/CompletionSuggest.java | 196 ++ .../core/search/CompletionSuggestOption.java | 38 +- .../core/search/PhraseSuggest.java | 142 ++ .../core/search/SuggestBase.java | 157 ++ .../core/search/SuggestOption.java | 206 -- .../elasticsearch/core/search/Suggestion.java | 270 +- ...ghterType.java => SuggestionBuilders.java} | 47 +- ...peBuilders.java => SuggestionVariant.java} | 15 +- .../core/search/TermSuggest.java | 142 ++ .../core/search/TermSuggestOption.java | 21 +- .../elasticsearch/doc-files/api-spec.html | 578 +++-- .../elasticsearch/eql/EqlSearchRequest.java | 35 +- .../ilm/ElasticsearchIlmAsyncClient.java | 49 + .../ilm/ElasticsearchIlmClient.java | 51 + .../ilm/MigrateToDataTiersRequest.java | 239 ++ .../ilm/MigrateToDataTiersResponse.java | 391 +++ .../elasticsearch/indices/CacheQueries.java | 130 + .../indices/ExistsTypeRequest.java | 359 --- .../indices/IndexSegmentSort.java | 18 +- .../elasticsearch/indices/IndexSettings.java | 354 ++- .../indices/IndexSettingsTimeSeries.java | 68 +- .../clients/elasticsearch/indices/Merge.java | 142 ++ .../elasticsearch/indices/MergeScheduler.java | 165 ++ .../indices/PutMappingRequest.java | 35 +- .../elasticsearch/indices/Queries.java | 142 ++ .../indices/SegmentSortMode.java | 12 +- .../indices/SegmentSortOrder.java | 12 +- .../elasticsearch/indices/SoftDeletes.java | 38 - .../elasticsearch/indices/Translog.java | 201 ++ .../TranslogRetention.java} | 78 +- .../IndicesGetDataStreamItem.java | 424 ---- .../indices/update_aliases/AddAction.java | 29 + .../update_aliases/RemoveIndexAction.java | 30 + .../logstash/PipelineSettings.java | 175 -- .../clients/elasticsearch/ml/Datafeed.java | 35 +- .../elasticsearch/ml/DatafeedConfig.java | 37 +- .../ml/DataframeAnalyticsSource.java | 38 +- .../ml/ElasticsearchMlAsyncClient.java | 28 +- .../ml/ElasticsearchMlClient.java | 28 +- .../ml/EvaluateDataFrameRequest.java | 12 +- .../ml/ExplainDataFrameAnalyticsRequest.java | 36 +- .../elasticsearch/ml/ModelPlotConfig.java | 3 - .../ml/PreviewDataFrameAnalyticsRequest.java | 18 +- .../ml/PutDataFrameAnalyticsRequest.java | 22 +- .../elasticsearch/ml/PutDatafeedRequest.java | 37 +- .../elasticsearch/ml/PutDatafeedResponse.java | 35 +- .../ml/UpdateDataFrameAnalyticsRequest.java | 18 +- .../ml/UpdateDatafeedRequest.java | 37 +- .../ml/UpdateDatafeedResponse.java | 35 +- .../nodes/info/NodeInfoSettingsHttp.java | 29 - .../nodes/info/NodeInfoSettingsTransport.java | 30 - .../rollup/GetRollupIndexCapsRequest.java | 31 +- .../rollup/delete_job/TaskFailure.java | 211 -- .../CacheStatsRequest.java | 218 ++ .../CacheStatsResponse.java} | 92 +- ...csearchSearchableSnapshotsAsyncClient.java | 46 + ...lasticsearchSearchableSnapshotsClient.java | 46 + .../cache_stats/Node.java | 138 ++ .../cache_stats/Shared.java | 303 +++ .../ElasticsearchSecurityAsyncClient.java | 247 ++ .../security/ElasticsearchSecurityClient.java | 255 ++ .../security/EnrollKibanaRequest.java | 83 + .../EnrollKibanaResponse.java} | 88 +- .../security/EnrollNodeRequest.java | 82 + .../security/EnrollNodeResponse.java | 273 +++ .../security/GetPrivilegesRequest.java | 35 +- .../security/SamlAuthenticateRequest.java | 259 ++ .../security/SamlAuthenticateResponse.java | 230 ++ .../security/SamlCompleteLogoutRequest.java | 297 +++ .../SamlCompleteLogoutResponse.java} | 19 +- .../security/SamlInvalidateRequest.java | 258 ++ .../security/SamlInvalidateResponse.java | 182 ++ .../security/SamlLogoutRequest.java | 207 ++ .../security/SamlLogoutResponse.java | 131 + .../SamlPrepareAuthenticationRequest.java | 253 ++ .../SamlPrepareAuthenticationResponse.java | 182 ++ .../SamlServiceProviderMetadataRequest.java | 151 ++ .../SamlServiceProviderMetadataResponse.java | 137 ++ .../enroll_kibana/Token.java} | 60 +- .../security/get_api_key/ApiKey.java | 330 --- .../security/grant_api_key/ApiKey.java | 227 -- .../elasticsearch/sql/{query => }/Column.java | 7 +- .../elasticsearch/sql/DeleteAsyncRequest.java | 150 ++ .../DeleteAsyncResponse.java} | 37 +- .../sql/ElasticsearchSqlAsyncClient.java | 105 + .../sql/ElasticsearchSqlClient.java | 108 + .../elasticsearch/sql/GetAsyncRequest.java | 300 +++ .../elasticsearch/sql/GetAsyncResponse.java | 373 +++ .../sql/GetAsyncStatusRequest.java | 150 ++ .../sql/GetAsyncStatusResponse.java | 303 +++ .../elasticsearch/sql/QueryResponse.java | 149 +- .../clients/elasticsearch/tasks/Info.java | 479 ---- .../clients/elasticsearch/tasks/State.java | 425 ---- .../clients/elasticsearch/tasks/Status.java | 589 ----- .../tasks/TaskExecutingNode.java | 159 -- .../transform/GetTransformStatsRequest.java | 35 +- .../elasticsearch/transform/Settings.java | 35 + .../elasticsearch/transform/Source.java | 39 +- .../clients/elasticsearch/watcher/Action.java | 150 +- .../watcher/CompareCondition.java | 74 - .../CompareContextPayloadCondition.java | 255 -- .../DataAttachmentFormat.java} | 22 +- .../watcher/DataEmailAttachment.java | 143 ++ .../clients/elasticsearch/watcher/Email.java | 204 +- .../elasticsearch/watcher/EmailAction.java | 93 + .../watcher/EmailAttachment.java | 238 ++ .../EmailAttachmentBuilders.java} | 32 +- .../watcher/EmailAttachmentVariant.java | 37 + .../elasticsearch/watcher/EmailBody.java | 36 +- .../watcher/HttpEmailAttachment.java | 212 ++ .../watcher/{Index.java => IndexAction.java} | 123 +- .../{Logging.java => LoggingAction.java} | 28 +- .../watcher/PagerDutyAction.java | 95 + .../watcher/PagerDutyActionEventResult.java | 228 -- .../elasticsearch/watcher/PagerDutyEvent.java | 172 +- ...nWebhook.java => PagerDutyEventProxy.java} | 69 +- .../watcher/ReportingEmailAttachment.java | 276 +++ .../watcher/ScriptCondition.java | 64 +- .../elasticsearch/watcher/SlackAction.java | 167 ++ .../elasticsearch/watcher/WebhookAction.java | 95 + .../xpack/usage/MlDataFrameAnalyticsJobs.java | 53 +- .../MlDataFrameAnalyticsJobsAnalysis.java | 197 ++ .../usage/MlInferenceTrainedModelsCount.java | 29 + 155 files changed, 12266 insertions(+), 8645 deletions(-) rename java-client/src/main/java/co/elastic/clients/elasticsearch/{indices/rollover/IndexRolloverMapping.java => _types/DateOrEpochMillis.java} (52%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/{indices/rollover/IndexRolloverMappingBuilders.java => _types/DateOrEpochMillisBuilders.java} (60%) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyTransform.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/TransformEmpty.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/AggregationProfileDelegateDebug.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/CompletionSuggest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestBase.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestOption.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/{BuiltinHighlighterType.java => SuggestionBuilders.java} (58%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/{HighlighterTypeBuilders.java => SuggestionVariant.java} (77%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/TermSuggest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Queries.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{rollup/delete_job/TaskFailureReason.java => indices/TranslogRetention.java} (58%) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItem.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailure.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsRequest.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{_types/ChainTransform.java => searchable_snapshots/CacheStatsResponse.java} (52%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Node.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Shared.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaRequest.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{indices/get_data_stream/IndicesGetDataStreamItemIndex.java => security/EnrollKibanaResponse.java} (54%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutRequest.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{indices/ExistsTypeResponse.java => security/SamlCompleteLogoutResponse.java} (69%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataResponse.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{indices/get_data_stream/IndicesGetDataStreamItemTimestampField.java => security/enroll_kibana/Token.java} (67%) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_api_key/ApiKey.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/grant_api_key/ApiKey.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/sql/{query => }/Column.java (95%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{_types/aggregations/ChildrenAggregateBucket.java => sql/DeleteAsyncResponse.java} (62%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusResponse.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Info.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/State.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Status.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskExecutingNode.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/CompareContextPayloadCondition.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{cat/thread_pool/ThreadPoolSize.java => watcher/DataAttachmentFormat.java} (76%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataEmailAttachment.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAction.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachment.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{core/search/SuggestOptionBuilders.java => watcher/EmailAttachmentBuilders.java} (55%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentVariant.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/HttpEmailAttachment.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/{Index.java => IndexAction.java} (60%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/{Logging.java => LoggingAction.java} (85%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyAction.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyActionEventResult.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/{ActionWebhook.java => PagerDutyEventProxy.java} (66%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ReportingEmailAttachment.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SlackAction.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/WebhookAction.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/MlDataFrameAnalyticsJobsAnalysis.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillis.java similarity index 52% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMapping.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillis.java index 4e5896229..581829596 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMapping.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillis.java @@ -21,9 +21,8 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.indices.rollover; +package co.elastic.clients.elasticsearch._types; -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -36,26 +35,25 @@ import co.elastic.clients.util.TaggedUnion; import co.elastic.clients.util.TaggedUnionUtils; import jakarta.json.stream.JsonGenerator; +import java.lang.Long; import java.lang.Object; import java.lang.String; -import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; -// typedef: indices.rollover.IndexRolloverMapping +// typedef: _types.DateOrEpochMillis /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class IndexRolloverMapping implements TaggedUnion, JsonpSerializable { +public class DateOrEpochMillis implements TaggedUnion, JsonpSerializable { public enum Kind { - ByType, Single + Date, Millis } @@ -72,54 +70,66 @@ public final Object _get() { return _value; } - private IndexRolloverMapping(Kind kind, Object value) { + private DateOrEpochMillis(Kind kind, Object value) { this._kind = kind; this._value = value; } - private IndexRolloverMapping(Builder builder) { + public String _toJsonString() { + switch (_kind) { + case Date : + return this.date(); + case Millis : + return String.valueOf(this.millis()); + + default : + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private DateOrEpochMillis(Builder builder) { this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); } - public static IndexRolloverMapping of(Function> fn) { + public static DateOrEpochMillis of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Is this variant instance of kind {@code by_type}? + * Is this variant instance of kind {@code date}? */ - public boolean isByType() { - return _kind == Kind.ByType; + public boolean isDate() { + return _kind == Kind.Date; } /** - * Get the {@code by_type} variant value. + * Get the {@code date} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code by_type} kind. + * if the current variant is not of the {@code date} kind. */ - public Map byType() { - return TaggedUnionUtils.get(this, Kind.ByType); + public String date() { + return TaggedUnionUtils.get(this, Kind.Date); } /** - * Is this variant instance of kind {@code single}? + * Is this variant instance of kind {@code millis}? */ - public boolean isSingle() { - return _kind == Kind.Single; + public boolean isMillis() { + return _kind == Kind.Millis; } /** - * Get the {@code single} variant value. + * Get the {@code millis} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code single} kind. + * if the current variant is not of the {@code millis} kind. */ - public TypeMapping single() { - return TaggedUnionUtils.get(this, Kind.Single); + public Long millis() { + return TaggedUnionUtils.get(this, Kind.Millis); } @Override @@ -128,14 +138,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { ((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); + case Date : + generator.write(((String) this._value)); - } - generator.writeEnd(); + break; + case Millis : + generator.write(((Long) this._value)); break; } @@ -143,40 +151,35 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; - public ObjectBuilder byType(Map v) { - this._kind = Kind.ByType; + public ObjectBuilder date(String v) { + this._kind = Kind.Date; this._value = v; return this; } - public ObjectBuilder single(TypeMapping v) { - this._kind = Kind.Single; + public ObjectBuilder millis(Long v) { + this._kind = Kind.Millis; this._value = v; return this; } - public ObjectBuilder single( - Function> fn) { - return this.single(fn.apply(new TypeMapping.Builder()).build()); - } - - public IndexRolloverMapping build() { + public DateOrEpochMillis build() { _checkSingleUse(); - return new IndexRolloverMapping(this); + return new DateOrEpochMillis(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(); + private static JsonpDeserializer buildDateOrEpochMillisDeserializer() { + return new UnionDeserializer.Builder(DateOrEpochMillis::new, false) + .addMember(Kind.Date, JsonpDeserializer.stringDeserializer()) + .addMember(Kind.Millis, JsonpDeserializer.longDeserializer()).build(); } - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(IndexRolloverMapping::buildIndexRolloverMappingDeserializer); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(DateOrEpochMillis::buildDateOrEpochMillisDeserializer); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMappingBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillisBuilders.java similarity index 60% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMappingBuilders.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillisBuilders.java index 701271f83..d30d06d0b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/IndexRolloverMappingBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/DateOrEpochMillisBuilders.java @@ -21,28 +21,18 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.indices.rollover; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import java.lang.String; +package co.elastic.clients.elasticsearch._types; /** - * Builders for {@link IndexRolloverMapping} variants. + * Builders for {@link DateOrEpochMillis} variants. *

- * Variants by_type are not available here as they don't have a - * dedicated class. Use {@link IndexRolloverMapping}'s builder for these. + * Variants date, millis are not available here as + * they don't have a dedicated class. Use {@link DateOrEpochMillis}'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(); +public class DateOrEpochMillisBuilders { + private DateOrEpochMillisBuilders() { } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyTransform.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyTransform.java deleted file mode 100644 index a39e6eb96..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyTransform.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EmptyTransform implements JsonpSerializable { - - public static final class Builder implements ObjectBuilder { - @Override - public EmptyTransform build() { - return EmptyTransform._INSTANCE; - } - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } - - /** - * Singleton instance for empty class {@link EmptyTransform}. - */ - public static final EmptyTransform _INSTANCE = new EmptyTransform(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyTransform._INSTANCE); - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java index 79a16d32d..bd3107659 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java @@ -49,16 +49,25 @@ */ @JsonpDeserializable public class ScriptTransform implements TransformVariant, JsonpSerializable { + @Nullable private final String lang; private final Map params; + @Nullable + private final String source; + + @Nullable + private final String id; + // --------------------------------------------------------------------------------------------- private ScriptTransform(Builder builder) { - this.lang = ApiTypeHelper.requireNonNull(builder.lang, this, "lang"); - this.params = ApiTypeHelper.unmodifiableRequired(builder.params, this, "params"); + this.lang = builder.lang; + this.params = ApiTypeHelper.unmodifiable(builder.params); + this.source = builder.source; + this.id = builder.id; } @@ -75,19 +84,36 @@ public Transform.Kind _transformKind() { } /** - * Required - API name: {@code lang} + * API name: {@code lang} */ + @Nullable public final String lang() { return this.lang; } /** - * Required - API name: {@code params} + * API name: {@code params} */ public final Map params() { return this.params; } + /** + * API name: {@code source} + */ + @Nullable + public final String source() { + return this.source; + } + + /** + * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + /** * Serialize this object to JSON. */ @@ -99,9 +125,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("lang"); - generator.write(this.lang); + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + } if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); generator.writeStartObject(); @@ -113,6 +141,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.source != null) { + generator.writeKey("source"); + generator.write(this.source); + + } + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } } @@ -123,20 +161,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private String lang; + @Nullable private Map params; + @Nullable + private String source; + + @Nullable + private String id; + /** - * Required - API name: {@code lang} + * API name: {@code lang} */ - public final Builder lang(String value) { + public final Builder lang(@Nullable String value) { this.lang = value; return this; } /** - * Required - API name: {@code params} + * API name: {@code params} *

* Adds all entries of map to params. */ @@ -146,7 +192,7 @@ public final Builder params(Map map) { } /** - * Required - API name: {@code params} + * API name: {@code params} *

* Adds an entry to params. */ @@ -155,6 +201,22 @@ public final Builder params(String key, JsonData value) { return this; } + /** + * API name: {@code source} + */ + public final Builder source(@Nullable String value) { + this.source = value; + return this; + } + + /** + * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + /** * Builds a {@link ScriptTransform}. * @@ -180,6 +242,8 @@ protected static void setupScriptTransformDeserializer(ObjectDeserializer - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java index 03b18118c..514e3f0d6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java @@ -98,7 +98,7 @@ public class EqlSearchRequest extends RequestBase implements JsonpSerializable { @Nullable private final ResultPosition resultPosition; - private final Map runtimeMappings; + private final Map> runtimeMappings; @Nullable private final Number size; @@ -259,7 +259,7 @@ public final ResultPosition resultPosition() { /** * API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -368,9 +368,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -444,7 +451,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private Number size; @@ -670,7 +677,7 @@ public final Builder resultPosition(@Nullable ResultPosition value) { *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -680,21 +687,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * For basic queries, the maximum number of matching events to return. Defaults * to 10 @@ -773,8 +770,8 @@ protected static void setupEqlSearchRequestDeserializer(ObjectDeserializer getStatus() { this.transportOptions); } + // ----- Endpoint: ilm.migrate_to_data_tiers + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture migrateToDataTiers(MigrateToDataTiersRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataTiersRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @param fn + * a function that initializes a builder to create the + * {@link MigrateToDataTiersRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture migrateToDataTiers( + Function> fn) { + return migrateToDataTiers(fn.apply(new MigrateToDataTiersRequest.Builder()).build()); + } + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture migrateToDataTiers() { + return this.transport.performRequestAsync(new MigrateToDataTiersRequest.Builder().build(), + MigrateToDataTiersRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: ilm.move_to_step /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java index a0102cff2..2c22b4ecd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java @@ -192,6 +192,57 @@ public GetIlmStatusResponse getStatus() throws IOException, ElasticsearchExcepti this.transportOptions); } + // ----- Endpoint: ilm.migrate_to_data_tiers + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @see Documentation + * on elastic.co + */ + + public MigrateToDataTiersResponse migrateToDataTiers(MigrateToDataTiersRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataTiersRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @param fn + * a function that initializes a builder to create the + * {@link MigrateToDataTiersRequest} + * @see Documentation + * on elastic.co + */ + + public final MigrateToDataTiersResponse migrateToDataTiers( + Function> fn) + throws IOException, ElasticsearchException { + return migrateToDataTiers(fn.apply(new MigrateToDataTiersRequest.Builder()).build()); + } + + /** + * Migrates the indices and ILM policies away from custom node attribute + * allocation routing to data tiers routing + * + * @see Documentation + * on elastic.co + */ + + public MigrateToDataTiersResponse migrateToDataTiers() throws IOException, ElasticsearchException { + return this.transport.performRequest(new MigrateToDataTiersRequest.Builder().build(), + MigrateToDataTiersRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: ilm.move_to_step /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersRequest.java new file mode 100644 index 000000000..6dc4ac29a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersRequest.java @@ -0,0 +1,239 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ilm.migrate_to_data_tiers.Request + +/** + * Switches the indices, ILM policies, and legacy, composable and component + * templates from using custom node attributes and attribute-based allocation + * filters to using data tiers, and optionally deletes one legacy index + * template.+ Using node roles enables ILM to automatically move the indices + * between data tiers. + * + * @see API + * specification + */ +@JsonpDeserializable +public class MigrateToDataTiersRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Boolean dryRun; + + @Nullable + private final String legacyTemplateToDelete; + + @Nullable + private final String nodeAttribute; + + // --------------------------------------------------------------------------------------------- + + private MigrateToDataTiersRequest(Builder builder) { + + this.dryRun = builder.dryRun; + this.legacyTemplateToDelete = builder.legacyTemplateToDelete; + this.nodeAttribute = builder.nodeAttribute; + + } + + public static MigrateToDataTiersRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If true, simulates the migration from node attributes based allocation + * filters to data tiers, but does not perform the migration. This provides a + * way to retrieve the indices and ILM policies that need to be migrated. + *

+ * API name: {@code dry_run} + */ + @Nullable + public final Boolean dryRun() { + return this.dryRun; + } + + /** + * API name: {@code legacy_template_to_delete} + */ + @Nullable + public final String legacyTemplateToDelete() { + return this.legacyTemplateToDelete; + } + + /** + * API name: {@code node_attribute} + */ + @Nullable + public final String nodeAttribute() { + return this.nodeAttribute; + } + + /** + * 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.legacyTemplateToDelete != null) { + generator.writeKey("legacy_template_to_delete"); + generator.write(this.legacyTemplateToDelete); + + } + if (this.nodeAttribute != null) { + generator.writeKey("node_attribute"); + generator.write(this.nodeAttribute); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MigrateToDataTiersRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Boolean dryRun; + + @Nullable + private String legacyTemplateToDelete; + + @Nullable + private String nodeAttribute; + + /** + * If true, simulates the migration from node attributes based allocation + * filters to data tiers, but does not perform the migration. This provides a + * way to retrieve the indices and ILM policies that need to be migrated. + *

+ * API name: {@code dry_run} + */ + public final Builder dryRun(@Nullable Boolean value) { + this.dryRun = value; + return this; + } + + /** + * API name: {@code legacy_template_to_delete} + */ + public final Builder legacyTemplateToDelete(@Nullable String value) { + this.legacyTemplateToDelete = value; + return this; + } + + /** + * API name: {@code node_attribute} + */ + public final Builder nodeAttribute(@Nullable String value) { + this.nodeAttribute = value; + return this; + } + + /** + * Builds a {@link MigrateToDataTiersRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MigrateToDataTiersRequest build() { + _checkSingleUse(); + + return new MigrateToDataTiersRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MigrateToDataTiersRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, MigrateToDataTiersRequest::setupMigrateToDataTiersRequestDeserializer); + + protected static void setupMigrateToDataTiersRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::legacyTemplateToDelete, JsonpDeserializer.stringDeserializer(), "legacy_template_to_delete"); + op.add(Builder::nodeAttribute, JsonpDeserializer.stringDeserializer(), "node_attribute"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ilm.migrate_to_data_tiers}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/ilm.migrate_to_data_tiers", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_ilm/migrate_to_data_tiers"; + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.dryRun != null) { + params.put("dry_run", String.valueOf(request.dryRun)); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, MigrateToDataTiersResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersResponse.java new file mode 100644 index 000000000..60222893c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateToDataTiersResponse.java @@ -0,0 +1,391 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ilm.migrate_to_data_tiers.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class MigrateToDataTiersResponse implements JsonpSerializable { + private final boolean dryRun; + + private final String removedLegacyTemplate; + + private final List migratedIlmPolicies; + + private final List migratedIndices; + + private final List migratedLegacyTemplates; + + private final List migratedComposableTemplates; + + private final List migratedComponentTemplates; + + // --------------------------------------------------------------------------------------------- + + private MigrateToDataTiersResponse(Builder builder) { + + this.dryRun = ApiTypeHelper.requireNonNull(builder.dryRun, this, "dryRun"); + this.removedLegacyTemplate = ApiTypeHelper.requireNonNull(builder.removedLegacyTemplate, this, + "removedLegacyTemplate"); + this.migratedIlmPolicies = ApiTypeHelper.unmodifiableRequired(builder.migratedIlmPolicies, this, + "migratedIlmPolicies"); + this.migratedIndices = ApiTypeHelper.unmodifiableRequired(builder.migratedIndices, this, "migratedIndices"); + this.migratedLegacyTemplates = ApiTypeHelper.unmodifiableRequired(builder.migratedLegacyTemplates, this, + "migratedLegacyTemplates"); + this.migratedComposableTemplates = ApiTypeHelper.unmodifiableRequired(builder.migratedComposableTemplates, this, + "migratedComposableTemplates"); + this.migratedComponentTemplates = ApiTypeHelper.unmodifiableRequired(builder.migratedComponentTemplates, this, + "migratedComponentTemplates"); + + } + + public static MigrateToDataTiersResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code dry_run} + */ + public final boolean dryRun() { + return this.dryRun; + } + + /** + * Required - API name: {@code removed_legacy_template} + */ + public final String removedLegacyTemplate() { + return this.removedLegacyTemplate; + } + + /** + * Required - API name: {@code migrated_ilm_policies} + */ + public final List migratedIlmPolicies() { + return this.migratedIlmPolicies; + } + + /** + * Required - API name: {@code migrated_indices} + */ + public final List migratedIndices() { + return this.migratedIndices; + } + + /** + * Required - API name: {@code migrated_legacy_templates} + */ + public final List migratedLegacyTemplates() { + return this.migratedLegacyTemplates; + } + + /** + * Required - API name: {@code migrated_composable_templates} + */ + public final List migratedComposableTemplates() { + return this.migratedComposableTemplates; + } + + /** + * Required - API name: {@code migrated_component_templates} + */ + public final List migratedComponentTemplates() { + return this.migratedComponentTemplates; + } + + /** + * 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("dry_run"); + generator.write(this.dryRun); + + generator.writeKey("removed_legacy_template"); + generator.write(this.removedLegacyTemplate); + + if (ApiTypeHelper.isDefined(this.migratedIlmPolicies)) { + generator.writeKey("migrated_ilm_policies"); + generator.writeStartArray(); + for (String item0 : this.migratedIlmPolicies) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.migratedIndices)) { + generator.writeKey("migrated_indices"); + generator.writeStartArray(); + for (String item0 : this.migratedIndices) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.migratedLegacyTemplates)) { + generator.writeKey("migrated_legacy_templates"); + generator.writeStartArray(); + for (String item0 : this.migratedLegacyTemplates) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.migratedComposableTemplates)) { + generator.writeKey("migrated_composable_templates"); + generator.writeStartArray(); + for (String item0 : this.migratedComposableTemplates) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.migratedComponentTemplates)) { + generator.writeKey("migrated_component_templates"); + generator.writeStartArray(); + for (String item0 : this.migratedComponentTemplates) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MigrateToDataTiersResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Boolean dryRun; + + private String removedLegacyTemplate; + + private List migratedIlmPolicies; + + private List migratedIndices; + + private List migratedLegacyTemplates; + + private List migratedComposableTemplates; + + private List migratedComponentTemplates; + + /** + * Required - API name: {@code dry_run} + */ + public final Builder dryRun(boolean value) { + this.dryRun = value; + return this; + } + + /** + * Required - API name: {@code removed_legacy_template} + */ + public final Builder removedLegacyTemplate(String value) { + this.removedLegacyTemplate = value; + return this; + } + + /** + * Required - API name: {@code migrated_ilm_policies} + *

+ * Adds all elements of list to migratedIlmPolicies. + */ + public final Builder migratedIlmPolicies(List list) { + this.migratedIlmPolicies = _listAddAll(this.migratedIlmPolicies, list); + return this; + } + + /** + * Required - API name: {@code migrated_ilm_policies} + *

+ * Adds one or more values to migratedIlmPolicies. + */ + public final Builder migratedIlmPolicies(String value, String... values) { + this.migratedIlmPolicies = _listAdd(this.migratedIlmPolicies, value, values); + return this; + } + + /** + * Required - API name: {@code migrated_indices} + *

+ * Adds all elements of list to migratedIndices. + */ + public final Builder migratedIndices(List list) { + this.migratedIndices = _listAddAll(this.migratedIndices, list); + return this; + } + + /** + * Required - API name: {@code migrated_indices} + *

+ * Adds one or more values to migratedIndices. + */ + public final Builder migratedIndices(String value, String... values) { + this.migratedIndices = _listAdd(this.migratedIndices, value, values); + return this; + } + + /** + * Required - API name: {@code migrated_legacy_templates} + *

+ * Adds all elements of list to + * migratedLegacyTemplates. + */ + public final Builder migratedLegacyTemplates(List list) { + this.migratedLegacyTemplates = _listAddAll(this.migratedLegacyTemplates, list); + return this; + } + + /** + * Required - API name: {@code migrated_legacy_templates} + *

+ * Adds one or more values to migratedLegacyTemplates. + */ + public final Builder migratedLegacyTemplates(String value, String... values) { + this.migratedLegacyTemplates = _listAdd(this.migratedLegacyTemplates, value, values); + return this; + } + + /** + * Required - API name: {@code migrated_composable_templates} + *

+ * Adds all elements of list to + * migratedComposableTemplates. + */ + public final Builder migratedComposableTemplates(List list) { + this.migratedComposableTemplates = _listAddAll(this.migratedComposableTemplates, list); + return this; + } + + /** + * Required - API name: {@code migrated_composable_templates} + *

+ * Adds one or more values to migratedComposableTemplates. + */ + public final Builder migratedComposableTemplates(String value, String... values) { + this.migratedComposableTemplates = _listAdd(this.migratedComposableTemplates, value, values); + return this; + } + + /** + * Required - API name: {@code migrated_component_templates} + *

+ * Adds all elements of list to + * migratedComponentTemplates. + */ + public final Builder migratedComponentTemplates(List list) { + this.migratedComponentTemplates = _listAddAll(this.migratedComponentTemplates, list); + return this; + } + + /** + * Required - API name: {@code migrated_component_templates} + *

+ * Adds one or more values to migratedComponentTemplates. + */ + public final Builder migratedComponentTemplates(String value, String... values) { + this.migratedComponentTemplates = _listAdd(this.migratedComponentTemplates, value, values); + return this; + } + + /** + * Builds a {@link MigrateToDataTiersResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MigrateToDataTiersResponse build() { + _checkSingleUse(); + + return new MigrateToDataTiersResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MigrateToDataTiersResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, MigrateToDataTiersResponse::setupMigrateToDataTiersResponseDeserializer); + + protected static void setupMigrateToDataTiersResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::dryRun, JsonpDeserializer.booleanDeserializer(), "dry_run"); + op.add(Builder::removedLegacyTemplate, JsonpDeserializer.stringDeserializer(), "removed_legacy_template"); + op.add(Builder::migratedIlmPolicies, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "migrated_ilm_policies"); + op.add(Builder::migratedIndices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "migrated_indices"); + op.add(Builder::migratedLegacyTemplates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "migrated_legacy_templates"); + op.add(Builder::migratedComposableTemplates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "migrated_composable_templates"); + op.add(Builder::migratedComponentTemplates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "migrated_component_templates"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java new file mode 100644 index 000000000..778b3d1c5 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.util.Objects; +import java.util.function.Function; + +// typedef: indices._types.CacheQueries + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class CacheQueries implements JsonpSerializable { + private final boolean enabled; + + // --------------------------------------------------------------------------------------------- + + private CacheQueries(Builder builder) { + + this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled"); + + } + + public static CacheQueries of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code enabled} + */ + public final boolean enabled() { + return this.enabled; + } + + /** + * 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("enabled"); + generator.write(this.enabled); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CacheQueries}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Boolean enabled; + + /** + * Required - API name: {@code enabled} + */ + public final Builder enabled(boolean value) { + this.enabled = value; + return this; + } + + /** + * Builds a {@link CacheQueries}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CacheQueries build() { + _checkSingleUse(); + + return new CacheQueries(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CacheQueries} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + CacheQueries::setupCacheQueriesDeserializer); + + protected static void setupCacheQueriesDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeRequest.java deleted file mode 100644 index b9ae87acb..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeRequest.java +++ /dev/null @@ -1,359 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.BooleanEndpoint; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -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.Nullable; - -// typedef: indices.exists_type.Request - -/** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - * @see API - * specification - */ - -public class ExistsTypeRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean local; - - private final List type; - - // --------------------------------------------------------------------------------------------- - - private ExistsTypeRequest(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.local = builder.local; - this.type = ApiTypeHelper.unmodifiableRequired(builder.type, this, "type"); - - } - - public static ExistsTypeRequest 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 index names; use _all to - * check the types across all indices - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * Return local information, do not retrieve the state from master node - * (default: false) - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * Required - A comma-separated list of document types to check - *

- * API name: {@code type} - */ - public final List type() { - return this.type; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExistsTypeRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Nullable - private Boolean local; - - private List type; - - /** - * 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 index names; use _all to - * check the types across all indices - *

- * 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 index names; use _all to - * check the types across all indices - *

- * 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; - } - - /** - * Return local information, do not retrieve the state from master node - * (default: false) - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; - } - - /** - * Required - A comma-separated list of document types to check - *

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

- * Adds all elements of list to type. - */ - public final Builder type(List list) { - this.type = _listAddAll(this.type, list); - return this; - } - - /** - * Required - A comma-separated list of document types to check - *

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

- * Adds one or more values to type. - */ - public final Builder type(String value, String... values) { - this.type = _listAdd(this.type, value, values); - return this; - } - - /** - * Builds a {@link ExistsTypeRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExistsTypeRequest build() { - _checkSingleUse(); - - return new ExistsTypeRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.exists_type}". - */ - public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "es/indices.exists_type", - - // Request method - request -> { - return "HEAD"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - final int _type = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _type; - - if (propsSet == (_index | _type)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mapping"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.type.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - 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.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, null); -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java index f51df4455..75484f626 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java @@ -60,8 +60,8 @@ public class IndexSegmentSort implements JsonpSerializable { private IndexSegmentSort(Builder builder) { - this.field = ApiTypeHelper.unmodifiableRequired(builder.field, this, "field"); - this.order = ApiTypeHelper.unmodifiableRequired(builder.order, this, "order"); + this.field = ApiTypeHelper.unmodifiable(builder.field); + this.order = ApiTypeHelper.unmodifiable(builder.order); this.mode = ApiTypeHelper.unmodifiable(builder.mode); this.missing = ApiTypeHelper.unmodifiable(builder.missing); @@ -72,14 +72,14 @@ public static IndexSegmentSort of(Function field() { return this.field; } /** - * Required - API name: {@code order} + * API name: {@code order} */ public final List order() { return this.order; @@ -157,8 +157,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private List field; + @Nullable private List order; @Nullable @@ -168,7 +170,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder missing; /** - * Required - API name: {@code field} + * API name: {@code field} *

* Adds all elements of list to field. */ @@ -178,7 +180,7 @@ public final Builder field(List list) { } /** - * Required - API name: {@code field} + * API name: {@code field} *

* Adds one or more values to field. */ @@ -188,7 +190,7 @@ public final Builder field(String value, String... values) { } /** - * Required - API name: {@code order} + * API name: {@code order} *

* Adds all elements of list to order. */ @@ -198,7 +200,7 @@ public final Builder order(List list) { } /** - * Required - API name: {@code order} + * API name: {@code order} *

* Adds one or more values to order. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java index f14b9c191..7a30602c2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java @@ -74,6 +74,14 @@ public class IndexSettings implements JsonpSerializable { @Nullable private final IndexSegmentSort sort; + private final List sortField; + + private final List sortOrder; + + private final List sortMode; + + private final List sortMissing; + @Nullable private final String numberOfShards; @@ -102,10 +110,7 @@ public class IndexSettings implements JsonpSerializable { private final String autoExpandReplicas; @Nullable - private final Integer mergeSchedulerMaxThreadCount; - - @Nullable - private final Integer mergeSchedulerMaxMergeCount; + private final Merge merge; @Nullable private final Time searchIdleAfter; @@ -210,10 +215,7 @@ public class IndexSettings implements JsonpSerializable { private final Integer maxSlicesPerScroll; @Nullable - private final String translogDurability; - - @Nullable - private final String translogFlushThresholdSize; + private final Translog translog; @Nullable private final Boolean queryStringLenient; @@ -233,6 +235,12 @@ public class IndexSettings implements JsonpSerializable { @Nullable private final IndexSettingsTimeSeries timeSeries; + @Nullable + private final Integer shards; + + @Nullable + private final Queries queries; + // --------------------------------------------------------------------------------------------- private IndexSettings(Builder builder) { @@ -244,6 +252,10 @@ private IndexSettings(Builder builder) { this.softDeletesEnabled = builder.softDeletesEnabled; this.softDeletesRetentionLeasePeriod = builder.softDeletesRetentionLeasePeriod; this.sort = builder.sort; + this.sortField = ApiTypeHelper.unmodifiable(builder.sortField); + this.sortOrder = ApiTypeHelper.unmodifiable(builder.sortOrder); + this.sortMode = ApiTypeHelper.unmodifiable(builder.sortMode); + this.sortMissing = ApiTypeHelper.unmodifiable(builder.sortMissing); this.numberOfShards = builder.numberOfShards; this.numberOfReplicas = builder.numberOfReplicas; this.numberOfRoutingShards = builder.numberOfRoutingShards; @@ -253,8 +265,7 @@ private IndexSettings(Builder builder) { this.loadFixedBitsetFiltersEagerly = builder.loadFixedBitsetFiltersEagerly; this.hidden = builder.hidden; this.autoExpandReplicas = builder.autoExpandReplicas; - this.mergeSchedulerMaxThreadCount = builder.mergeSchedulerMaxThreadCount; - this.mergeSchedulerMaxMergeCount = builder.mergeSchedulerMaxMergeCount; + this.merge = builder.merge; this.searchIdleAfter = builder.searchIdleAfter; this.refreshInterval = builder.refreshInterval; this.maxResultWindow = builder.maxResultWindow; @@ -289,14 +300,15 @@ private IndexSettings(Builder builder) { this.verifiedBeforeClose = builder.verifiedBeforeClose; this.format = builder.format; this.maxSlicesPerScroll = builder.maxSlicesPerScroll; - this.translogDurability = builder.translogDurability; - this.translogFlushThresholdSize = builder.translogFlushThresholdSize; + this.translog = builder.translog; this.queryStringLenient = builder.queryStringLenient; this.priority = builder.priority; this.topMetricsMaxSize = builder.topMetricsMaxSize; this.analysis = builder.analysis; this.settings = builder.settings; this.timeSeries = builder.timeSeries; + this.shards = builder.shards; + this.queries = builder.queries; } @@ -359,6 +371,34 @@ public final IndexSegmentSort sort() { return this.sort; } + /** + * API name: {@code sort.field} + */ + public final List sortField() { + return this.sortField; + } + + /** + * API name: {@code sort.order} + */ + public final List sortOrder() { + return this.sortOrder; + } + + /** + * API name: {@code sort.mode} + */ + public final List sortMode() { + return this.sortMode; + } + + /** + * API name: {@code sort.missing} + */ + public final List sortMissing() { + return this.sortMissing; + } + /** * API name: {@code number_of_shards} */ @@ -432,19 +472,11 @@ public final String autoExpandReplicas() { } /** - * API name: {@code merge.scheduler.max_thread_count} - */ - @Nullable - public final Integer mergeSchedulerMaxThreadCount() { - return this.mergeSchedulerMaxThreadCount; - } - - /** - * API name: {@code merge.scheduler.max_merge_count} + * API name: {@code merge} */ @Nullable - public final Integer mergeSchedulerMaxMergeCount() { - return this.mergeSchedulerMaxMergeCount; + public final Merge merge() { + return this.merge; } /** @@ -720,19 +752,11 @@ public final Integer maxSlicesPerScroll() { } /** - * API name: {@code translog.durability} - */ - @Nullable - public final String translogDurability() { - return this.translogDurability; - } - - /** - * API name: {@code translog.flush_threshold_size} + * API name: {@code translog} */ @Nullable - public final String translogFlushThresholdSize() { - return this.translogFlushThresholdSize; + public final Translog translog() { + return this.translog; } /** @@ -783,6 +807,22 @@ public final IndexSettingsTimeSeries timeSeries() { return this.timeSeries; } + /** + * API name: {@code shards} + */ + @Nullable + public final Integer shards() { + return this.shards; + } + + /** + * API name: {@code queries} + */ + @Nullable + public final Queries queries() { + return this.queries; + } + /** * Serialize this object to JSON. */ @@ -833,6 +873,43 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("sort"); this.sort.serialize(generator, mapper); + } + if (ApiTypeHelper.isDefined(this.sortField)) { + generator.writeKey("sort.field"); + generator.writeStartArray(); + for (String item0 : this.sortField) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.sortOrder)) { + generator.writeKey("sort.order"); + generator.writeStartArray(); + for (SegmentSortOrder item0 : this.sortOrder) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.sortMode)) { + generator.writeKey("sort.mode"); + generator.writeStartArray(); + for (SegmentSortMode item0 : this.sortMode) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.sortMissing)) { + generator.writeKey("sort.missing"); + generator.writeStartArray(); + for (SegmentSortMissing item0 : this.sortMissing) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } if (this.numberOfShards != null) { generator.writeKey("number_of_shards"); @@ -878,14 +955,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.autoExpandReplicas); } - if (this.mergeSchedulerMaxThreadCount != null) { - generator.writeKey("merge.scheduler.max_thread_count"); - generator.write(this.mergeSchedulerMaxThreadCount); - - } - if (this.mergeSchedulerMaxMergeCount != null) { - generator.writeKey("merge.scheduler.max_merge_count"); - generator.write(this.mergeSchedulerMaxMergeCount); + if (this.merge != null) { + generator.writeKey("merge"); + this.merge.serialize(generator, mapper); } if (this.searchIdleAfter != null) { @@ -1058,14 +1130,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.maxSlicesPerScroll); } - if (this.translogDurability != null) { - generator.writeKey("translog.durability"); - generator.write(this.translogDurability); - - } - if (this.translogFlushThresholdSize != null) { - generator.writeKey("translog.flush_threshold_size"); - generator.write(this.translogFlushThresholdSize); + if (this.translog != null) { + generator.writeKey("translog"); + this.translog.serialize(generator, mapper); } if (this.queryStringLenient != null) { @@ -1098,6 +1165,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.timeSeries.serialize(generator, mapper); } + if (this.shards != null) { + generator.writeKey("shards"); + generator.write(this.shards); + + } + if (this.queries != null) { + generator.writeKey("queries"); + this.queries.serialize(generator, mapper); + + } } @@ -1129,6 +1206,18 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder sortField; + + @Nullable + private List sortOrder; + + @Nullable + private List sortMode; + + @Nullable + private List sortMissing; + @Nullable private String numberOfShards; @@ -1157,10 +1246,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder + * Adds all elements of list to sortField. + */ + public final Builder sortField(List list) { + this.sortField = _listAddAll(this.sortField, list); + return this; + } + + /** + * API name: {@code sort.field} + *

+ * Adds one or more values to sortField. + */ + public final Builder sortField(String value, String... values) { + this.sortField = _listAdd(this.sortField, value, values); + return this; + } + + /** + * API name: {@code sort.order} + *

+ * Adds all elements of list to sortOrder. + */ + public final Builder sortOrder(List list) { + this.sortOrder = _listAddAll(this.sortOrder, list); + return this; + } + + /** + * API name: {@code sort.order} + *

+ * Adds one or more values to sortOrder. + */ + public final Builder sortOrder(SegmentSortOrder value, SegmentSortOrder... values) { + this.sortOrder = _listAdd(this.sortOrder, value, values); + return this; + } + + /** + * API name: {@code sort.mode} + *

+ * Adds all elements of list to sortMode. + */ + public final Builder sortMode(List list) { + this.sortMode = _listAddAll(this.sortMode, list); + return this; + } + + /** + * API name: {@code sort.mode} + *

+ * Adds one or more values to sortMode. + */ + public final Builder sortMode(SegmentSortMode value, SegmentSortMode... values) { + this.sortMode = _listAdd(this.sortMode, value, values); + return this; + } + + /** + * API name: {@code sort.missing} + *

+ * Adds all elements of list to sortMissing. + */ + public final Builder sortMissing(List list) { + this.sortMissing = _listAddAll(this.sortMissing, list); + return this; + } + + /** + * API name: {@code sort.missing} + *

+ * Adds one or more values to sortMissing. + */ + public final Builder sortMissing(SegmentSortMissing value, SegmentSortMissing... values) { + this.sortMissing = _listAdd(this.sortMissing, value, values); + return this; + } + /** * API name: {@code number_of_shards} */ @@ -1457,19 +1626,18 @@ public final Builder autoExpandReplicas(@Nullable String value) { } /** - * API name: {@code merge.scheduler.max_thread_count} + * API name: {@code merge} */ - public final Builder mergeSchedulerMaxThreadCount(@Nullable Integer value) { - this.mergeSchedulerMaxThreadCount = value; + public final Builder merge(@Nullable Merge value) { + this.merge = value; return this; } /** - * API name: {@code merge.scheduler.max_merge_count} + * API name: {@code merge} */ - public final Builder mergeSchedulerMaxMergeCount(@Nullable Integer value) { - this.mergeSchedulerMaxMergeCount = value; - return this; + public final Builder merge(Function> fn) { + return this.merge(fn.apply(new Merge.Builder()).build()); } /** @@ -1795,19 +1963,18 @@ public final Builder maxSlicesPerScroll(@Nullable Integer value) { } /** - * API name: {@code translog.durability} + * API name: {@code translog} */ - public final Builder translogDurability(@Nullable String value) { - this.translogDurability = value; + public final Builder translog(@Nullable Translog value) { + this.translog = value; return this; } /** - * API name: {@code translog.flush_threshold_size} + * API name: {@code translog} */ - public final Builder translogFlushThresholdSize(@Nullable String value) { - this.translogFlushThresholdSize = value; - return this; + public final Builder translog(Function> fn) { + return this.translog(fn.apply(new Translog.Builder()).build()); } /** @@ -1881,6 +2048,29 @@ public final Builder timeSeries( return this.timeSeries(fn.apply(new IndexSettingsTimeSeries.Builder()).build()); } + /** + * API name: {@code shards} + */ + public final Builder shards(@Nullable Integer value) { + this.shards = value; + return this; + } + + /** + * API name: {@code queries} + */ + public final Builder queries(@Nullable Queries value) { + this.queries = value; + return this; + } + + /** + * API name: {@code queries} + */ + public final Builder queries(Function> fn) { + return this.queries(fn.apply(new Queries.Builder()).build()); + } + /** * Builds a {@link IndexSettings}. * @@ -1914,6 +2104,14 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializer { - private String endTime; + @Nullable + private DateOrEpochMillis endTime; - private String startTime; + @Nullable + private DateOrEpochMillis startTime; /** - * Required - API name: {@code end_time} + * API name: {@code end_time} */ - public final Builder endTime(String value) { + public final Builder endTime(@Nullable DateOrEpochMillis value) { this.endTime = value; return this; } /** - * Required - API name: {@code start_time} + * API name: {@code end_time} */ - public final Builder startTime(String value) { + public final Builder endTime(Function> fn) { + return this.endTime(fn.apply(new DateOrEpochMillis.Builder()).build()); + } + + /** + * API name: {@code start_time} + */ + public final Builder startTime(@Nullable DateOrEpochMillis value) { this.startTime = value; return this; } + /** + * API name: {@code start_time} + */ + public final Builder startTime(Function> fn) { + return this.startTime(fn.apply(new DateOrEpochMillis.Builder()).build()); + } + /** * Builds a {@link IndexSettingsTimeSeries}. * @@ -149,8 +173,8 @@ public IndexSettingsTimeSeries build() { protected static void setupIndexSettingsTimeSeriesDeserializer( ObjectDeserializer op) { - op.add(Builder::endTime, JsonpDeserializer.stringDeserializer(), "end_time"); - op.add(Builder::startTime, JsonpDeserializer.stringDeserializer(), "start_time"); + op.add(Builder::endTime, DateOrEpochMillis._DESERIALIZER, "end_time"); + op.add(Builder::startTime, DateOrEpochMillis._DESERIALIZER, "start_time"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java new file mode 100644 index 000000000..8c9a0de31 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java @@ -0,0 +1,142 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.Merge + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Merge implements JsonpSerializable { + @Nullable + private final MergeScheduler scheduler; + + // --------------------------------------------------------------------------------------------- + + private Merge(Builder builder) { + + this.scheduler = builder.scheduler; + + } + + public static Merge of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code scheduler} + */ + @Nullable + public final MergeScheduler scheduler() { + return this.scheduler; + } + + /** + * 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.scheduler != null) { + generator.writeKey("scheduler"); + this.scheduler.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Merge}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private MergeScheduler scheduler; + + /** + * API name: {@code scheduler} + */ + public final Builder scheduler(@Nullable MergeScheduler value) { + this.scheduler = value; + return this; + } + + /** + * API name: {@code scheduler} + */ + public final Builder scheduler(Function> fn) { + return this.scheduler(fn.apply(new MergeScheduler.Builder()).build()); + } + + /** + * Builds a {@link Merge}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Merge build() { + _checkSingleUse(); + + return new Merge(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Merge} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Merge::setupMergeDeserializer); + + protected static void setupMergeDeserializer(ObjectDeserializer op) { + + op.add(Builder::scheduler, MergeScheduler._DESERIALIZER, "scheduler"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java new file mode 100644 index 000000000..a73f98579 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.MergeScheduler + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class MergeScheduler implements JsonpSerializable { + @Nullable + private final Integer maxThreadCount; + + @Nullable + private final Integer maxMergeCount; + + // --------------------------------------------------------------------------------------------- + + private MergeScheduler(Builder builder) { + + this.maxThreadCount = builder.maxThreadCount; + this.maxMergeCount = builder.maxMergeCount; + + } + + public static MergeScheduler of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_thread_count} + */ + @Nullable + public final Integer maxThreadCount() { + return this.maxThreadCount; + } + + /** + * API name: {@code max_merge_count} + */ + @Nullable + public final Integer maxMergeCount() { + return this.maxMergeCount; + } + + /** + * 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.maxThreadCount != null) { + generator.writeKey("max_thread_count"); + generator.write(this.maxThreadCount); + + } + if (this.maxMergeCount != null) { + generator.writeKey("max_merge_count"); + generator.write(this.maxMergeCount); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MergeScheduler}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer maxThreadCount; + + @Nullable + private Integer maxMergeCount; + + /** + * API name: {@code max_thread_count} + */ + public final Builder maxThreadCount(@Nullable Integer value) { + this.maxThreadCount = value; + return this; + } + + /** + * API name: {@code max_merge_count} + */ + public final Builder maxMergeCount(@Nullable Integer value) { + this.maxMergeCount = value; + return this; + } + + /** + * Builds a {@link MergeScheduler}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MergeScheduler build() { + _checkSingleUse(); + + return new MergeScheduler(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MergeScheduler} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + MergeScheduler::setupMergeSchedulerDeserializer); + + protected static void setupMergeSchedulerDeserializer(ObjectDeserializer op) { + + op.add(Builder::maxThreadCount, JsonpDeserializer.integerDeserializer(), "max_thread_count"); + op.add(Builder::maxMergeCount, JsonpDeserializer.integerDeserializer(), "max_merge_count"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java index ce9d15b6a..e9596ef9e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java @@ -106,7 +106,7 @@ public class PutMappingRequest extends RequestBase implements JsonpSerializable private final Map properties; - private final Map runtime; + private final Map> runtime; @Nullable private final Time timeout; @@ -307,7 +307,7 @@ public final Map properties() { *

* API name: {@code runtime} */ - public final Map runtime() { + public final Map> runtime() { return this.runtime; } @@ -425,9 +425,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtime)) { generator.writeKey("runtime"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtime.entrySet()) { + for (Map.Entry> item0 : this.runtime.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -488,7 +495,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

properties; @Nullable - private Map runtime; + private Map> runtime; @Nullable private Time timeout; @@ -817,7 +824,7 @@ public final Builder properties(String key, Function * Adds all entries of map to runtime. */ - public final Builder runtime(Map map) { + public final Builder runtime(Map> map) { this.runtime = _mapPutAll(this.runtime, map); return this; } @@ -829,22 +836,11 @@ public final Builder runtime(Map map) { *

* Adds an entry to runtime. */ - public final Builder runtime(String key, RuntimeField value) { + public final Builder runtime(String key, List value) { this.runtime = _mapPut(this.runtime, key, value); return this; } - /** - * Mapping of runtime fields for the index. - *

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

- * Adds an entry to runtime using a builder lambda. - */ - public final Builder runtime(String key, Function> fn) { - return runtime(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Explicit operation timeout *

@@ -910,7 +906,8 @@ protected static void setupPutMappingRequestDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class Queries implements JsonpSerializable { + @Nullable + private final CacheQueries cache; + + // --------------------------------------------------------------------------------------------- + + private Queries(Builder builder) { + + this.cache = builder.cache; + + } + + public static Queries of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code cache} + */ + @Nullable + public final CacheQueries cache() { + return this.cache; + } + + /** + * 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.cache != null) { + generator.writeKey("cache"); + this.cache.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Queries}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private CacheQueries cache; + + /** + * API name: {@code cache} + */ + public final Builder cache(@Nullable CacheQueries value) { + this.cache = value; + return this; + } + + /** + * API name: {@code cache} + */ + public final Builder cache(Function> fn) { + return this.cache(fn.apply(new CacheQueries.Builder()).build()); + } + + /** + * Builds a {@link Queries}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Queries build() { + _checkSingleUse(); + + return new Queries(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Queries} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Queries::setupQueriesDeserializer); + + protected static void setupQueriesDeserializer(ObjectDeserializer op) { + + op.add(Builder::cache, CacheQueries._DESERIALIZER, "cache"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java index 235d8df3e..66e1f2ede 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java @@ -34,22 +34,28 @@ */ @JsonpDeserializable public enum SegmentSortMode implements JsonEnum { - Min("min"), + Min("min", "MIN"), - Max("max"), + Max("max", "MAX"), ; private final String jsonValue; + private final String[] aliases; - SegmentSortMode(String jsonValue) { + SegmentSortMode(String jsonValue, String... aliases) { this.jsonValue = jsonValue; + this.aliases = aliases; } public String jsonValue() { return this.jsonValue; } + public String[] aliases() { + return this.aliases; + } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( SegmentSortMode.values()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java index 57a501f7c..d140c205b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java @@ -34,22 +34,28 @@ */ @JsonpDeserializable public enum SegmentSortOrder implements JsonEnum { - Asc("asc"), + Asc("asc", "ASC"), - Desc("desc"), + Desc("desc", "DESC"), ; private final String jsonValue; + private final String[] aliases; - SegmentSortOrder(String jsonValue) { + SegmentSortOrder(String jsonValue, String... aliases) { this.jsonValue = jsonValue; + this.aliases = aliases; } public String jsonValue() { return this.jsonValue; } + public String[] aliases() { + return this.aliases; + } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( SegmentSortOrder.values()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java index f5ec0d1e0..abd1fe058 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.indices; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -50,15 +49,11 @@ public class SoftDeletes implements JsonpSerializable { private final boolean enabled; - @Nullable - private final Time retentionLeasePeriod; - // --------------------------------------------------------------------------------------------- private SoftDeletes(Builder builder) { this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled"); - this.retentionLeasePeriod = builder.retentionLeasePeriod; } @@ -73,14 +68,6 @@ public final boolean enabled() { return this.enabled; } - /** - * API name: {@code retention_lease.period} - */ - @Nullable - public final Time retentionLeasePeriod() { - return this.retentionLeasePeriod; - } - /** * Serialize this object to JSON. */ @@ -95,12 +82,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("enabled"); generator.write(this.enabled); - if (this.retentionLeasePeriod != null) { - generator.writeKey("retention_lease.period"); - this.retentionLeasePeriod.serialize(generator, mapper); - - } - } // --------------------------------------------------------------------------------------------- @@ -112,9 +93,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Boolean enabled; - @Nullable - private Time retentionLeasePeriod; - /** * Required - API name: {@code enabled} */ @@ -123,21 +101,6 @@ public final Builder enabled(boolean value) { return this; } - /** - * API name: {@code retention_lease.period} - */ - public final Builder retentionLeasePeriod(@Nullable Time value) { - this.retentionLeasePeriod = value; - return this; - } - - /** - * API name: {@code retention_lease.period} - */ - public final Builder retentionLeasePeriod(Function> fn) { - return this.retentionLeasePeriod(fn.apply(new Time.Builder()).build()); - } - /** * Builds a {@link SoftDeletes}. * @@ -162,7 +125,6 @@ public SoftDeletes build() { protected static void setupSoftDeletesDeserializer(ObjectDeserializer op) { op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); - op.add(Builder::retentionLeasePeriod, Time._DESERIALIZER, "retention_lease.period"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java new file mode 100644 index 000000000..a83a56372 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java @@ -0,0 +1,201 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.Translog + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Translog implements JsonpSerializable { + @Nullable + private final String durability; + + @Nullable + private final String flushThresholdSize; + + @Nullable + private final TranslogRetention retention; + + // --------------------------------------------------------------------------------------------- + + private Translog(Builder builder) { + + this.durability = builder.durability; + this.flushThresholdSize = builder.flushThresholdSize; + this.retention = builder.retention; + + } + + public static Translog of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code durability} + */ + @Nullable + public final String durability() { + return this.durability; + } + + /** + * API name: {@code flush_threshold_size} + */ + @Nullable + public final String flushThresholdSize() { + return this.flushThresholdSize; + } + + /** + * API name: {@code retention} + */ + @Nullable + public final TranslogRetention retention() { + return this.retention; + } + + /** + * 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.durability != null) { + generator.writeKey("durability"); + generator.write(this.durability); + + } + if (this.flushThresholdSize != null) { + generator.writeKey("flush_threshold_size"); + generator.write(this.flushThresholdSize); + + } + if (this.retention != null) { + generator.writeKey("retention"); + this.retention.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Translog}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String durability; + + @Nullable + private String flushThresholdSize; + + @Nullable + private TranslogRetention retention; + + /** + * API name: {@code durability} + */ + public final Builder durability(@Nullable String value) { + this.durability = value; + return this; + } + + /** + * API name: {@code flush_threshold_size} + */ + public final Builder flushThresholdSize(@Nullable String value) { + this.flushThresholdSize = value; + return this; + } + + /** + * API name: {@code retention} + */ + public final Builder retention(@Nullable TranslogRetention value) { + this.retention = value; + return this; + } + + /** + * API name: {@code retention} + */ + public final Builder retention(Function> fn) { + return this.retention(fn.apply(new TranslogRetention.Builder()).build()); + } + + /** + * Builds a {@link Translog}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Translog build() { + _checkSingleUse(); + + return new Translog(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Translog} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Translog::setupTranslogDeserializer); + + protected static void setupTranslogDeserializer(ObjectDeserializer op) { + + op.add(Builder::durability, JsonpDeserializer.stringDeserializer(), "durability"); + op.add(Builder::flushThresholdSize, JsonpDeserializer.stringDeserializer(), "flush_threshold_size"); + op.add(Builder::retention, TranslogRetention._DESERIALIZER, "retention"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailureReason.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java similarity index 58% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailureReason.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java index 452e0b6f2..c15924a5e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailureReason.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java @@ -21,7 +21,7 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.rollup.delete_job; +package co.elastic.clients.elasticsearch.indices; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -38,45 +38,35 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: rollup.delete_job.TaskFailureReason +// typedef: indices._types.TranslogRetention /** * * @see API + * "../doc-files/api-spec.html#indices._types.TranslogRetention">API * specification */ @JsonpDeserializable -public class TaskFailureReason implements JsonpSerializable { - private final String type; - - private final String reason; +public class TranslogRetention implements JsonpSerializable { + private final String size; // --------------------------------------------------------------------------------------------- - private TaskFailureReason(Builder builder) { + private TranslogRetention(Builder builder) { - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.size = ApiTypeHelper.requireNonNull(builder.size, this, "size"); } - public static TaskFailureReason of(Function> fn) { + public static TranslogRetention of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - API name: {@code reason} + * Required - API name: {@code size} */ - public final String reason() { - return this.reason; + public final String size() { + return this.size; } /** @@ -90,66 +80,52 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("type"); - generator.write(this.type); - - generator.writeKey("reason"); - generator.write(this.reason); + generator.writeKey("size"); + generator.write(this.size); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link TaskFailureReason}. + * Builder for {@link TranslogRetention}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String type; - - private String reason; - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String size; /** - * Required - API name: {@code reason} + * Required - API name: {@code size} */ - public final Builder reason(String value) { - this.reason = value; + public final Builder size(String value) { + this.size = value; return this; } /** - * Builds a {@link TaskFailureReason}. + * Builds a {@link TranslogRetention}. * * @throws NullPointerException * if some of the required fields are null. */ - public TaskFailureReason build() { + public TranslogRetention build() { _checkSingleUse(); - return new TaskFailureReason(this); + return new TranslogRetention(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link TaskFailureReason} + * Json deserializer for {@link TranslogRetention} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, TaskFailureReason::setupTaskFailureReasonDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TranslogRetention::setupTranslogRetentionDeserializer); - protected static void setupTaskFailureReasonDeserializer(ObjectDeserializer op) { + protected static void setupTranslogRetentionDeserializer(ObjectDeserializer op) { - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItem.java deleted file mode 100644 index dde922d9d..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItem.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices.get_data_stream; - -import co.elastic.clients.elasticsearch._types.HealthStatus; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: indices.get_data_stream.IndicesGetDataStreamItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndicesGetDataStreamItem implements JsonpSerializable { - private final String name; - - private final IndicesGetDataStreamItemTimestampField timestampField; - - private final List indices; - - private final int generation; - - private final String template; - - private final boolean hidden; - - @Nullable - private final Boolean system; - - private final HealthStatus status; - - @Nullable - private final String ilmPolicy; - - private final Map meta; - - // --------------------------------------------------------------------------------------------- - - private IndicesGetDataStreamItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - this.hidden = ApiTypeHelper.requireNonNull(builder.hidden, this, "hidden"); - this.system = builder.system; - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.ilmPolicy = builder.ilmPolicy; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - - } - - public static IndicesGetDataStreamItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code timestamp_field} - */ - public final IndicesGetDataStreamItemTimestampField timestampField() { - return this.timestampField; - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Required - API name: {@code generation} - */ - public final int generation() { - return this.generation; - } - - /** - * Required - API name: {@code template} - */ - public final String template() { - return this.template; - } - - /** - * Required - API name: {@code hidden} - */ - public final boolean hidden() { - return this.hidden; - } - - /** - * API name: {@code system} - */ - @Nullable - public final Boolean system() { - return this.system; - } - - /** - * Required - API name: {@code status} - */ - public final HealthStatus status() { - return this.status; - } - - /** - * API name: {@code ilm_policy} - */ - @Nullable - public final String ilmPolicy() { - return this.ilmPolicy; - } - - /** - * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * 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); - - generator.writeKey("timestamp_field"); - this.timestampField.serialize(generator, mapper); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (IndicesGetDataStreamItemIndex item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("generation"); - generator.write(this.generation); - - generator.writeKey("template"); - generator.write(this.template); - - generator.writeKey("hidden"); - generator.write(this.hidden); - - if (this.system != null) { - generator.writeKey("system"); - generator.write(this.system); - - } - generator.writeKey("status"); - this.status.serialize(generator, mapper); - if (this.ilmPolicy != null) { - generator.writeKey("ilm_policy"); - generator.write(this.ilmPolicy); - - } - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndicesGetDataStreamItem}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - private IndicesGetDataStreamItemTimestampField timestampField; - - private List indices; - - private Integer generation; - - private String template; - - private Boolean hidden; - - @Nullable - private Boolean system; - - private HealthStatus status; - - @Nullable - private String ilmPolicy; - - @Nullable - private Map meta; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code timestamp_field} - */ - public final Builder timestampField(IndicesGetDataStreamItemTimestampField value) { - this.timestampField = value; - return this; - } - - /** - * Required - API name: {@code timestamp_field} - */ - public final Builder timestampField( - Function> fn) { - return this.timestampField(fn.apply(new IndicesGetDataStreamItemTimestampField.Builder()).build()); - } - - /** - * 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; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(IndicesGetDataStreamItemIndex value, IndicesGetDataStreamItemIndex... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * 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 IndicesGetDataStreamItemIndex.Builder()).build()); - } - - /** - * Required - API name: {@code generation} - */ - public final Builder generation(int value) { - this.generation = value; - return this; - } - - /** - * Required - API name: {@code template} - */ - public final Builder template(String value) { - this.template = value; - return this; - } - - /** - * Required - API name: {@code hidden} - */ - public final Builder hidden(boolean value) { - this.hidden = value; - return this; - } - - /** - * API name: {@code system} - */ - public final Builder system(@Nullable Boolean value) { - this.system = value; - return this; - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(HealthStatus value) { - this.status = value; - return this; - } - - /** - * API name: {@code ilm_policy} - */ - public final Builder ilmPolicy(@Nullable String value) { - this.ilmPolicy = value; - return this; - } - - /** - * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * Builds a {@link IndicesGetDataStreamItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndicesGetDataStreamItem build() { - _checkSingleUse(); - - return new IndicesGetDataStreamItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndicesGetDataStreamItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndicesGetDataStreamItem::setupIndicesGetDataStreamItemDeserializer); - - protected static void setupIndicesGetDataStreamItemDeserializer( - ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::timestampField, IndicesGetDataStreamItemTimestampField._DESERIALIZER, "timestamp_field"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(IndicesGetDataStreamItemIndex._DESERIALIZER), - "indices"); - op.add(Builder::generation, JsonpDeserializer.integerDeserializer(), "generation"); - op.add(Builder::template, JsonpDeserializer.stringDeserializer(), "template"); - op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); - op.add(Builder::system, JsonpDeserializer.booleanDeserializer(), "system"); - op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); - op.add(Builder::ilmPolicy, JsonpDeserializer.stringDeserializer(), "ilm_policy"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/update_aliases/AddAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/update_aliases/AddAction.java index 263f090f5..de40377a5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/update_aliases/AddAction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/update_aliases/AddAction.java @@ -79,6 +79,9 @@ public class AddAction implements ActionVariant, JsonpSerializable { @Nullable private final String searchRouting; + @Nullable + private final Boolean mustExist; + // --------------------------------------------------------------------------------------------- private AddAction(Builder builder) { @@ -93,6 +96,7 @@ private AddAction(Builder builder) { this.isWriteIndex = builder.isWriteIndex; this.routing = builder.routing; this.searchRouting = builder.searchRouting; + this.mustExist = builder.mustExist; } @@ -186,6 +190,14 @@ public final String searchRouting() { return this.searchRouting; } + /** + * API name: {@code must_exist} + */ + @Nullable + public final Boolean mustExist() { + return this.mustExist; + } + /** * Serialize this object to JSON. */ @@ -257,6 +269,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.searchRouting); } + if (this.mustExist != null) { + generator.writeKey("must_exist"); + generator.write(this.mustExist); + + } } @@ -297,6 +314,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder indices; + @Nullable + private final Boolean mustExist; + // --------------------------------------------------------------------------------------------- private RemoveIndexAction(Builder builder) { this.index = builder.index; this.indices = ApiTypeHelper.unmodifiable(builder.indices); + this.mustExist = builder.mustExist; } @@ -90,6 +95,14 @@ public final List indices() { return this.indices; } + /** + * API name: {@code must_exist} + */ + @Nullable + public final Boolean mustExist() { + return this.mustExist; + } + /** * Serialize this object to JSON. */ @@ -116,6 +129,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.mustExist != null) { + generator.writeKey("must_exist"); + generator.write(this.mustExist); + + } } @@ -132,6 +150,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder indices; + @Nullable + private Boolean mustExist; + /** * API name: {@code index} */ @@ -160,6 +181,14 @@ public final Builder indices(String value, String... values) { return this; } + /** + * API name: {@code must_exist} + */ + public final Builder mustExist(@Nullable Boolean value) { + this.mustExist = value; + return this; + } + /** * Builds a {@link RemoveIndexAction}. * @@ -186,6 +215,7 @@ protected static void setupRemoveIndexActionDeserializer(ObjectDeserializer> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code pipeline.workers} - */ - public final int pipelineWorkers() { - return this.pipelineWorkers; - } - - /** - * Required - API name: {@code pipeline.batch.size} - */ - public final int pipelineBatchSize() { - return this.pipelineBatchSize; - } - - /** - * Required - API name: {@code pipeline.batch.delay} - */ - public final int pipelineBatchDelay() { - return this.pipelineBatchDelay; - } - - /** - * Required - API name: {@code queue.type} - */ - public final String queueType() { - return this.queueType; - } - - /** - * Required - API name: {@code queue.max_bytes.number} - */ - public final int queueMaxBytesNumber() { - return this.queueMaxBytesNumber; - } - - /** - * Required - API name: {@code queue.max_bytes.units} - */ - public final String queueMaxBytesUnits() { - return this.queueMaxBytesUnits; - } - - /** - * Required - API name: {@code queue.checkpoint.writes} - */ - public final int queueCheckpointWrites() { - return this.queueCheckpointWrites; - } - /** * Serialize this object to JSON. */ @@ -143,27 +66,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("pipeline.workers"); - generator.write(this.pipelineWorkers); - - generator.writeKey("pipeline.batch.size"); - generator.write(this.pipelineBatchSize); - - generator.writeKey("pipeline.batch.delay"); - generator.write(this.pipelineBatchDelay); - - generator.writeKey("queue.type"); - generator.write(this.queueType); - - generator.writeKey("queue.max_bytes.number"); - generator.write(this.queueMaxBytesNumber); - - generator.writeKey("queue.max_bytes.units"); - generator.write(this.queueMaxBytesUnits); - - generator.writeKey("queue.checkpoint.writes"); - generator.write(this.queueCheckpointWrites); - } // --------------------------------------------------------------------------------------------- @@ -173,75 +75,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer pipelineWorkers; - - private Integer pipelineBatchSize; - - private Integer pipelineBatchDelay; - - private String queueType; - - private Integer queueMaxBytesNumber; - - private String queueMaxBytesUnits; - - private Integer queueCheckpointWrites; - - /** - * Required - API name: {@code pipeline.workers} - */ - public final Builder pipelineWorkers(int value) { - this.pipelineWorkers = value; - return this; - } - - /** - * Required - API name: {@code pipeline.batch.size} - */ - public final Builder pipelineBatchSize(int value) { - this.pipelineBatchSize = value; - return this; - } - - /** - * Required - API name: {@code pipeline.batch.delay} - */ - public final Builder pipelineBatchDelay(int value) { - this.pipelineBatchDelay = value; - return this; - } - - /** - * Required - API name: {@code queue.type} - */ - public final Builder queueType(String value) { - this.queueType = value; - return this; - } - - /** - * Required - API name: {@code queue.max_bytes.number} - */ - public final Builder queueMaxBytesNumber(int value) { - this.queueMaxBytesNumber = value; - return this; - } - - /** - * Required - API name: {@code queue.max_bytes.units} - */ - public final Builder queueMaxBytesUnits(String value) { - this.queueMaxBytesUnits = value; - return this; - } - - /** - * Required - API name: {@code queue.checkpoint.writes} - */ - public final Builder queueCheckpointWrites(int value) { - this.queueCheckpointWrites = value; - return this; - } /** * Builds a {@link PipelineSettings}. @@ -266,14 +99,6 @@ public PipelineSettings build() { protected static void setupPipelineSettingsDeserializer(ObjectDeserializer op) { - op.add(Builder::pipelineWorkers, JsonpDeserializer.integerDeserializer(), "pipeline.workers"); - op.add(Builder::pipelineBatchSize, JsonpDeserializer.integerDeserializer(), "pipeline.batch.size"); - op.add(Builder::pipelineBatchDelay, JsonpDeserializer.integerDeserializer(), "pipeline.batch.delay"); - op.add(Builder::queueType, JsonpDeserializer.stringDeserializer(), "queue.type"); - op.add(Builder::queueMaxBytesNumber, JsonpDeserializer.integerDeserializer(), "queue.max_bytes.number"); - op.add(Builder::queueMaxBytesUnits, JsonpDeserializer.stringDeserializer(), "queue.max_bytes.units"); - op.add(Builder::queueCheckpointWrites, JsonpDeserializer.integerDeserializer(), "queue.checkpoint.writes"); - } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Datafeed.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Datafeed.java index 134b56ae8..1e49c5732 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Datafeed.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Datafeed.java @@ -86,7 +86,7 @@ public class Datafeed implements JsonpSerializable { private final DelayedDataCheckConfig delayedDataCheckConfig; - private final Map runtimeMappings; + private final Map> runtimeMappings; @Nullable private final IndicesOptions indicesOptions; @@ -217,7 +217,7 @@ public final DelayedDataCheckConfig delayedDataCheckConfig() { /** * API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -322,9 +322,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -380,7 +387,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private IndicesOptions indicesOptions; @@ -582,7 +589,7 @@ public final Builder delayedDataCheckConfig( *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -592,21 +599,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * API name: {@code indices_options} */ @@ -662,8 +659,8 @@ protected static void setupDatafeedDeserializer(ObjectDeserializer runtimeMappings; + private final Map> runtimeMappings; private final Map scriptFields; @@ -274,7 +274,7 @@ public final String queryDelay() { *

* API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -389,9 +389,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -458,7 +465,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private Map scriptFields; @@ -731,7 +738,7 @@ public final Builder queryDelay(@Nullable String value) { *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -743,23 +750,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * Specifies runtime fields for the datafeed search. - *

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

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Specifies scripts that evaluate custom expressions and returns script fields * to the datafeed. The detector configuration objects in a job can contain @@ -851,8 +846,8 @@ protected static void setupDatafeedConfigDeserializer(ObjectDeserializer runtimeMappings; + private final Map> runtimeMappings; @Nullable private final DataframeAnalysisAnalyzedFields source; @@ -109,7 +109,7 @@ public final Query query() { *

* API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -154,9 +154,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -183,7 +190,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private DataframeAnalysisAnalyzedFields source; @@ -253,7 +260,7 @@ public final Builder query(Function> fn) { *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -266,24 +273,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * Definitions of runtime fields that will become part of the mapping of the - * destination index. - *

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

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Specify includes and/or `excludes patterns to select which * fields will be present in the destination. Fields that are excluded cannot be @@ -334,8 +328,8 @@ protected static void setupDataframeAnalyticsSourceDeserializer( op.add(Builder::index, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index"); op.add(Builder::query, Query._DESERIALIZER, "query"); - op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), - "runtime_mappings"); + op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.arrayDeserializer(RuntimeField._DESERIALIZER)), "runtime_mappings"); op.add(Builder::source, DataframeAnalysisAnalyzedFields._DESERIALIZER, "_source"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java index 21ef479d4..8b38d45b4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java @@ -61,7 +61,7 @@ public ElasticsearchMlAsyncClient withTransportOptions(@Nullable TransportOption * multiple times throughout its lifecycle. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-close-job.html">Documentation * on elastic.co */ @@ -80,7 +80,7 @@ public CompletableFuture closeJob(CloseJobRequest request) { * a function that initializes a builder to create the * {@link CloseJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-close-job.html">Documentation * on elastic.co */ @@ -95,7 +95,7 @@ public final CompletableFuture closeJob( * Deletes a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -113,7 +113,7 @@ public CompletableFuture deleteCalendar(DeleteCalendarRe * a function that initializes a builder to create the * {@link DeleteCalendarRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -128,7 +128,7 @@ public final CompletableFuture deleteCalendar( * Deletes scheduled events from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -146,7 +146,7 @@ public CompletableFuture deleteCalendarEvent(Delete * a function that initializes a builder to create the * {@link DeleteCalendarEventRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -161,7 +161,7 @@ public final CompletableFuture deleteCalendarEvent( * Deletes anomaly detection jobs from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -179,7 +179,7 @@ public CompletableFuture deleteCalendarJob(DeleteCale * a function that initializes a builder to create the * {@link DeleteCalendarJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -194,7 +194,7 @@ public final CompletableFuture deleteCalendarJob( * Deletes an existing data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -213,7 +213,7 @@ public CompletableFuture deleteDataFrameAnalyt * a function that initializes a builder to create the * {@link DeleteDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -228,7 +228,7 @@ public final CompletableFuture deleteDataFrame * Deletes an existing datafeed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -246,7 +246,7 @@ public CompletableFuture deleteDatafeed(DeleteDatafeedRe * a function that initializes a builder to create the * {@link DeleteDatafeedRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -1695,7 +1695,7 @@ public final CompletableFuture putCalendarJob( * Instantiates a data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-dfanalytics.html">Documentation * on elastic.co */ @@ -1714,7 +1714,7 @@ public CompletableFuture putDataFrameAnalytics( * a function that initializes a builder to create the * {@link PutDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-dfanalytics.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java index fa5cde8d8..d7081ec3a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java @@ -62,7 +62,7 @@ public ElasticsearchMlClient withTransportOptions(@Nullable TransportOptions tra * multiple times throughout its lifecycle. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-close-job.html">Documentation * on elastic.co */ @@ -81,7 +81,7 @@ public CloseJobResponse closeJob(CloseJobRequest request) throws IOException, El * a function that initializes a builder to create the * {@link CloseJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-close-job.html">Documentation * on elastic.co */ @@ -96,7 +96,7 @@ public final CloseJobResponse closeJob(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -115,7 +115,7 @@ public DeleteCalendarResponse deleteCalendar(DeleteCalendarRequest request) * a function that initializes a builder to create the * {@link DeleteCalendarRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -131,7 +131,7 @@ public final DeleteCalendarResponse deleteCalendar( * Deletes scheduled events from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -150,7 +150,7 @@ public DeleteCalendarEventResponse deleteCalendarEvent(DeleteCalendarEventReques * a function that initializes a builder to create the * {@link DeleteCalendarEventRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -166,7 +166,7 @@ public final DeleteCalendarEventResponse deleteCalendarEvent( * Deletes anomaly detection jobs from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -185,7 +185,7 @@ public DeleteCalendarJobResponse deleteCalendarJob(DeleteCalendarJobRequest requ * a function that initializes a builder to create the * {@link DeleteCalendarJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -201,7 +201,7 @@ public final DeleteCalendarJobResponse deleteCalendarJob( * Deletes an existing data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -220,7 +220,7 @@ public DeleteDataFrameAnalyticsResponse deleteDataFrameAnalytics(DeleteDataFrame * a function that initializes a builder to create the * {@link DeleteDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -236,7 +236,7 @@ public final DeleteDataFrameAnalyticsResponse deleteDataFrameAnalytics( * Deletes an existing datafeed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -255,7 +255,7 @@ public DeleteDatafeedResponse deleteDatafeed(DeleteDatafeedRequest request) * a function that initializes a builder to create the * {@link DeleteDatafeedRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -1748,7 +1748,7 @@ public final PutCalendarJobResponse putCalendarJob( * Instantiates a data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-dfanalytics.html">Documentation * on elastic.co */ @@ -1767,7 +1767,7 @@ public PutDataFrameAnalyticsResponse putDataFrameAnalytics(PutDataFrameAnalytics * a function that initializes a builder to create the * {@link PutDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-dfanalytics.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/EvaluateDataFrameRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/EvaluateDataFrameRequest.java index 2c63f2cdd..068b35e5e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/EvaluateDataFrameRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/EvaluateDataFrameRequest.java @@ -99,9 +99,7 @@ public final String index() { } /** - * A query clause that retrieves a subset of data from the source index. See - * QueryDSL. + * A query clause that retrieves a subset of data from the source index. *

* API name: {@code query} */ @@ -180,9 +178,7 @@ public final Builder index(String value) { } /** - * A query clause that retrieves a subset of data from the source index. See - * QueryDSL. + * A query clause that retrieves a subset of data from the source index. *

* API name: {@code query} */ @@ -192,9 +188,7 @@ public final Builder query(@Nullable Query value) { } /** - * A query clause that retrieves a subset of data from the source index. See - * QueryDSL. + * A query clause that retrieves a subset of data from the source index. *

* API name: {@code query} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ExplainDataFrameAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ExplainDataFrameAnalyticsRequest.java index aa3aa7b20..7080cd705 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ExplainDataFrameAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ExplainDataFrameAnalyticsRequest.java @@ -183,11 +183,10 @@ public final String id() { } /** - * The maximum number of threads to be used by the analysis. The default value - * is 1. Using more threads may decrease the time necessary to complete the - * analysis at the cost of using more CPU. Note that the process may use - * additional threads for operational functionality other than the analysis - * itself. + * The maximum number of threads to be used by the analysis. Using more threads + * may decrease the time necessary to complete the analysis at the cost of using + * more CPU. Note that the process may use additional threads for operational + * functionality other than the analysis itself. *

* API name: {@code max_num_threads} */ @@ -198,11 +197,10 @@ public final Integer maxNumThreads() { /** * The approximate maximum amount of memory resources that are permitted for - * analytical processing. The default value for data frame analytics jobs is - * 1gb. If your elasticsearch.yml file contains an - * xpack.ml.max_model_memory_limit setting, an error occurs when you try to - * create data frame analytics jobs that have model_memory_limit values greater - * than that setting. + * analytical processing. If your elasticsearch.yml file contains + * an xpack.ml.max_model_memory_limit setting, an error occurs when + * you try to create data frame analytics jobs that have + * model_memory_limit values greater than that setting. *

* API name: {@code model_memory_limit} */ @@ -417,11 +415,10 @@ public final Builder id(@Nullable String value) { } /** - * The maximum number of threads to be used by the analysis. The default value - * is 1. Using more threads may decrease the time necessary to complete the - * analysis at the cost of using more CPU. Note that the process may use - * additional threads for operational functionality other than the analysis - * itself. + * The maximum number of threads to be used by the analysis. Using more threads + * may decrease the time necessary to complete the analysis at the cost of using + * more CPU. Note that the process may use additional threads for operational + * functionality other than the analysis itself. *

* API name: {@code max_num_threads} */ @@ -432,11 +429,10 @@ public final Builder maxNumThreads(@Nullable Integer value) { /** * The approximate maximum amount of memory resources that are permitted for - * analytical processing. The default value for data frame analytics jobs is - * 1gb. If your elasticsearch.yml file contains an - * xpack.ml.max_model_memory_limit setting, an error occurs when you try to - * create data frame analytics jobs that have model_memory_limit values greater - * than that setting. + * analytical processing. If your elasticsearch.yml file contains + * an xpack.ml.max_model_memory_limit setting, an error occurs when + * you try to create data frame analytics jobs that have + * model_memory_limit values greater than that setting. *

* API name: {@code model_memory_limit} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelPlotConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelPlotConfig.java index 993110e7f..b8f750412 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelPlotConfig.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelPlotConfig.java @@ -42,9 +42,6 @@ /** * - * @see Documentation - * on elastic.co * @see API * specification */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PreviewDataFrameAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PreviewDataFrameAnalyticsRequest.java index e2ba7156f..97fe0e782 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PreviewDataFrameAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PreviewDataFrameAnalyticsRequest.java @@ -75,9 +75,9 @@ public static PreviewDataFrameAnalyticsRequest of( } /** - * A data frame analytics config as described in Create data frame analytics - * jobs. Note that id and dest don’t need to be provided in the context of this - * API. + * A data frame analytics config as described in create data frame analytics + * jobs. Note that id and dest don’t need to be + * provided in the context of this API. *

* API name: {@code config} */ @@ -129,9 +129,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

id and dest don’t need to be + * provided in the context of this API. *

* API name: {@code config} */ @@ -141,9 +141,9 @@ public final Builder config(@Nullable DataframePreviewConfig value) { } /** - * A data frame analytics config as described in Create data frame analytics - * jobs. Note that id and dest don’t need to be provided in the context of this - * API. + * A data frame analytics config as described in create data frame analytics + * jobs. Note that id and dest don’t need to be + * provided in the context of this API. *

* API name: {@code config} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDataFrameAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDataFrameAnalyticsRequest.java index 4401e4384..1eb9e527d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDataFrameAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDataFrameAnalyticsRequest.java @@ -113,11 +113,12 @@ public static PutDataFrameAnalyticsRequest of(Functionstarting state until - * sufficient machine learning node capacity is available. This behavior is also - * affected by the cluster-wide xpack.ml.max_lazy_ml_nodes setting. + * false and a machine learning node with capacity to run the job + * cannot be immediately found, the API returns an error. If set to + * true, the API does not return an error; the job waits in the + * starting state until sufficient machine learning node capacity + * is available. This behavior is also affected by the cluster-wide + * xpack.ml.max_lazy_ml_nodes setting. *

* API name: {@code allow_lazy_start} */ @@ -367,11 +368,12 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

starting state until - * sufficient machine learning node capacity is available. This behavior is also - * affected by the cluster-wide xpack.ml.max_lazy_ml_nodes setting. + * false and a machine learning node with capacity to run the job + * cannot be immediately found, the API returns an error. If set to + * true, the API does not return an error; the job waits in the + * starting state until sufficient machine learning node capacity + * is available. This behavior is also affected by the cluster-wide + * xpack.ml.max_lazy_ml_nodes setting. *

* API name: {@code allow_lazy_start} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDatafeedRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDatafeedRequest.java index 025f78803..b52f6f12d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDatafeedRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutDatafeedRequest.java @@ -114,7 +114,7 @@ public class PutDatafeedRequest extends RequestBase implements JsonpSerializable @Nullable private final Time queryDelay; - private final Map runtimeMappings; + private final Map> runtimeMappings; private final Map scriptFields; @@ -352,7 +352,7 @@ public final Time queryDelay() { *

* API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -472,9 +472,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -554,7 +561,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

runtimeMappings; + private Map> runtimeMappings; @Nullable private Map scriptFields; @@ -920,7 +927,7 @@ public final Builder queryDelay(Function> fn) *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -932,23 +939,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * Specifies runtime fields for the datafeed search. - *

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

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Specifies scripts that evaluate custom expressions and returns script fields * to the datafeed. The detector configuration objects in a job can contain @@ -1039,8 +1034,8 @@ protected static void setupPutDatafeedRequestDeserializer(ObjectDeserializer runtimeMappings; + private final Map> runtimeMappings; private final Map scriptFields; @@ -193,7 +193,7 @@ public final Time queryDelay() { /** * API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -277,9 +277,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -333,7 +340,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

runtimeMappings; + private Map> runtimeMappings; @Nullable private Map scriptFields; @@ -509,7 +516,7 @@ public final Builder queryDelay(Function> fn) *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -519,21 +526,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * API name: {@code script_fields} *

@@ -607,8 +604,8 @@ protected static void setupPutDatafeedResponseDeserializer(ObjectDeserializerxpack.ml.max_model_memory_limit setting, an error occurs when - * you try to create data frame analytics jobs that have model_memory_limit - * values greater than that setting. + * analytical processing. If your elasticsearch.yml file contains + * an xpack.ml.max_model_memory_limit setting, an error occurs when + * you try to create data frame analytics jobs that have + * model_memory_limit values greater than that setting. *

* API name: {@code model_memory_limit} */ @@ -250,11 +249,10 @@ public final Builder maxNumThreads(@Nullable Integer value) { /** * The approximate maximum amount of memory resources that are permitted for - * analytical processing. The default value for data frame analytics jobs is - * 1gb. If your elasticsearch.yml file contains an - * xpack.ml.max_model_memory_limit setting, an error occurs when - * you try to create data frame analytics jobs that have model_memory_limit - * values greater than that setting. + * analytical processing. If your elasticsearch.yml file contains + * an xpack.ml.max_model_memory_limit setting, an error occurs when + * you try to create data frame analytics jobs that have + * model_memory_limit values greater than that setting. *

* API name: {@code model_memory_limit} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedRequest.java index 63beb4e22..a1dd0a9d4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedRequest.java @@ -107,7 +107,7 @@ public class UpdateDatafeedRequest extends RequestBase implements JsonpSerializa @Nullable private final Time queryDelay; - private final Map runtimeMappings; + private final Map> runtimeMappings; private final Map scriptFields; @@ -342,7 +342,7 @@ public final Time queryDelay() { *

* API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -439,9 +439,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -515,7 +522,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private Map scriptFields; @@ -882,7 +889,7 @@ public final Builder queryDelay(Function> fn) *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -894,23 +901,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * Specifies runtime fields for the datafeed search. - *

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

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Specifies scripts that evaluate custom expressions and returns script fields * to the datafeed. The detector configuration objects in a job can contain @@ -998,8 +993,8 @@ protected static void setupUpdateDatafeedRequestDeserializer(ObjectDeserializer< op.add(Builder::maxEmptySearches, JsonpDeserializer.integerDeserializer(), "max_empty_searches"); op.add(Builder::query, Query._DESERIALIZER, "query"); op.add(Builder::queryDelay, Time._DESERIALIZER, "query_delay"); - op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), - "runtime_mappings"); + op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.arrayDeserializer(RuntimeField._DESERIALIZER)), "runtime_mappings"); op.add(Builder::scriptFields, JsonpDeserializer.stringMapDeserializer(ScriptField._DESERIALIZER), "script_fields"); op.add(Builder::scrollSize, JsonpDeserializer.integerDeserializer(), "scroll_size"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedResponse.java index 9a55b38bd..c00531e38 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateDatafeedResponse.java @@ -80,7 +80,7 @@ public class UpdateDatafeedResponse implements JsonpSerializable { private final Time queryDelay; - private final Map runtimeMappings; + private final Map> runtimeMappings; private final Map scriptFields; @@ -193,7 +193,7 @@ public final Time queryDelay() { /** * API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -277,9 +277,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -333,7 +340,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; @Nullable private Map scriptFields; @@ -509,7 +516,7 @@ public final Builder queryDelay(Function> fn) *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -519,21 +526,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * API name: {@code script_fields} *

@@ -608,8 +605,8 @@ protected static void setupUpdateDatafeedResponseDeserializer( op.add(Builder::maxEmptySearches, JsonpDeserializer.integerDeserializer(), "max_empty_searches"); op.add(Builder::query, Query._DESERIALIZER, "query"); op.add(Builder::queryDelay, Time._DESERIALIZER, "query_delay"); - op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), - "runtime_mappings"); + op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.arrayDeserializer(RuntimeField._DESERIALIZER)), "runtime_mappings"); op.add(Builder::scriptFields, JsonpDeserializer.stringMapDeserializer(ScriptField._DESERIALIZER), "script_fields"); op.add(Builder::scrollSize, JsonpDeserializer.integerDeserializer(), "scroll_size"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsHttp.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsHttp.java index 8bdbfc28d..fbc23c88b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsHttp.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsHttp.java @@ -51,9 +51,6 @@ public class NodeInfoSettingsHttp implements JsonpSerializable { private final NodeInfoSettingsHttpType type; - @Nullable - private final String typeDefault; - @Nullable private final Boolean compression; @@ -65,7 +62,6 @@ public class NodeInfoSettingsHttp implements JsonpSerializable { private NodeInfoSettingsHttp(Builder builder) { this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.typeDefault = builder.typeDefault; this.compression = builder.compression; this.port = builder.port; @@ -82,14 +78,6 @@ public final NodeInfoSettingsHttpType type() { return this.type; } - /** - * API name: {@code type.default} - */ - @Nullable - public final String typeDefault() { - return this.typeDefault; - } - /** * API name: {@code compression} */ @@ -120,11 +108,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("type"); this.type.serialize(generator, mapper); - if (this.typeDefault != null) { - generator.writeKey("type.default"); - generator.write(this.typeDefault); - - } if (this.compression != null) { generator.writeKey("compression"); generator.write(this.compression); @@ -147,9 +130,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private NodeInfoSettingsHttpType type; - @Nullable - private String typeDefault; - @Nullable private Boolean compression; @@ -172,14 +152,6 @@ public final Builder type( return this.type(fn.apply(new NodeInfoSettingsHttpType.Builder()).build()); } - /** - * API name: {@code type.default} - */ - public final Builder typeDefault(@Nullable String value) { - this.typeDefault = value; - return this; - } - /** * API name: {@code compression} */ @@ -220,7 +192,6 @@ public NodeInfoSettingsHttp build() { protected static void setupNodeInfoSettingsHttpDeserializer(ObjectDeserializer op) { op.add(Builder::type, NodeInfoSettingsHttpType._DESERIALIZER, "type"); - op.add(Builder::typeDefault, JsonpDeserializer.stringDeserializer(), "type.default"); op.add(Builder::compression, JsonpDeserializer.booleanDeserializer(), "compression"); op.add(Builder::port, JsonpDeserializer.stringDeserializer(), "port"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsTransport.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsTransport.java index 620b6f24a..4a47b33c9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsTransport.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsTransport.java @@ -33,7 +33,6 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -50,9 +49,6 @@ public class NodeInfoSettingsTransport implements JsonpSerializable { private final NodeInfoSettingsTransportType type; - @Nullable - private final String typeDefault; - @Nullable private final NodeInfoSettingsTransportFeatures features; @@ -61,7 +57,6 @@ public class NodeInfoSettingsTransport implements JsonpSerializable { private NodeInfoSettingsTransport(Builder builder) { this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.typeDefault = builder.typeDefault; this.features = builder.features; } @@ -77,14 +72,6 @@ public final NodeInfoSettingsTransportType type() { return this.type; } - /** - * API name: {@code type.default} - */ - @Nullable - public final String typeDefault() { - return this.typeDefault; - } - /** * API name: {@code features} */ @@ -107,11 +94,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("type"); this.type.serialize(generator, mapper); - if (this.typeDefault != null) { - generator.writeKey("type.default"); - generator.write(this.typeDefault); - - } if (this.features != null) { generator.writeKey("features"); this.features.serialize(generator, mapper); @@ -129,9 +111,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private NodeInfoSettingsTransportType type; - @Nullable - private String typeDefault; - @Nullable private NodeInfoSettingsTransportFeatures features; @@ -151,14 +130,6 @@ public final Builder type( return this.type(fn.apply(new NodeInfoSettingsTransportType.Builder()).build()); } - /** - * API name: {@code type.default} - */ - public final Builder typeDefault(@Nullable String value) { - this.typeDefault = value; - return this; - } - /** * API name: {@code features} */ @@ -200,7 +171,6 @@ protected static void setupNodeInfoSettingsTransportDeserializer( ObjectDeserializer op) { op.add(Builder::type, NodeInfoSettingsTransportType._DESERIALIZER, "type"); - op.add(Builder::typeDefault, JsonpDeserializer.stringDeserializer(), "type.default"); op.add(Builder::features, NodeInfoSettingsTransportFeatures._DESERIALIZER, "features"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/GetRollupIndexCapsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/GetRollupIndexCapsRequest.java index 6aab97b40..aa98f5e54 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/GetRollupIndexCapsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/GetRollupIndexCapsRequest.java @@ -37,8 +37,10 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.Collections; +import java.util.List; import java.util.Objects; import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.Nullable; // typedef: rollup.get_rollup_index_caps.Request @@ -53,13 +55,13 @@ */ public class GetRollupIndexCapsRequest extends RequestBase { - private final String index; + private final List index; // --------------------------------------------------------------------------------------------- private GetRollupIndexCapsRequest(Builder builder) { - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); } @@ -73,7 +75,7 @@ public static GetRollupIndexCapsRequest of(Function * API name: {@code index} */ - public final String index() { + public final List index() { return this.index; } @@ -84,16 +86,31 @@ public final String index() { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String index; + private List index; /** * Required - The rollup index or index pattern to obtain rollup capabilities * from. *

* 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 - The rollup index or index pattern to obtain rollup capabilities + * from. + *

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

+ * Adds one or more values to index. */ - public final Builder index(String value) { - this.index = value; + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); return this; } @@ -135,7 +152,7 @@ public GetRollupIndexCapsRequest build() { if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); + SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); buf.append("/_rollup"); buf.append("/data"); return buf.toString(); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailure.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailure.java deleted file mode 100644 index d6c441613..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/delete_job/TaskFailure.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.rollup.delete_job; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: rollup.delete_job.TaskFailure - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TaskFailure implements JsonpSerializable { - private final String taskId; - - private final String nodeId; - - private final String status; - - private final TaskFailureReason reason; - - // --------------------------------------------------------------------------------------------- - - private TaskFailure(Builder builder) { - - this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); - this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); - - } - - public static TaskFailure of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code task_id} - */ - public final String taskId() { - return this.taskId; - } - - /** - * Required - API name: {@code node_id} - */ - public final String nodeId() { - return this.nodeId; - } - - /** - * Required - API name: {@code status} - */ - public final String status() { - return this.status; - } - - /** - * Required - API name: {@code reason} - */ - public final TaskFailureReason reason() { - return this.reason; - } - - /** - * 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("task_id"); - generator.write(this.taskId); - - generator.writeKey("node_id"); - generator.write(this.nodeId); - - generator.writeKey("status"); - generator.write(this.status); - - generator.writeKey("reason"); - this.reason.serialize(generator, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link TaskFailure}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String taskId; - - private String nodeId; - - private String status; - - private TaskFailureReason reason; - - /** - * Required - API name: {@code task_id} - */ - public final Builder taskId(String value) { - this.taskId = value; - return this; - } - - /** - * Required - API name: {@code node_id} - */ - public final Builder nodeId(String value) { - this.nodeId = value; - return this; - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(String value) { - this.status = value; - return this; - } - - /** - * Required - API name: {@code reason} - */ - public final Builder reason(TaskFailureReason value) { - this.reason = value; - return this; - } - - /** - * Required - API name: {@code reason} - */ - public final Builder reason(Function> fn) { - return this.reason(fn.apply(new TaskFailureReason.Builder()).build()); - } - - /** - * Builds a {@link TaskFailure}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public TaskFailure build() { - _checkSingleUse(); - - return new TaskFailure(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link TaskFailure} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - TaskFailure::setupTaskFailureDeserializer); - - protected static void setupTaskFailureDeserializer(ObjectDeserializer op) { - - op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); - op.add(Builder::nodeId, JsonpDeserializer.stringDeserializer(), "node_id"); - op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); - op.add(Builder::reason, TaskFailureReason._DESERIALIZER, "reason"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsRequest.java new file mode 100644 index 000000000..21899787e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsRequest.java @@ -0,0 +1,218 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.searchable_snapshots; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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.Nullable; + +// typedef: searchable_snapshots.cache_stats.Request + +/** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @see API + * specification + */ + +public class CacheStatsRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + + private final List nodeId; + + // --------------------------------------------------------------------------------------------- + + private CacheStatsRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId); + + } + + public static CacheStatsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * A comma-separated list of node IDs or names to limit the returned + * information; use _local to return information from the node + * you're connecting to, leave empty to get information from all nodes + *

+ * API name: {@code node_id} + */ + public final List nodeId() { + return this.nodeId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CacheStatsRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Time masterTimeout; + + @Nullable + private List nodeId; + + /** + * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * A comma-separated list of node IDs or names to limit the returned + * information; use _local to return information from the node + * you're connecting to, leave empty to get information from all nodes + *

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

+ * Adds all elements of list to nodeId. + */ + public final Builder nodeId(List list) { + this.nodeId = _listAddAll(this.nodeId, list); + return this; + } + + /** + * A comma-separated list of node IDs or names to limit the returned + * information; use _local to return information from the node + * you're connecting to, leave empty to get information from all nodes + *

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

+ * Adds one or more values to nodeId. + */ + public final Builder nodeId(String value, String... values) { + this.nodeId = _listAdd(this.nodeId, value, values); + return this; + } + + /** + * Builds a {@link CacheStatsRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CacheStatsRequest build() { + _checkSingleUse(); + + return new CacheStatsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code searchable_snapshots.cache_stats}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/searchable_snapshots.cache_stats", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _nodeId = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.nodeId())) + propsSet |= _nodeId; + + if (propsSet == 0) { + StringBuilder buf = new StringBuilder(); + buf.append("/_searchable_snapshots"); + buf.append("/cache"); + buf.append("/stats"); + return buf.toString(); + } + if (propsSet == (_nodeId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_searchable_snapshots"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.nodeId.stream().map(v -> v).collect(Collectors.joining(",")), + buf); + buf.append("/cache"); + buf.append("/stats"); + 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()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, CacheStatsResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ChainTransform.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsResponse.java similarity index 52% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ChainTransform.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsResponse.java index b95bbd7d4..4b684c47d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ChainTransform.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/CacheStatsResponse.java @@ -21,8 +21,9 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch._types; +package co.elastic.clients.elasticsearch.searchable_snapshots; +import co.elastic.clients.elasticsearch.searchable_snapshots.cache_stats.Node; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -33,47 +34,41 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.util.List; +import java.lang.String; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; -// typedef: _types.ChainTransform +// typedef: searchable_snapshots.cache_stats.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ChainTransform implements TransformVariant, JsonpSerializable { - private final List transforms; +public class CacheStatsResponse implements JsonpSerializable { + private final Map nodes; // --------------------------------------------------------------------------------------------- - private ChainTransform(Builder builder) { + private CacheStatsResponse(Builder builder) { - this.transforms = ApiTypeHelper.unmodifiableRequired(builder.transforms, this, "transforms"); + this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); } - public static ChainTransform of(Function> fn) { + public static CacheStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Transform variant kind. + * Required - API name: {@code nodes} */ - @Override - public Transform.Kind _transformKind() { - return Transform.Kind.Chain; - } - - /** - * Required - API name: {@code transforms} - */ - public final List transforms() { - return this.transforms; + public final Map nodes() { + return this.nodes; } /** @@ -87,11 +82,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.transforms)) { - generator.writeKey("transforms"); - generator.writeStartArray(); - for (Transform item0 : this.transforms) { - item0.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.nodes)) { + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } generator.writeEnd(); @@ -103,65 +99,65 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ChainTransform}. + * Builder for {@link CacheStatsResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private List transforms; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Map nodes; /** - * Required - API name: {@code transforms} + * Required - API name: {@code nodes} *

- * Adds all elements of list to transforms. + * Adds all entries of map to nodes. */ - public final Builder transforms(List list) { - this.transforms = _listAddAll(this.transforms, list); + public final Builder nodes(Map map) { + this.nodes = _mapPutAll(this.nodes, map); return this; } /** - * Required - API name: {@code transforms} + * Required - API name: {@code nodes} *

- * Adds one or more values to transforms. + * Adds an entry to nodes. */ - public final Builder transforms(Transform value, Transform... values) { - this.transforms = _listAdd(this.transforms, value, values); + public final Builder nodes(String key, Node value) { + this.nodes = _mapPut(this.nodes, key, value); return this; } /** - * Required - API name: {@code transforms} + * Required - API name: {@code nodes} *

- * Adds a value to transforms using a builder lambda. + * Adds an entry to nodes using a builder lambda. */ - public final Builder transforms(Function> fn) { - return transforms(fn.apply(new Transform.Builder()).build()); + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new Node.Builder()).build()); } /** - * Builds a {@link ChainTransform}. + * Builds a {@link CacheStatsResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public ChainTransform build() { + public CacheStatsResponse build() { _checkSingleUse(); - return new ChainTransform(this); + return new CacheStatsResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ChainTransform} + * Json deserializer for {@link CacheStatsResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ChainTransform::setupChainTransformDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, CacheStatsResponse::setupCacheStatsResponseDeserializer); - protected static void setupChainTransformDeserializer(ObjectDeserializer op) { + protected static void setupCacheStatsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::transforms, JsonpDeserializer.arrayDeserializer(Transform._DESERIALIZER), "transforms"); + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(Node._DESERIALIZER), "nodes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsAsyncClient.java index dfe97ce7c..bec379316 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsAsyncClient.java @@ -57,6 +57,52 @@ public ElasticsearchSearchableSnapshotsAsyncClient withTransportOptions( return new ElasticsearchSearchableSnapshotsAsyncClient(this.transport, transportOptions); } + // ----- Endpoint: searchable_snapshots.cache_stats + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture cacheStats(CacheStatsRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) CacheStatsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @param fn + * a function that initializes a builder to create the + * {@link CacheStatsRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture cacheStats( + Function> fn) { + return cacheStats(fn.apply(new CacheStatsRequest.Builder()).build()); + } + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture cacheStats() { + return this.transport.performRequestAsync(new CacheStatsRequest.Builder().build(), CacheStatsRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: searchable_snapshots.clear_cache /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsClient.java index 81e2809c1..b293cf959 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/ElasticsearchSearchableSnapshotsClient.java @@ -57,6 +57,52 @@ public ElasticsearchSearchableSnapshotsClient withTransportOptions(@Nullable Tra return new ElasticsearchSearchableSnapshotsClient(this.transport, transportOptions); } + // ----- Endpoint: searchable_snapshots.cache_stats + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @see Documentation + * on elastic.co + */ + + public CacheStatsResponse cacheStats(CacheStatsRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) CacheStatsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @param fn + * a function that initializes a builder to create the + * {@link CacheStatsRequest} + * @see Documentation + * on elastic.co + */ + + public final CacheStatsResponse cacheStats(Function> fn) + throws IOException, ElasticsearchException { + return cacheStats(fn.apply(new CacheStatsRequest.Builder()).build()); + } + + /** + * Retrieve node-level cache statistics about searchable snapshots. + * + * @see Documentation + * on elastic.co + */ + + public CacheStatsResponse cacheStats() throws IOException, ElasticsearchException { + return this.transport.performRequest(new CacheStatsRequest.Builder().build(), CacheStatsRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: searchable_snapshots.clear_cache /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Node.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Node.java new file mode 100644 index 000000000..8053cbf01 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Node.java @@ -0,0 +1,138 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.searchable_snapshots.cache_stats; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: searchable_snapshots.cache_stats.Node + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Node implements JsonpSerializable { + private final Shared sharedCache; + + // --------------------------------------------------------------------------------------------- + + private Node(Builder builder) { + + this.sharedCache = ApiTypeHelper.requireNonNull(builder.sharedCache, this, "sharedCache"); + + } + + public static Node of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code shared_cache} + */ + public final Shared sharedCache() { + return this.sharedCache; + } + + /** + * 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("shared_cache"); + this.sharedCache.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Node}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Shared sharedCache; + + /** + * Required - API name: {@code shared_cache} + */ + public final Builder sharedCache(Shared value) { + this.sharedCache = value; + return this; + } + + /** + * Required - API name: {@code shared_cache} + */ + public final Builder sharedCache(Function> fn) { + return this.sharedCache(fn.apply(new Shared.Builder()).build()); + } + + /** + * Builds a {@link Node}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Node build() { + _checkSingleUse(); + + return new Node(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Node} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Node::setupNodeDeserializer); + + protected static void setupNodeDeserializer(ObjectDeserializer op) { + + op.add(Builder::sharedCache, Shared._DESERIALIZER, "shared_cache"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Shared.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Shared.java new file mode 100644 index 000000000..4fa8d1fa1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/searchable_snapshots/cache_stats/Shared.java @@ -0,0 +1,303 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.searchable_snapshots.cache_stats; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.Long; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: searchable_snapshots.cache_stats.Shared + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Shared implements JsonpSerializable { + private final long reads; + + private final String bytesReadInBytes; + + private final long writes; + + private final String bytesWrittenInBytes; + + private final long evictions; + + private final int numRegions; + + private final String sizeInBytes; + + private final String regionSizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private Shared(Builder builder) { + + this.reads = ApiTypeHelper.requireNonNull(builder.reads, this, "reads"); + this.bytesReadInBytes = ApiTypeHelper.requireNonNull(builder.bytesReadInBytes, this, "bytesReadInBytes"); + this.writes = ApiTypeHelper.requireNonNull(builder.writes, this, "writes"); + this.bytesWrittenInBytes = ApiTypeHelper.requireNonNull(builder.bytesWrittenInBytes, this, + "bytesWrittenInBytes"); + this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.numRegions = ApiTypeHelper.requireNonNull(builder.numRegions, this, "numRegions"); + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); + this.regionSizeInBytes = ApiTypeHelper.requireNonNull(builder.regionSizeInBytes, this, "regionSizeInBytes"); + + } + + public static Shared of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code reads} + */ + public final long reads() { + return this.reads; + } + + /** + * Required - API name: {@code bytes_read_in_bytes} + */ + public final String bytesReadInBytes() { + return this.bytesReadInBytes; + } + + /** + * Required - API name: {@code writes} + */ + public final long writes() { + return this.writes; + } + + /** + * Required - API name: {@code bytes_written_in_bytes} + */ + public final String bytesWrittenInBytes() { + return this.bytesWrittenInBytes; + } + + /** + * Required - API name: {@code evictions} + */ + public final long evictions() { + return this.evictions; + } + + /** + * Required - API name: {@code num_regions} + */ + public final int numRegions() { + return this.numRegions; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final String sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Required - API name: {@code region_size_in_bytes} + */ + public final String regionSizeInBytes() { + return this.regionSizeInBytes; + } + + /** + * 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("reads"); + generator.write(this.reads); + + generator.writeKey("bytes_read_in_bytes"); + generator.write(this.bytesReadInBytes); + + generator.writeKey("writes"); + generator.write(this.writes); + + generator.writeKey("bytes_written_in_bytes"); + generator.write(this.bytesWrittenInBytes); + + generator.writeKey("evictions"); + generator.write(this.evictions); + + generator.writeKey("num_regions"); + generator.write(this.numRegions); + + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + + generator.writeKey("region_size_in_bytes"); + generator.write(this.regionSizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Shared}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long reads; + + private String bytesReadInBytes; + + private Long writes; + + private String bytesWrittenInBytes; + + private Long evictions; + + private Integer numRegions; + + private String sizeInBytes; + + private String regionSizeInBytes; + + /** + * Required - API name: {@code reads} + */ + public final Builder reads(long value) { + this.reads = value; + return this; + } + + /** + * Required - API name: {@code bytes_read_in_bytes} + */ + public final Builder bytesReadInBytes(String value) { + this.bytesReadInBytes = value; + return this; + } + + /** + * Required - API name: {@code writes} + */ + public final Builder writes(long value) { + this.writes = value; + return this; + } + + /** + * Required - API name: {@code bytes_written_in_bytes} + */ + public final Builder bytesWrittenInBytes(String value) { + this.bytesWrittenInBytes = value; + return this; + } + + /** + * Required - API name: {@code evictions} + */ + public final Builder evictions(long value) { + this.evictions = value; + return this; + } + + /** + * Required - API name: {@code num_regions} + */ + public final Builder numRegions(int value) { + this.numRegions = value; + return this; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(String value) { + this.sizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code region_size_in_bytes} + */ + public final Builder regionSizeInBytes(String value) { + this.regionSizeInBytes = value; + return this; + } + + /** + * Builds a {@link Shared}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Shared build() { + _checkSingleUse(); + + return new Shared(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Shared} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Shared::setupSharedDeserializer); + + protected static void setupSharedDeserializer(ObjectDeserializer op) { + + op.add(Builder::reads, JsonpDeserializer.longDeserializer(), "reads"); + op.add(Builder::bytesReadInBytes, JsonpDeserializer.stringDeserializer(), "bytes_read_in_bytes"); + op.add(Builder::writes, JsonpDeserializer.longDeserializer(), "writes"); + op.add(Builder::bytesWrittenInBytes, JsonpDeserializer.stringDeserializer(), "bytes_written_in_bytes"); + op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::numRegions, JsonpDeserializer.integerDeserializer(), "num_regions"); + op.add(Builder::sizeInBytes, JsonpDeserializer.stringDeserializer(), "size_in_bytes"); + op.add(Builder::regionSizeInBytes, JsonpDeserializer.stringDeserializer(), "region_size_in_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java index 689843ac8..8411aae0f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java @@ -30,6 +30,7 @@ import co.elastic.clients.transport.JsonEndpoint; import co.elastic.clients.transport.Transport; import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.transport.endpoints.BooleanResponse; import co.elastic.clients.util.ObjectBuilder; import java.util.concurrent.CompletableFuture; import java.util.function.Function; @@ -598,6 +599,35 @@ public final CompletableFuture enableUser( return enableUser(fn.apply(new EnableUserRequest.Builder()).build()); } + // ----- Endpoint: security.enroll_kibana + + /** + * Allows a kibana instance to configure itself to communicate with a secured + * elasticsearch cluster. + * + * @see Documentation + * on elastic.co + */ + public CompletableFuture enrollKibana() { + return this.transport.performRequestAsync(EnrollKibanaRequest._INSTANCE, EnrollKibanaRequest._ENDPOINT, + this.transportOptions); + } + + // ----- Endpoint: security.enroll_node + + /** + * Allows a new node to enroll to an existing cluster with security enabled. + * + * @see Documentation + * on elastic.co + */ + public CompletableFuture enrollNode() { + return this.transport.performRequestAsync(EnrollNodeRequest._INSTANCE, EnrollNodeRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: security.get_api_key /** @@ -1379,4 +1409,221 @@ public CompletableFuture queryApiKeys() { QueryApiKeysRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: security.saml_authenticate + + /** + * Exchanges a SAML Response message for an Elasticsearch access token and + * refresh token pair + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlAuthenticate(SamlAuthenticateRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlAuthenticateRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Exchanges a SAML Response message for an Elasticsearch access token and + * refresh token pair + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlAuthenticateRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlAuthenticate( + Function> fn) { + return samlAuthenticate(fn.apply(new SamlAuthenticateRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_complete_logout + + /** + * Verifies the logout response sent from the SAML IdP + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlCompleteLogout(SamlCompleteLogoutRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlCompleteLogoutRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Verifies the logout response sent from the SAML IdP + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlCompleteLogoutRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlCompleteLogout( + Function> fn) { + return samlCompleteLogout(fn.apply(new SamlCompleteLogoutRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_invalidate + + /** + * Consumes a SAML LogoutRequest + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlInvalidate(SamlInvalidateRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlInvalidateRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Consumes a SAML LogoutRequest + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlInvalidateRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlInvalidate( + Function> fn) { + return samlInvalidate(fn.apply(new SamlInvalidateRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_logout + + /** + * Invalidates an access token and a refresh token that were generated via the + * SAML Authenticate API + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlLogout(SamlLogoutRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlLogoutRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Invalidates an access token and a refresh token that were generated via the + * SAML Authenticate API + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlLogoutRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlLogout( + Function> fn) { + return samlLogout(fn.apply(new SamlLogoutRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_prepare_authentication + + /** + * Creates a SAML authentication request + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlPrepareAuthentication( + SamlPrepareAuthenticationRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlPrepareAuthenticationRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Creates a SAML authentication request + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlPrepareAuthenticationRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlPrepareAuthentication( + Function> fn) { + return samlPrepareAuthentication(fn.apply(new SamlPrepareAuthenticationRequest.Builder()).build()); + } + + /** + * Creates a SAML authentication request + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlPrepareAuthentication() { + return this.transport.performRequestAsync(new SamlPrepareAuthenticationRequest.Builder().build(), + SamlPrepareAuthenticationRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: security.saml_service_provider_metadata + + /** + * Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture samlServiceProviderMetadata( + SamlServiceProviderMetadataRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlServiceProviderMetadataRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlServiceProviderMetadataRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture samlServiceProviderMetadata( + Function> fn) { + return samlServiceProviderMetadata(fn.apply(new SamlServiceProviderMetadataRequest.Builder()).build()); + } + } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java index 1ddb83033..8a16ec723 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java @@ -31,6 +31,7 @@ import co.elastic.clients.transport.JsonEndpoint; import co.elastic.clients.transport.Transport; import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.transport.endpoints.BooleanResponse; import co.elastic.clients.util.ObjectBuilder; import java.io.IOException; import java.util.function.Function; @@ -616,6 +617,35 @@ public final EnableUserResponse enableUser(FunctionDocumentation + * on elastic.co + */ + public EnrollKibanaResponse enrollKibana() throws IOException, ElasticsearchException { + return this.transport.performRequest(EnrollKibanaRequest._INSTANCE, EnrollKibanaRequest._ENDPOINT, + this.transportOptions); + } + + // ----- Endpoint: security.enroll_node + + /** + * Allows a new node to enroll to an existing cluster with security enabled. + * + * @see Documentation + * on elastic.co + */ + public EnrollNodeResponse enrollNode() throws IOException, ElasticsearchException { + return this.transport.performRequest(EnrollNodeRequest._INSTANCE, EnrollNodeRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: security.get_api_key /** @@ -1418,4 +1448,229 @@ public QueryApiKeysResponse queryApiKeys() throws IOException, ElasticsearchExce this.transportOptions); } + // ----- Endpoint: security.saml_authenticate + + /** + * Exchanges a SAML Response message for an Elasticsearch access token and + * refresh token pair + * + * @see Documentation + * on elastic.co + */ + + public SamlAuthenticateResponse samlAuthenticate(SamlAuthenticateRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlAuthenticateRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Exchanges a SAML Response message for an Elasticsearch access token and + * refresh token pair + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlAuthenticateRequest} + * @see Documentation + * on elastic.co + */ + + public final SamlAuthenticateResponse samlAuthenticate( + Function> fn) + throws IOException, ElasticsearchException { + return samlAuthenticate(fn.apply(new SamlAuthenticateRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_complete_logout + + /** + * Verifies the logout response sent from the SAML IdP + * + * @see Documentation + * on elastic.co + */ + + public BooleanResponse samlCompleteLogout(SamlCompleteLogoutRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlCompleteLogoutRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Verifies the logout response sent from the SAML IdP + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlCompleteLogoutRequest} + * @see Documentation + * on elastic.co + */ + + public final BooleanResponse samlCompleteLogout( + Function> fn) + throws IOException, ElasticsearchException { + return samlCompleteLogout(fn.apply(new SamlCompleteLogoutRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_invalidate + + /** + * Consumes a SAML LogoutRequest + * + * @see Documentation + * on elastic.co + */ + + public SamlInvalidateResponse samlInvalidate(SamlInvalidateRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlInvalidateRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Consumes a SAML LogoutRequest + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlInvalidateRequest} + * @see Documentation + * on elastic.co + */ + + public final SamlInvalidateResponse samlInvalidate( + Function> fn) + throws IOException, ElasticsearchException { + return samlInvalidate(fn.apply(new SamlInvalidateRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_logout + + /** + * Invalidates an access token and a refresh token that were generated via the + * SAML Authenticate API + * + * @see Documentation + * on elastic.co + */ + + public SamlLogoutResponse samlLogout(SamlLogoutRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlLogoutRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Invalidates an access token and a refresh token that were generated via the + * SAML Authenticate API + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlLogoutRequest} + * @see Documentation + * on elastic.co + */ + + public final SamlLogoutResponse samlLogout(Function> fn) + throws IOException, ElasticsearchException { + return samlLogout(fn.apply(new SamlLogoutRequest.Builder()).build()); + } + + // ----- Endpoint: security.saml_prepare_authentication + + /** + * Creates a SAML authentication request + * + * @see Documentation + * on elastic.co + */ + + public SamlPrepareAuthenticationResponse samlPrepareAuthentication(SamlPrepareAuthenticationRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlPrepareAuthenticationRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Creates a SAML authentication request + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlPrepareAuthenticationRequest} + * @see Documentation + * on elastic.co + */ + + public final SamlPrepareAuthenticationResponse samlPrepareAuthentication( + Function> fn) + throws IOException, ElasticsearchException { + return samlPrepareAuthentication(fn.apply(new SamlPrepareAuthenticationRequest.Builder()).build()); + } + + /** + * Creates a SAML authentication request + * + * @see Documentation + * on elastic.co + */ + + public SamlPrepareAuthenticationResponse samlPrepareAuthentication() throws IOException, ElasticsearchException { + return this.transport.performRequest(new SamlPrepareAuthenticationRequest.Builder().build(), + SamlPrepareAuthenticationRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: security.saml_service_provider_metadata + + /** + * Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider + * + * @see Documentation + * on elastic.co + */ + + public SamlServiceProviderMetadataResponse samlServiceProviderMetadata(SamlServiceProviderMetadataRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) SamlServiceProviderMetadataRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider + * + * @param fn + * a function that initializes a builder to create the + * {@link SamlServiceProviderMetadataRequest} + * @see Documentation + * on elastic.co + */ + + public final SamlServiceProviderMetadataResponse samlServiceProviderMetadata( + Function> fn) + throws IOException, ElasticsearchException { + return samlServiceProviderMetadata(fn.apply(new SamlServiceProviderMetadataRequest.Builder()).build()); + } + } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaRequest.java new file mode 100644 index 000000000..70a0f8afb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaRequest.java @@ -0,0 +1,83 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Collections; +import java.util.Objects; + +// typedef: security.enroll_kibana.Request + +/** + * Enables a Kibana instance to configure itself for communication with a + * secured Elasticsearch cluster. + * + * @see API + * specification + */ + +public class EnrollKibanaRequest extends RequestBase { + public EnrollKibanaRequest() { + } + + /** + * Singleton instance for {@link EnrollKibanaRequest}. + */ + public static final EnrollKibanaRequest _INSTANCE = new EnrollKibanaRequest(); + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.enroll_kibana}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.enroll_kibana", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + return "/_security/enroll/kibana"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, EnrollKibanaResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemIndex.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaResponse.java similarity index 54% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemIndex.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaResponse.java index 5af76978c..6b8bc8700 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemIndex.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollKibanaResponse.java @@ -21,8 +21,9 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.indices.get_data_stream; +package co.elastic.clients.elasticsearch.security; +import co.elastic.clients.elasticsearch.security.enroll_kibana.Token; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -38,45 +39,44 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: indices.get_data_stream.IndicesGetDataStreamItemIndex +// typedef: security.enroll_kibana.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class IndicesGetDataStreamItemIndex implements JsonpSerializable { - private final String indexName; +public class EnrollKibanaResponse implements JsonpSerializable { + private final Token token; - private final String indexUuid; + private final String httpCa; // --------------------------------------------------------------------------------------------- - private IndicesGetDataStreamItemIndex(Builder builder) { + private EnrollKibanaResponse(Builder builder) { - this.indexName = ApiTypeHelper.requireNonNull(builder.indexName, this, "indexName"); - this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); + this.token = ApiTypeHelper.requireNonNull(builder.token, this, "token"); + this.httpCa = ApiTypeHelper.requireNonNull(builder.httpCa, this, "httpCa"); } - public static IndicesGetDataStreamItemIndex of(Function> fn) { + public static EnrollKibanaResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code index_name} + * Required - API name: {@code token} */ - public final String indexName() { - return this.indexName; + public final Token token() { + return this.token; } /** - * Required - API name: {@code index_uuid} + * Required - API name: {@code http_ca} */ - public final String indexUuid() { - return this.indexUuid; + public final String httpCa() { + return this.httpCa; } /** @@ -90,67 +90,73 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("index_name"); - generator.write(this.indexName); + generator.writeKey("token"); + this.token.serialize(generator, mapper); - generator.writeKey("index_uuid"); - generator.write(this.indexUuid); + generator.writeKey("http_ca"); + generator.write(this.httpCa); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link IndicesGetDataStreamItemIndex}. + * Builder for {@link EnrollKibanaResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String indexName; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Token token; - private String indexUuid; + private String httpCa; /** - * Required - API name: {@code index_name} + * Required - API name: {@code token} */ - public final Builder indexName(String value) { - this.indexName = value; + public final Builder token(Token value) { + this.token = value; return this; } /** - * Required - API name: {@code index_uuid} + * Required - API name: {@code token} */ - public final Builder indexUuid(String value) { - this.indexUuid = value; + public final Builder token(Function> fn) { + return this.token(fn.apply(new Token.Builder()).build()); + } + + /** + * Required - API name: {@code http_ca} + */ + public final Builder httpCa(String value) { + this.httpCa = value; return this; } /** - * Builds a {@link IndicesGetDataStreamItemIndex}. + * Builds a {@link EnrollKibanaResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public IndicesGetDataStreamItemIndex build() { + public EnrollKibanaResponse build() { _checkSingleUse(); - return new IndicesGetDataStreamItemIndex(this); + return new EnrollKibanaResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link IndicesGetDataStreamItemIndex} + * Json deserializer for {@link EnrollKibanaResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndicesGetDataStreamItemIndex::setupIndicesGetDataStreamItemIndexDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EnrollKibanaResponse::setupEnrollKibanaResponseDeserializer); - protected static void setupIndicesGetDataStreamItemIndexDeserializer( - ObjectDeserializer op) { + protected static void setupEnrollKibanaResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); - op.add(Builder::indexUuid, JsonpDeserializer.stringDeserializer(), "index_uuid"); + op.add(Builder::token, Token._DESERIALIZER, "token"); + op.add(Builder::httpCa, JsonpDeserializer.stringDeserializer(), "http_ca"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeRequest.java new file mode 100644 index 000000000..634deb905 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeRequest.java @@ -0,0 +1,82 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Collections; +import java.util.Objects; + +// typedef: security.enroll_node.Request + +/** + * Allows a new node to join an existing cluster with security features enabled. + * + * @see API + * specification + */ + +public class EnrollNodeRequest extends RequestBase { + public EnrollNodeRequest() { + } + + /** + * Singleton instance for {@link EnrollNodeRequest}. + */ + public static final EnrollNodeRequest _INSTANCE = new EnrollNodeRequest(); + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.enroll_node}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.enroll_node", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + return "/_security/enroll/node"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, EnrollNodeResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeResponse.java new file mode 100644 index 000000000..9a99800b2 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/EnrollNodeResponse.java @@ -0,0 +1,273 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.enroll_node.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EnrollNodeResponse implements JsonpSerializable { + private final String httpCaKey; + + private final String httpCaCert; + + private final String transportCaCert; + + private final String transportKey; + + private final String transportCert; + + private final List nodesAddresses; + + // --------------------------------------------------------------------------------------------- + + private EnrollNodeResponse(Builder builder) { + + this.httpCaKey = ApiTypeHelper.requireNonNull(builder.httpCaKey, this, "httpCaKey"); + this.httpCaCert = ApiTypeHelper.requireNonNull(builder.httpCaCert, this, "httpCaCert"); + this.transportCaCert = ApiTypeHelper.requireNonNull(builder.transportCaCert, this, "transportCaCert"); + this.transportKey = ApiTypeHelper.requireNonNull(builder.transportKey, this, "transportKey"); + this.transportCert = ApiTypeHelper.requireNonNull(builder.transportCert, this, "transportCert"); + this.nodesAddresses = ApiTypeHelper.unmodifiableRequired(builder.nodesAddresses, this, "nodesAddresses"); + + } + + public static EnrollNodeResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code http_ca_key} + */ + public final String httpCaKey() { + return this.httpCaKey; + } + + /** + * Required - API name: {@code http_ca_cert} + */ + public final String httpCaCert() { + return this.httpCaCert; + } + + /** + * Required - API name: {@code transport_ca_cert} + */ + public final String transportCaCert() { + return this.transportCaCert; + } + + /** + * Required - API name: {@code transport_key} + */ + public final String transportKey() { + return this.transportKey; + } + + /** + * Required - API name: {@code transport_cert} + */ + public final String transportCert() { + return this.transportCert; + } + + /** + * Required - API name: {@code nodes_addresses} + */ + public final List nodesAddresses() { + return this.nodesAddresses; + } + + /** + * 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("http_ca_key"); + generator.write(this.httpCaKey); + + generator.writeKey("http_ca_cert"); + generator.write(this.httpCaCert); + + generator.writeKey("transport_ca_cert"); + generator.write(this.transportCaCert); + + generator.writeKey("transport_key"); + generator.write(this.transportKey); + + generator.writeKey("transport_cert"); + generator.write(this.transportCert); + + if (ApiTypeHelper.isDefined(this.nodesAddresses)) { + generator.writeKey("nodes_addresses"); + generator.writeStartArray(); + for (String item0 : this.nodesAddresses) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EnrollNodeResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String httpCaKey; + + private String httpCaCert; + + private String transportCaCert; + + private String transportKey; + + private String transportCert; + + private List nodesAddresses; + + /** + * Required - API name: {@code http_ca_key} + */ + public final Builder httpCaKey(String value) { + this.httpCaKey = value; + return this; + } + + /** + * Required - API name: {@code http_ca_cert} + */ + public final Builder httpCaCert(String value) { + this.httpCaCert = value; + return this; + } + + /** + * Required - API name: {@code transport_ca_cert} + */ + public final Builder transportCaCert(String value) { + this.transportCaCert = value; + return this; + } + + /** + * Required - API name: {@code transport_key} + */ + public final Builder transportKey(String value) { + this.transportKey = value; + return this; + } + + /** + * Required - API name: {@code transport_cert} + */ + public final Builder transportCert(String value) { + this.transportCert = value; + return this; + } + + /** + * Required - API name: {@code nodes_addresses} + *

+ * Adds all elements of list to nodesAddresses. + */ + public final Builder nodesAddresses(List list) { + this.nodesAddresses = _listAddAll(this.nodesAddresses, list); + return this; + } + + /** + * Required - API name: {@code nodes_addresses} + *

+ * Adds one or more values to nodesAddresses. + */ + public final Builder nodesAddresses(String value, String... values) { + this.nodesAddresses = _listAdd(this.nodesAddresses, value, values); + return this; + } + + /** + * Builds a {@link EnrollNodeResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EnrollNodeResponse build() { + _checkSingleUse(); + + return new EnrollNodeResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EnrollNodeResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EnrollNodeResponse::setupEnrollNodeResponseDeserializer); + + protected static void setupEnrollNodeResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::httpCaKey, JsonpDeserializer.stringDeserializer(), "http_ca_key"); + op.add(Builder::httpCaCert, JsonpDeserializer.stringDeserializer(), "http_ca_cert"); + op.add(Builder::transportCaCert, JsonpDeserializer.stringDeserializer(), "transport_ca_cert"); + op.add(Builder::transportKey, JsonpDeserializer.stringDeserializer(), "transport_key"); + op.add(Builder::transportCert, JsonpDeserializer.stringDeserializer(), "transport_cert"); + op.add(Builder::nodesAddresses, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "nodes_addresses"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetPrivilegesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetPrivilegesRequest.java index ff9c2dc46..88e0f12be 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetPrivilegesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetPrivilegesRequest.java @@ -31,13 +31,16 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.transport.Endpoint; import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.Collections; +import java.util.List; import java.util.Objects; import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.Nullable; // typedef: security.get_privileges.Request @@ -53,15 +56,14 @@ public class GetPrivilegesRequest extends RequestBase { @Nullable private final String application; - @Nullable - private final String name; + private final List name; // --------------------------------------------------------------------------------------------- private GetPrivilegesRequest(Builder builder) { this.application = builder.application; - this.name = builder.name; + this.name = ApiTypeHelper.unmodifiable(builder.name); } @@ -84,8 +86,7 @@ public final String application() { *

* API name: {@code name} */ - @Nullable - public final String name() { + public final List name() { return this.name; } @@ -100,7 +101,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder name; /** * Application name @@ -116,9 +117,23 @@ public final Builder application(@Nullable String value) { * Privilege name *

* API name: {@code name} + *

+ * Adds all elements of list to name. + */ + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Privilege name + *

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

+ * Adds one or more values to name. */ - public final Builder name(@Nullable String value) { - this.name = value; + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); return this; } @@ -158,7 +173,7 @@ public GetPrivilegesRequest build() { if (request.application() != null) propsSet |= _application; - if (request.name() != null) + if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; if (propsSet == 0) { @@ -182,7 +197,7 @@ public GetPrivilegesRequest build() { buf.append("/"); SimpleEndpoint.pathEncode(request.application, buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateRequest.java new file mode 100644 index 000000000..e656018d6 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateRequest.java @@ -0,0 +1,259 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_authenticate.Request + +/** + * Submits a SAML Response message to Elasticsearch for consumption. + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlAuthenticateRequest extends RequestBase implements JsonpSerializable { + private final String content; + + private final List ids; + + @Nullable + private final String realm; + + // --------------------------------------------------------------------------------------------- + + private SamlAuthenticateRequest(Builder builder) { + + this.content = ApiTypeHelper.requireNonNull(builder.content, this, "content"); + this.ids = ApiTypeHelper.unmodifiableRequired(builder.ids, this, "ids"); + this.realm = builder.realm; + + } + + public static SamlAuthenticateRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The SAML response as it was sent by the user’s browser, usually a + * Base64 encoded XML document. + *

+ * API name: {@code content} + */ + public final String content() { + return this.content; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

+ * API name: {@code ids} + */ + public final List ids() { + return this.ids; + } + + /** + * The name of the realm that should authenticate the SAML response. Useful in + * cases where many SAML realms are defined. + *

+ * API name: {@code realm} + */ + @Nullable + public final String realm() { + return this.realm; + } + + /** + * 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("content"); + generator.write(this.content); + + if (ApiTypeHelper.isDefined(this.ids)) { + generator.writeKey("ids"); + generator.writeStartArray(); + for (String item0 : this.ids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.realm != null) { + generator.writeKey("realm"); + generator.write(this.realm); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlAuthenticateRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String content; + + private List ids; + + @Nullable + private String realm; + + /** + * Required - The SAML response as it was sent by the user’s browser, usually a + * Base64 encoded XML document. + *

+ * API name: {@code content} + */ + public final Builder content(String value) { + this.content = value; + return this; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

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

+ * Adds all elements of list to ids. + */ + public final Builder ids(List list) { + this.ids = _listAddAll(this.ids, list); + return this; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

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

+ * Adds one or more values to ids. + */ + public final Builder ids(String value, String... values) { + this.ids = _listAdd(this.ids, value, values); + return this; + } + + /** + * The name of the realm that should authenticate the SAML response. Useful in + * cases where many SAML realms are defined. + *

+ * API name: {@code realm} + */ + public final Builder realm(@Nullable String value) { + this.realm = value; + return this; + } + + /** + * Builds a {@link SamlAuthenticateRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlAuthenticateRequest build() { + _checkSingleUse(); + + return new SamlAuthenticateRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlAuthenticateRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlAuthenticateRequest::setupSamlAuthenticateRequestDeserializer); + + protected static void setupSamlAuthenticateRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::content, JsonpDeserializer.stringDeserializer(), "content"); + op.add(Builder::ids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "ids"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_authenticate}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.saml_authenticate", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/saml/authenticate"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, SamlAuthenticateResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateResponse.java new file mode 100644 index 000000000..be00a3986 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlAuthenticateResponse.java @@ -0,0 +1,230 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_authenticate.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlAuthenticateResponse implements JsonpSerializable { + private final String accessToken; + + private final String username; + + private final int expiresIn; + + private final String refreshToken; + + private final String realm; + + // --------------------------------------------------------------------------------------------- + + private SamlAuthenticateResponse(Builder builder) { + + this.accessToken = ApiTypeHelper.requireNonNull(builder.accessToken, this, "accessToken"); + this.username = ApiTypeHelper.requireNonNull(builder.username, this, "username"); + this.expiresIn = ApiTypeHelper.requireNonNull(builder.expiresIn, this, "expiresIn"); + this.refreshToken = ApiTypeHelper.requireNonNull(builder.refreshToken, this, "refreshToken"); + this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); + + } + + public static SamlAuthenticateResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code access_token} + */ + public final String accessToken() { + return this.accessToken; + } + + /** + * Required - API name: {@code username} + */ + public final String username() { + return this.username; + } + + /** + * Required - API name: {@code expires_in} + */ + public final int expiresIn() { + return this.expiresIn; + } + + /** + * Required - API name: {@code refresh_token} + */ + public final String refreshToken() { + return this.refreshToken; + } + + /** + * Required - API name: {@code realm} + */ + public final String realm() { + return this.realm; + } + + /** + * 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("access_token"); + generator.write(this.accessToken); + + generator.writeKey("username"); + generator.write(this.username); + + generator.writeKey("expires_in"); + generator.write(this.expiresIn); + + generator.writeKey("refresh_token"); + generator.write(this.refreshToken); + + generator.writeKey("realm"); + generator.write(this.realm); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlAuthenticateResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String accessToken; + + private String username; + + private Integer expiresIn; + + private String refreshToken; + + private String realm; + + /** + * Required - API name: {@code access_token} + */ + public final Builder accessToken(String value) { + this.accessToken = value; + return this; + } + + /** + * Required - API name: {@code username} + */ + public final Builder username(String value) { + this.username = value; + return this; + } + + /** + * Required - API name: {@code expires_in} + */ + public final Builder expiresIn(int value) { + this.expiresIn = value; + return this; + } + + /** + * Required - API name: {@code refresh_token} + */ + public final Builder refreshToken(String value) { + this.refreshToken = value; + return this; + } + + /** + * Required - API name: {@code realm} + */ + public final Builder realm(String value) { + this.realm = value; + return this; + } + + /** + * Builds a {@link SamlAuthenticateResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlAuthenticateResponse build() { + _checkSingleUse(); + + return new SamlAuthenticateResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlAuthenticateResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlAuthenticateResponse::setupSamlAuthenticateResponseDeserializer); + + protected static void setupSamlAuthenticateResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::accessToken, JsonpDeserializer.stringDeserializer(), "access_token"); + op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); + op.add(Builder::expiresIn, JsonpDeserializer.integerDeserializer(), "expires_in"); + op.add(Builder::refreshToken, JsonpDeserializer.stringDeserializer(), "refresh_token"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutRequest.java new file mode 100644 index 000000000..606d7b4d4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutRequest.java @@ -0,0 +1,297 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.BooleanEndpoint; +import co.elastic.clients.transport.endpoints.BooleanResponse; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_complete_logout.Request + +/** + * Verifies the logout response sent from the SAML IdP. + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlCompleteLogoutRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String content; + + private final List ids; + + @Nullable + private final String queryString; + + private final String realm; + + // --------------------------------------------------------------------------------------------- + + private SamlCompleteLogoutRequest(Builder builder) { + + this.content = builder.content; + this.ids = ApiTypeHelper.unmodifiableRequired(builder.ids, this, "ids"); + this.queryString = builder.queryString; + this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); + + } + + public static SamlCompleteLogoutRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If the SAML IdP sends the logout response with the HTTP-Post binding, this + * field must be set to the value of the SAMLResponse form parameter from the + * logout response. + *

+ * API name: {@code content} + */ + @Nullable + public final String content() { + return this.content; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

+ * API name: {@code ids} + */ + public final List ids() { + return this.ids; + } + + /** + * If the SAML IdP sends the logout response with the HTTP-Redirect binding, + * this field must be set to the query string of the redirect URI. + *

+ * API name: {@code query_string} + */ + @Nullable + public final String queryString() { + return this.queryString; + } + + /** + * Required - The name of the SAML realm in Elasticsearch for which the + * configuration is used to verify the logout response. + *

+ * API name: {@code realm} + */ + public final String realm() { + return this.realm; + } + + /** + * 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.content != null) { + generator.writeKey("content"); + generator.write(this.content); + + } + if (ApiTypeHelper.isDefined(this.ids)) { + generator.writeKey("ids"); + generator.writeStartArray(); + for (String item0 : this.ids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.queryString != null) { + generator.writeKey("query_string"); + generator.write(this.queryString); + + } + generator.writeKey("realm"); + generator.write(this.realm); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlCompleteLogoutRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String content; + + private List ids; + + @Nullable + private String queryString; + + private String realm; + + /** + * If the SAML IdP sends the logout response with the HTTP-Post binding, this + * field must be set to the value of the SAMLResponse form parameter from the + * logout response. + *

+ * API name: {@code content} + */ + public final Builder content(@Nullable String value) { + this.content = value; + return this; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

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

+ * Adds all elements of list to ids. + */ + public final Builder ids(List list) { + this.ids = _listAddAll(this.ids, list); + return this; + } + + /** + * Required - A json array with all the valid SAML Request Ids that the caller + * of the API has for the current user. + *

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

+ * Adds one or more values to ids. + */ + public final Builder ids(String value, String... values) { + this.ids = _listAdd(this.ids, value, values); + return this; + } + + /** + * If the SAML IdP sends the logout response with the HTTP-Redirect binding, + * this field must be set to the query string of the redirect URI. + *

+ * API name: {@code query_string} + */ + public final Builder queryString(@Nullable String value) { + this.queryString = value; + return this; + } + + /** + * Required - The name of the SAML realm in Elasticsearch for which the + * configuration is used to verify the logout response. + *

+ * API name: {@code realm} + */ + public final Builder realm(String value) { + this.realm = value; + return this; + } + + /** + * Builds a {@link SamlCompleteLogoutRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlCompleteLogoutRequest build() { + _checkSingleUse(); + + return new SamlCompleteLogoutRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlCompleteLogoutRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlCompleteLogoutRequest::setupSamlCompleteLogoutRequestDeserializer); + + protected static void setupSamlCompleteLogoutRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::content, JsonpDeserializer.stringDeserializer(), "content"); + op.add(Builder::ids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "ids"); + op.add(Builder::queryString, JsonpDeserializer.stringDeserializer(), "query_string"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_complete_logout}". + */ + public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( + "es/security.saml_complete_logout", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/saml/complete_logout"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, null); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutResponse.java similarity index 69% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeResponse.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutResponse.java index 723010d60..7816d84a3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsTypeResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlCompleteLogoutResponse.java @@ -21,7 +21,7 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.indices; +package co.elastic.clients.elasticsearch.security; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -31,24 +31,25 @@ import jakarta.json.stream.JsonGenerator; import java.util.Objects; -// typedef: indices.exists_type.Response +// typedef: security.saml_complete_logout.Response /** * - * @see API + * @see API * specification */ -public class ExistsTypeResponse { - public ExistsTypeResponse() { +public class SamlCompleteLogoutResponse { + public SamlCompleteLogoutResponse() { } /** - * Singleton instance for {@link ExistsTypeResponse}. + * Singleton instance for {@link SamlCompleteLogoutResponse}. */ - public static final ExistsTypeResponse _INSTANCE = new ExistsTypeResponse(); + public static final SamlCompleteLogoutResponse _INSTANCE = new SamlCompleteLogoutResponse(); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .fixedValue(ExistsTypeResponse._INSTANCE); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .fixedValue(SamlCompleteLogoutResponse._INSTANCE); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateRequest.java new file mode 100644 index 000000000..6ac8734ad --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateRequest.java @@ -0,0 +1,258 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_invalidate.Request + +/** + * Submits a SAML LogoutRequest message to Elasticsearch for consumption. + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlInvalidateRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String acs; + + private final String queryString; + + @Nullable + private final String realm; + + // --------------------------------------------------------------------------------------------- + + private SamlInvalidateRequest(Builder builder) { + + this.acs = builder.acs; + this.queryString = ApiTypeHelper.requireNonNull(builder.queryString, this, "queryString"); + this.realm = builder.realm; + + } + + public static SamlInvalidateRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The Assertion Consumer Service URL that matches the one of the SAML realm in + * Elasticsearch that should be used. You must specify either this parameter or + * the realm parameter. + *

+ * API name: {@code acs} + */ + @Nullable + public final String acs() { + return this.acs; + } + + /** + * Required - The query part of the URL that the user was redirected to by the + * SAML IdP to initiate the Single Logout. This query should include a single + * parameter named SAMLRequest that contains a SAML logout request that is + * deflated and Base64 encoded. If the SAML IdP has signed the logout request, + * the URL should include two extra parameters named SigAlg and Signature that + * contain the algorithm used for the signature and the signature value itself. + * In order for Elasticsearch to be able to verify the IdP’s signature, the + * value of the query_string field must be an exact match to the string provided + * by the browser. The client application must not attempt to parse or process + * the string in any way. + *

+ * API name: {@code query_string} + */ + public final String queryString() { + return this.queryString; + } + + /** + * The name of the SAML realm in Elasticsearch the configuration. You must + * specify either this parameter or the acs parameter. + *

+ * API name: {@code realm} + */ + @Nullable + public final String realm() { + return this.realm; + } + + /** + * 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.acs != null) { + generator.writeKey("acs"); + generator.write(this.acs); + + } + generator.writeKey("query_string"); + generator.write(this.queryString); + + if (this.realm != null) { + generator.writeKey("realm"); + generator.write(this.realm); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlInvalidateRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String acs; + + private String queryString; + + @Nullable + private String realm; + + /** + * The Assertion Consumer Service URL that matches the one of the SAML realm in + * Elasticsearch that should be used. You must specify either this parameter or + * the realm parameter. + *

+ * API name: {@code acs} + */ + public final Builder acs(@Nullable String value) { + this.acs = value; + return this; + } + + /** + * Required - The query part of the URL that the user was redirected to by the + * SAML IdP to initiate the Single Logout. This query should include a single + * parameter named SAMLRequest that contains a SAML logout request that is + * deflated and Base64 encoded. If the SAML IdP has signed the logout request, + * the URL should include two extra parameters named SigAlg and Signature that + * contain the algorithm used for the signature and the signature value itself. + * In order for Elasticsearch to be able to verify the IdP’s signature, the + * value of the query_string field must be an exact match to the string provided + * by the browser. The client application must not attempt to parse or process + * the string in any way. + *

+ * API name: {@code query_string} + */ + public final Builder queryString(String value) { + this.queryString = value; + return this; + } + + /** + * The name of the SAML realm in Elasticsearch the configuration. You must + * specify either this parameter or the acs parameter. + *

+ * API name: {@code realm} + */ + public final Builder realm(@Nullable String value) { + this.realm = value; + return this; + } + + /** + * Builds a {@link SamlInvalidateRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlInvalidateRequest build() { + _checkSingleUse(); + + return new SamlInvalidateRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlInvalidateRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlInvalidateRequest::setupSamlInvalidateRequestDeserializer); + + protected static void setupSamlInvalidateRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::acs, JsonpDeserializer.stringDeserializer(), "acs"); + op.add(Builder::queryString, JsonpDeserializer.stringDeserializer(), "query_string"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_invalidate}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.saml_invalidate", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/saml/invalidate"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, SamlInvalidateResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateResponse.java new file mode 100644 index 000000000..c9316186c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlInvalidateResponse.java @@ -0,0 +1,182 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_invalidate.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlInvalidateResponse implements JsonpSerializable { + private final int invalidated; + + private final String realm; + + private final String redirect; + + // --------------------------------------------------------------------------------------------- + + private SamlInvalidateResponse(Builder builder) { + + this.invalidated = ApiTypeHelper.requireNonNull(builder.invalidated, this, "invalidated"); + this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); + this.redirect = ApiTypeHelper.requireNonNull(builder.redirect, this, "redirect"); + + } + + public static SamlInvalidateResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code invalidated} + */ + public final int invalidated() { + return this.invalidated; + } + + /** + * Required - API name: {@code realm} + */ + public final String realm() { + return this.realm; + } + + /** + * Required - API name: {@code redirect} + */ + public final String redirect() { + return this.redirect; + } + + /** + * 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("invalidated"); + generator.write(this.invalidated); + + generator.writeKey("realm"); + generator.write(this.realm); + + generator.writeKey("redirect"); + generator.write(this.redirect); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlInvalidateResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer invalidated; + + private String realm; + + private String redirect; + + /** + * Required - API name: {@code invalidated} + */ + public final Builder invalidated(int value) { + this.invalidated = value; + return this; + } + + /** + * Required - API name: {@code realm} + */ + public final Builder realm(String value) { + this.realm = value; + return this; + } + + /** + * Required - API name: {@code redirect} + */ + public final Builder redirect(String value) { + this.redirect = value; + return this; + } + + /** + * Builds a {@link SamlInvalidateResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlInvalidateResponse build() { + _checkSingleUse(); + + return new SamlInvalidateResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlInvalidateResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlInvalidateResponse::setupSamlInvalidateResponseDeserializer); + + protected static void setupSamlInvalidateResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::invalidated, JsonpDeserializer.integerDeserializer(), "invalidated"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + op.add(Builder::redirect, JsonpDeserializer.stringDeserializer(), "redirect"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutRequest.java new file mode 100644 index 000000000..36f7f80bd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutRequest.java @@ -0,0 +1,207 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_logout.Request + +/** + * Submits a request to invalidate an access token and refresh token. + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlLogoutRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String refreshToken; + + private final String token; + + // --------------------------------------------------------------------------------------------- + + private SamlLogoutRequest(Builder builder) { + + this.refreshToken = builder.refreshToken; + this.token = ApiTypeHelper.requireNonNull(builder.token, this, "token"); + + } + + public static SamlLogoutRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The refresh token that was returned as a response to calling the SAML + * authenticate API. Alternatively, the most recent refresh token that was + * received after refreshing the original access token. + *

+ * API name: {@code refresh_token} + */ + @Nullable + public final String refreshToken() { + return this.refreshToken; + } + + /** + * Required - The access token that was returned as a response to calling the + * SAML authenticate API. Alternatively, the most recent token that was received + * after refreshing the original one by using a refresh_token. + *

+ * API name: {@code token} + */ + public final String token() { + return this.token; + } + + /** + * 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.refreshToken != null) { + generator.writeKey("refresh_token"); + generator.write(this.refreshToken); + + } + generator.writeKey("token"); + generator.write(this.token); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlLogoutRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String refreshToken; + + private String token; + + /** + * The refresh token that was returned as a response to calling the SAML + * authenticate API. Alternatively, the most recent refresh token that was + * received after refreshing the original access token. + *

+ * API name: {@code refresh_token} + */ + public final Builder refreshToken(@Nullable String value) { + this.refreshToken = value; + return this; + } + + /** + * Required - The access token that was returned as a response to calling the + * SAML authenticate API. Alternatively, the most recent token that was received + * after refreshing the original one by using a refresh_token. + *

+ * API name: {@code token} + */ + public final Builder token(String value) { + this.token = value; + return this; + } + + /** + * Builds a {@link SamlLogoutRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlLogoutRequest build() { + _checkSingleUse(); + + return new SamlLogoutRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlLogoutRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlLogoutRequest::setupSamlLogoutRequestDeserializer); + + protected static void setupSamlLogoutRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::refreshToken, JsonpDeserializer.stringDeserializer(), "refresh_token"); + op.add(Builder::token, JsonpDeserializer.stringDeserializer(), "token"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_logout}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.saml_logout", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/saml/logout"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, SamlLogoutResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutResponse.java new file mode 100644 index 000000000..ddb9d8d3a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlLogoutResponse.java @@ -0,0 +1,131 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_logout.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlLogoutResponse implements JsonpSerializable { + private final String redirect; + + // --------------------------------------------------------------------------------------------- + + private SamlLogoutResponse(Builder builder) { + + this.redirect = ApiTypeHelper.requireNonNull(builder.redirect, this, "redirect"); + + } + + public static SamlLogoutResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code redirect} + */ + public final String redirect() { + return this.redirect; + } + + /** + * 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("redirect"); + generator.write(this.redirect); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlLogoutResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String redirect; + + /** + * Required - API name: {@code redirect} + */ + public final Builder redirect(String value) { + this.redirect = value; + return this; + } + + /** + * Builds a {@link SamlLogoutResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlLogoutResponse build() { + _checkSingleUse(); + + return new SamlLogoutResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlLogoutResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlLogoutResponse::setupSamlLogoutResponseDeserializer); + + protected static void setupSamlLogoutResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::redirect, JsonpDeserializer.stringDeserializer(), "redirect"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationRequest.java new file mode 100644 index 000000000..fff649a35 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationRequest.java @@ -0,0 +1,253 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_prepare_authentication.Request + +/** + * Creates a SAML authentication request (<AuthnRequest>) as a URL string, + * based on the configuration of the respective SAML realm in Elasticsearch. + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlPrepareAuthenticationRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String acs; + + @Nullable + private final String realm; + + @Nullable + private final String relayState; + + // --------------------------------------------------------------------------------------------- + + private SamlPrepareAuthenticationRequest(Builder builder) { + + this.acs = builder.acs; + this.realm = builder.realm; + this.relayState = builder.relayState; + + } + + public static SamlPrepareAuthenticationRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The Assertion Consumer Service URL that matches the one of the SAML realms in + * Elasticsearch. The realm is used to generate the authentication request. You + * must specify either this parameter or the realm parameter. + *

+ * API name: {@code acs} + */ + @Nullable + public final String acs() { + return this.acs; + } + + /** + * The name of the SAML realm in Elasticsearch for which the configuration is + * used to generate the authentication request. You must specify either this + * parameter or the acs parameter. + *

+ * API name: {@code realm} + */ + @Nullable + public final String realm() { + return this.realm; + } + + /** + * A string that will be included in the redirect URL that this API returns as + * the RelayState query parameter. If the Authentication Request is signed, this + * value is used as part of the signature computation. + *

+ * API name: {@code relay_state} + */ + @Nullable + public final String relayState() { + return this.relayState; + } + + /** + * 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.acs != null) { + generator.writeKey("acs"); + generator.write(this.acs); + + } + if (this.realm != null) { + generator.writeKey("realm"); + generator.write(this.realm); + + } + if (this.relayState != null) { + generator.writeKey("relay_state"); + generator.write(this.relayState); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlPrepareAuthenticationRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String acs; + + @Nullable + private String realm; + + @Nullable + private String relayState; + + /** + * The Assertion Consumer Service URL that matches the one of the SAML realms in + * Elasticsearch. The realm is used to generate the authentication request. You + * must specify either this parameter or the realm parameter. + *

+ * API name: {@code acs} + */ + public final Builder acs(@Nullable String value) { + this.acs = value; + return this; + } + + /** + * The name of the SAML realm in Elasticsearch for which the configuration is + * used to generate the authentication request. You must specify either this + * parameter or the acs parameter. + *

+ * API name: {@code realm} + */ + public final Builder realm(@Nullable String value) { + this.realm = value; + return this; + } + + /** + * A string that will be included in the redirect URL that this API returns as + * the RelayState query parameter. If the Authentication Request is signed, this + * value is used as part of the signature computation. + *

+ * API name: {@code relay_state} + */ + public final Builder relayState(@Nullable String value) { + this.relayState = value; + return this; + } + + /** + * Builds a {@link SamlPrepareAuthenticationRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlPrepareAuthenticationRequest build() { + _checkSingleUse(); + + return new SamlPrepareAuthenticationRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlPrepareAuthenticationRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlPrepareAuthenticationRequest::setupSamlPrepareAuthenticationRequestDeserializer); + + protected static void setupSamlPrepareAuthenticationRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::acs, JsonpDeserializer.stringDeserializer(), "acs"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + op.add(Builder::relayState, JsonpDeserializer.stringDeserializer(), "relay_state"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_prepare_authentication}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.saml_prepare_authentication", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/saml/prepare"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, SamlPrepareAuthenticationResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationResponse.java new file mode 100644 index 000000000..2dc8eb468 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlPrepareAuthenticationResponse.java @@ -0,0 +1,182 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_prepare_authentication.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlPrepareAuthenticationResponse implements JsonpSerializable { + private final String id; + + private final String realm; + + private final String redirect; + + // --------------------------------------------------------------------------------------------- + + private SamlPrepareAuthenticationResponse(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); + this.redirect = ApiTypeHelper.requireNonNull(builder.redirect, this, "redirect"); + + } + + public static SamlPrepareAuthenticationResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - API name: {@code realm} + */ + public final String realm() { + return this.realm; + } + + /** + * Required - API name: {@code redirect} + */ + public final String redirect() { + return this.redirect; + } + + /** + * 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("id"); + generator.write(this.id); + + generator.writeKey("realm"); + generator.write(this.realm); + + generator.writeKey("redirect"); + generator.write(this.redirect); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlPrepareAuthenticationResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String id; + + private String realm; + + private String redirect; + + /** + * Required - API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - API name: {@code realm} + */ + public final Builder realm(String value) { + this.realm = value; + return this; + } + + /** + * Required - API name: {@code redirect} + */ + public final Builder redirect(String value) { + this.redirect = value; + return this; + } + + /** + * Builds a {@link SamlPrepareAuthenticationResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlPrepareAuthenticationResponse build() { + _checkSingleUse(); + + return new SamlPrepareAuthenticationResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlPrepareAuthenticationResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SamlPrepareAuthenticationResponse::setupSamlPrepareAuthenticationResponseDeserializer); + + protected static void setupSamlPrepareAuthenticationResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); + op.add(Builder::redirect, JsonpDeserializer.stringDeserializer(), "redirect"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataRequest.java new file mode 100644 index 000000000..5424bb202 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataRequest.java @@ -0,0 +1,151 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_service_provider_metadata.Request + +/** + * Generate SAML metadata for a SAML 2.0 Service Provider. + * + * @see API + * specification + */ + +public class SamlServiceProviderMetadataRequest extends RequestBase { + private final String realmName; + + // --------------------------------------------------------------------------------------------- + + private SamlServiceProviderMetadataRequest(Builder builder) { + + this.realmName = ApiTypeHelper.requireNonNull(builder.realmName, this, "realmName"); + + } + + public static SamlServiceProviderMetadataRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the SAML realm in Elasticsearch. + *

+ * API name: {@code realm_name} + */ + public final String realmName() { + return this.realmName; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlServiceProviderMetadataRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String realmName; + + /** + * Required - The name of the SAML realm in Elasticsearch. + *

+ * API name: {@code realm_name} + */ + public final Builder realmName(String value) { + this.realmName = value; + return this; + } + + /** + * Builds a {@link SamlServiceProviderMetadataRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlServiceProviderMetadataRequest build() { + _checkSingleUse(); + + return new SamlServiceProviderMetadataRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.saml_service_provider_metadata}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.saml_service_provider_metadata", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _realmName = 1 << 0; + + int propsSet = 0; + + propsSet |= _realmName; + + if (propsSet == (_realmName)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_security"); + buf.append("/saml"); + buf.append("/metadata"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.realmName, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, SamlServiceProviderMetadataResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataResponse.java new file mode 100644 index 000000000..4ec4116c2 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SamlServiceProviderMetadataResponse.java @@ -0,0 +1,137 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.saml_service_provider_metadata.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SamlServiceProviderMetadataResponse implements JsonpSerializable { + private final String metadata; + + // --------------------------------------------------------------------------------------------- + + private SamlServiceProviderMetadataResponse(Builder builder) { + + this.metadata = ApiTypeHelper.requireNonNull(builder.metadata, this, "metadata"); + + } + + public static SamlServiceProviderMetadataResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code metadata} + */ + public final String metadata() { + return this.metadata; + } + + /** + * 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("metadata"); + generator.write(this.metadata); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SamlServiceProviderMetadataResponse}. + */ + + public static class Builder extends ObjectBuilderBase + implements + ObjectBuilder { + private String metadata; + + /** + * Required - API name: {@code metadata} + */ + public final Builder metadata(String value) { + this.metadata = value; + return this; + } + + /** + * Builds a {@link SamlServiceProviderMetadataResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SamlServiceProviderMetadataResponse build() { + _checkSingleUse(); + + return new SamlServiceProviderMetadataResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SamlServiceProviderMetadataResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + SamlServiceProviderMetadataResponse::setupSamlServiceProviderMetadataResponseDeserializer); + + protected static void setupSamlServiceProviderMetadataResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::metadata, JsonpDeserializer.stringDeserializer(), "metadata"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemTimestampField.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/enroll_kibana/Token.java similarity index 67% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemTimestampField.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/security/enroll_kibana/Token.java index cec048610..84a334aaa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_stream/IndicesGetDataStreamItemTimestampField.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/enroll_kibana/Token.java @@ -21,7 +21,7 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.indices.get_data_stream; +package co.elastic.clients.elasticsearch.security.enroll_kibana; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -38,28 +38,29 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: indices.get_data_stream.IndicesGetDataStreamItemTimestampField +// typedef: security.enroll_kibana.Token /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class IndicesGetDataStreamItemTimestampField implements JsonpSerializable { +public class Token implements JsonpSerializable { private final String name; + private final String value; + // --------------------------------------------------------------------------------------------- - private IndicesGetDataStreamItemTimestampField(Builder builder) { + private Token(Builder builder) { this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value"); } - public static IndicesGetDataStreamItemTimestampField of( - Function> fn) { + public static Token of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -70,6 +71,13 @@ public final String name() { return this.name; } + /** + * Required - API name: {@code value} + */ + public final String value() { + return this.value; + } + /** * Serialize this object to JSON. */ @@ -84,19 +92,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("name"); generator.write(this.name); + generator.writeKey("value"); + generator.write(this.value); + } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link IndicesGetDataStreamItemTimestampField}. + * Builder for {@link Token}. */ - public static class Builder extends ObjectBuilderBase - implements - ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String name; + private String value; + /** * Required - API name: {@code name} */ @@ -106,31 +117,38 @@ public final Builder name(String value) { } /** - * Builds a {@link IndicesGetDataStreamItemTimestampField}. + * Required - API name: {@code value} + */ + public final Builder value(String value) { + this.value = value; + return this; + } + + /** + * Builds a {@link Token}. * * @throws NullPointerException * if some of the required fields are null. */ - public IndicesGetDataStreamItemTimestampField build() { + public Token build() { _checkSingleUse(); - return new IndicesGetDataStreamItemTimestampField(this); + return new Token(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link IndicesGetDataStreamItemTimestampField} + * Json deserializer for {@link Token} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - IndicesGetDataStreamItemTimestampField::setupIndicesGetDataStreamItemTimestampFieldDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Token::setupTokenDeserializer); - protected static void setupIndicesGetDataStreamItemTimestampFieldDeserializer( - ObjectDeserializer op) { + protected static void setupTokenDeserializer(ObjectDeserializer op) { op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::value, JsonpDeserializer.stringDeserializer(), "value"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_api_key/ApiKey.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_api_key/ApiKey.java deleted file mode 100644 index e6d62a7cb..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_api_key/ApiKey.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.security.get_api_key; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: security.get_api_key.ApiKey - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ApiKey implements JsonpSerializable { - private final long creation; - - @Nullable - private final Long expiration; - - private final String id; - - private final boolean invalidated; - - private final String name; - - private final String realm; - - private final String username; - - private final Map metadata; - - // --------------------------------------------------------------------------------------------- - - private ApiKey(Builder builder) { - - this.creation = ApiTypeHelper.requireNonNull(builder.creation, this, "creation"); - this.expiration = builder.expiration; - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.invalidated = ApiTypeHelper.requireNonNull(builder.invalidated, this, "invalidated"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); - this.username = ApiTypeHelper.requireNonNull(builder.username, this, "username"); - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - } - - public static ApiKey of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code creation} - */ - public final long creation() { - return this.creation; - } - - /** - * API name: {@code expiration} - */ - @Nullable - public final Long expiration() { - return this.expiration; - } - - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - API name: {@code invalidated} - */ - public final boolean invalidated() { - return this.invalidated; - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code realm} - */ - public final String realm() { - return this.realm; - } - - /** - * Required - API name: {@code username} - */ - public final String username() { - return this.username; - } - - /** - * API name: {@code metadata} - */ - public final Map metadata() { - return this.metadata; - } - - /** - * 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("creation"); - generator.write(this.creation); - - if (this.expiration != null) { - generator.writeKey("expiration"); - generator.write(this.expiration); - - } - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("invalidated"); - generator.write(this.invalidated); - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("realm"); - generator.write(this.realm); - - generator.writeKey("username"); - generator.write(this.username); - - if (ApiTypeHelper.isDefined(this.metadata)) { - generator.writeKey("metadata"); - generator.writeStartObject(); - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ApiKey}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long creation; - - @Nullable - private Long expiration; - - private String id; - - private Boolean invalidated; - - private String name; - - private String realm; - - private String username; - - @Nullable - private Map metadata; - - /** - * Required - API name: {@code creation} - */ - public final Builder creation(long value) { - this.creation = value; - return this; - } - - /** - * API name: {@code expiration} - */ - public final Builder expiration(@Nullable Long value) { - this.expiration = value; - return this; - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code invalidated} - */ - public final Builder invalidated(boolean value) { - this.invalidated = value; - return this; - } - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code realm} - */ - public final Builder realm(String value) { - this.realm = value; - return this; - } - - /** - * Required - API name: {@code username} - */ - public final Builder username(String value) { - this.username = value; - return this; - } - - /** - * API name: {@code metadata} - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * API name: {@code metadata} - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - /** - * Builds a {@link ApiKey}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ApiKey build() { - _checkSingleUse(); - - return new ApiKey(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ApiKey} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ApiKey::setupApiKeyDeserializer); - - protected static void setupApiKeyDeserializer(ObjectDeserializer op) { - - op.add(Builder::creation, JsonpDeserializer.longDeserializer(), "creation"); - op.add(Builder::expiration, JsonpDeserializer.longDeserializer(), "expiration"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::invalidated, JsonpDeserializer.booleanDeserializer(), "invalidated"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); - op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); - op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/grant_api_key/ApiKey.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/grant_api_key/ApiKey.java deleted file mode 100644 index b85ef6d2b..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/grant_api_key/ApiKey.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.security.grant_api_key; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: security.grant_api_key.ApiKey - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ApiKey implements JsonpSerializable { - private final String name; - - @Nullable - private final Time expiration; - - private final List> roleDescriptors; - - // --------------------------------------------------------------------------------------------- - - private ApiKey(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.expiration = builder.expiration; - this.roleDescriptors = ApiTypeHelper.unmodifiable(builder.roleDescriptors); - - } - - public static ApiKey of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code expiration} - */ - @Nullable - public final Time expiration() { - return this.expiration; - } - - /** - * API name: {@code role_descriptors} - */ - public final List> roleDescriptors() { - return this.roleDescriptors; - } - - /** - * 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 (this.expiration != null) { - generator.writeKey("expiration"); - this.expiration.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.roleDescriptors)) { - generator.writeKey("role_descriptors"); - generator.writeStartArray(); - for (Map item0 : this.roleDescriptors) { - generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ApiKey}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - @Nullable - private Time expiration; - - @Nullable - private List> roleDescriptors; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * API name: {@code expiration} - */ - public final Builder expiration(@Nullable Time value) { - this.expiration = value; - return this; - } - - /** - * API name: {@code expiration} - */ - public final Builder expiration(Function> fn) { - return this.expiration(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code role_descriptors} - *

- * Adds all elements of list to roleDescriptors. - */ - public final Builder roleDescriptors(List> list) { - this.roleDescriptors = _listAddAll(this.roleDescriptors, list); - return this; - } - - /** - * API name: {@code role_descriptors} - *

- * Adds one or more values to roleDescriptors. - */ - public final Builder roleDescriptors(Map value, Map... values) { - this.roleDescriptors = _listAdd(this.roleDescriptors, value, values); - return this; - } - - /** - * Builds a {@link ApiKey}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ApiKey build() { - _checkSingleUse(); - - return new ApiKey(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ApiKey} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ApiKey::setupApiKeyDeserializer); - - protected static void setupApiKeyDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::expiration, Time._DESERIALIZER, "expiration"); - op.add(Builder::roleDescriptors, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER)), - "role_descriptors"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/Column.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/Column.java similarity index 95% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/Column.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/sql/Column.java index 51b5e8518..8beb0c83c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/Column.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/Column.java @@ -21,7 +21,7 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.sql.query; +package co.elastic.clients.elasticsearch.sql; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -38,12 +38,11 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: sql.query.Column +// typedef: sql.Column /** * - * @see API - * specification + * @see API specification */ @JsonpDeserializable public class Column implements JsonpSerializable { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java new file mode 100644 index 000000000..b9a4fff71 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java @@ -0,0 +1,150 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.sql; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: sql.delete_async.Request + +/** + * Deletes an async SQL search or a stored synchronous SQL search. If the search + * is still running, the API cancels it. + * + * @see API + * specification + */ + +public class DeleteAsyncRequest extends RequestBase { + private final String id; + + // --------------------------------------------------------------------------------------------- + + private DeleteAsyncRequest(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + + } + + public static DeleteAsyncRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteAsyncRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String id; + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Builds a {@link DeleteAsyncRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteAsyncRequest build() { + _checkSingleUse(); + + return new DeleteAsyncRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code sql.delete_async}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/sql.delete_async", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + final int _id = 1 << 0; + + int propsSet = 0; + + propsSet |= _id; + + if (propsSet == (_id)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_sql"); + buf.append("/async"); + buf.append("/delete"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, DeleteAsyncResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregateBucket.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncResponse.java similarity index 62% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregateBucket.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncResponse.java index 6d997fcd6..d706b3820 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregateBucket.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncResponse.java @@ -21,8 +21,9 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch._types.aggregations; +package co.elastic.clients.elasticsearch.sql; +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -32,65 +33,63 @@ import java.util.Objects; import java.util.function.Function; -// typedef: _types.aggregations.ChildrenAggregateBucket +// typedef: sql.delete_async.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ChildrenAggregateBucket extends MultiBucketBase { +public class DeleteAsyncResponse extends AcknowledgedResponseBase { // --------------------------------------------------------------------------------------------- - private ChildrenAggregateBucket(Builder builder) { + private DeleteAsyncResponse(Builder builder) { super(builder); } - public static ChildrenAggregateBucket of(Function> fn) { + public static DeleteAsyncResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ChildrenAggregateBucket}. + * Builder for {@link DeleteAsyncResponse}. */ - public static class Builder extends MultiBucketBase.AbstractBuilder + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + ObjectBuilder { @Override protected Builder self() { return this; } /** - * Builds a {@link ChildrenAggregateBucket}. + * Builds a {@link DeleteAsyncResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public ChildrenAggregateBucket build() { + public DeleteAsyncResponse build() { _checkSingleUse(); - return new ChildrenAggregateBucket(this); + return new DeleteAsyncResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ChildrenAggregateBucket} + * Json deserializer for {@link DeleteAsyncResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ChildrenAggregateBucket::setupChildrenAggregateBucketDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteAsyncResponse::setupDeleteAsyncResponseDeserializer); - protected static void setupChildrenAggregateBucketDeserializer( - ObjectDeserializer op) { - MultiBucketBase.setupMultiBucketBaseDeserializer(op); + protected static void setupDeleteAsyncResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlAsyncClient.java index 2b2c6d783..38fdfb9d1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlAsyncClient.java @@ -86,6 +86,111 @@ public final CompletableFuture clearCursor( return clearCursor(fn.apply(new ClearCursorRequest.Builder()).build()); } + // ----- Endpoint: sql.delete_async + + /** + * Deletes an async SQL search or a stored synchronous SQL search. If the search + * is still running, the API cancels it. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteAsync(DeleteAsyncRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteAsyncRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes an async SQL search or a stored synchronous SQL search. If the search + * is still running, the API cancels it. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteAsyncRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteAsync( + Function> fn) { + return deleteAsync(fn.apply(new DeleteAsyncRequest.Builder()).build()); + } + + // ----- Endpoint: sql.get_async + + /** + * Returns the current status and available results for an async SQL search or + * stored synchronous SQL search + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getAsync(GetAsyncRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAsyncRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the current status and available results for an async SQL search or + * stored synchronous SQL search + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAsyncRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getAsync( + Function> fn) { + return getAsync(fn.apply(new GetAsyncRequest.Builder()).build()); + } + + // ----- Endpoint: sql.get_async_status + + /** + * Returns the current status of an async SQL search or a stored synchronous SQL + * search + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getAsyncStatus(GetAsyncStatusRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAsyncStatusRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the current status of an async SQL search or a stored synchronous SQL + * search + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAsyncStatusRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getAsyncStatus( + Function> fn) { + return getAsyncStatus(fn.apply(new GetAsyncStatusRequest.Builder()).build()); + } + // ----- Endpoint: sql.query /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlClient.java index 6ef03ca35..07ca181bc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ElasticsearchSqlClient.java @@ -88,6 +88,114 @@ public final ClearCursorResponse clearCursor( return clearCursor(fn.apply(new ClearCursorRequest.Builder()).build()); } + // ----- Endpoint: sql.delete_async + + /** + * Deletes an async SQL search or a stored synchronous SQL search. If the search + * is still running, the API cancels it. + * + * @see Documentation + * on elastic.co + */ + + public DeleteAsyncResponse deleteAsync(DeleteAsyncRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteAsyncRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes an async SQL search or a stored synchronous SQL search. If the search + * is still running, the API cancels it. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteAsyncRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteAsyncResponse deleteAsync( + Function> fn) + throws IOException, ElasticsearchException { + return deleteAsync(fn.apply(new DeleteAsyncRequest.Builder()).build()); + } + + // ----- Endpoint: sql.get_async + + /** + * Returns the current status and available results for an async SQL search or + * stored synchronous SQL search + * + * @see Documentation + * on elastic.co + */ + + public GetAsyncResponse getAsync(GetAsyncRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAsyncRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the current status and available results for an async SQL search or + * stored synchronous SQL search + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAsyncRequest} + * @see Documentation + * on elastic.co + */ + + public final GetAsyncResponse getAsync(Function> fn) + throws IOException, ElasticsearchException { + return getAsync(fn.apply(new GetAsyncRequest.Builder()).build()); + } + + // ----- Endpoint: sql.get_async_status + + /** + * Returns the current status of an async SQL search or a stored synchronous SQL + * search + * + * @see Documentation + * on elastic.co + */ + + public GetAsyncStatusResponse getAsyncStatus(GetAsyncStatusRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAsyncStatusRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the current status of an async SQL search or a stored synchronous SQL + * search + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAsyncStatusRequest} + * @see Documentation + * on elastic.co + */ + + public final GetAsyncStatusResponse getAsyncStatus( + Function> fn) + throws IOException, ElasticsearchException { + return getAsyncStatus(fn.apply(new GetAsyncStatusRequest.Builder()).build()); + } + // ----- Endpoint: sql.query /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java new file mode 100644 index 000000000..fbe4447a9 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java @@ -0,0 +1,300 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.sql; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: sql.get_async.Request + +/** + * Returns the current status and available results for an async SQL search or + * stored synchronous SQL search + * + * @see API + * specification + */ + +public class GetAsyncRequest extends RequestBase { + @Nullable + private final String delimiter; + + @Nullable + private final String format; + + private final String id; + + @Nullable + private final Time keepAlive; + + @Nullable + private final Time waitForCompletionTimeout; + + // --------------------------------------------------------------------------------------------- + + private GetAsyncRequest(Builder builder) { + + this.delimiter = builder.delimiter; + this.format = builder.format; + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.keepAlive = builder.keepAlive; + this.waitForCompletionTimeout = builder.waitForCompletionTimeout; + + } + + public static GetAsyncRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Separator for CSV results. The API only supports this parameter for CSV + * responses. + *

+ * API name: {@code delimiter} + */ + @Nullable + public final String delimiter() { + return this.delimiter; + } + + /** + * Format for the response. You must specify a format using this parameter or + * the Accept HTTP header. If you specify both, the API uses this parameter. + *

+ * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Retention period for the search and its results. Defaults to the + * keep_alive period for the original SQL search. + *

+ * API name: {@code keep_alive} + */ + @Nullable + public final Time keepAlive() { + return this.keepAlive; + } + + /** + * Period to wait for complete results. Defaults to no timeout, meaning the + * request waits for complete search results. + *

+ * API name: {@code wait_for_completion_timeout} + */ + @Nullable + public final Time waitForCompletionTimeout() { + return this.waitForCompletionTimeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetAsyncRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String delimiter; + + @Nullable + private String format; + + private String id; + + @Nullable + private Time keepAlive; + + @Nullable + private Time waitForCompletionTimeout; + + /** + * Separator for CSV results. The API only supports this parameter for CSV + * responses. + *

+ * API name: {@code delimiter} + */ + public final Builder delimiter(@Nullable String value) { + this.delimiter = value; + return this; + } + + /** + * Format for the response. You must specify a format using this parameter or + * the Accept HTTP header. If you specify both, the API uses this parameter. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Retention period for the search and its results. Defaults to the + * keep_alive period for the original SQL search. + *

+ * API name: {@code keep_alive} + */ + public final Builder keepAlive(@Nullable Time value) { + this.keepAlive = value; + return this; + } + + /** + * Retention period for the search and its results. Defaults to the + * keep_alive period for the original SQL search. + *

+ * API name: {@code keep_alive} + */ + public final Builder keepAlive(Function> fn) { + return this.keepAlive(fn.apply(new Time.Builder()).build()); + } + + /** + * Period to wait for complete results. Defaults to no timeout, meaning the + * request waits for complete search results. + *

+ * API name: {@code wait_for_completion_timeout} + */ + public final Builder waitForCompletionTimeout(@Nullable Time value) { + this.waitForCompletionTimeout = value; + return this; + } + + /** + * Period to wait for complete results. Defaults to no timeout, meaning the + * request waits for complete search results. + *

+ * API name: {@code wait_for_completion_timeout} + */ + public final Builder waitForCompletionTimeout(Function> fn) { + return this.waitForCompletionTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Builds a {@link GetAsyncRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetAsyncRequest build() { + _checkSingleUse(); + + return new GetAsyncRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code sql.get_async}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/sql.get_async", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _id = 1 << 0; + + int propsSet = 0; + + propsSet |= _id; + + if (propsSet == (_id)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_sql"); + buf.append("/async"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.delimiter != null) { + params.put("delimiter", request.delimiter); + } + if (request.format != null) { + params.put("format", request.format); + } + if (request.keepAlive != null) { + params.put("keep_alive", request.keepAlive._toJsonString()); + } + if (request.waitForCompletionTimeout != null) { + params.put("wait_for_completion_timeout", request.waitForCompletionTimeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetAsyncResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncResponse.java new file mode 100644 index 000000000..24bb6f259 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncResponse.java @@ -0,0 +1,373 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.sql; + +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: sql.get_async.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetAsyncResponse implements JsonpSerializable { + private final String id; + + private final boolean isRunning; + + private final boolean isPartial; + + private final List columns; + + @Nullable + private final String cursor; + + private final List> rows; + + // --------------------------------------------------------------------------------------------- + + private GetAsyncResponse(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.isRunning = ApiTypeHelper.requireNonNull(builder.isRunning, this, "isRunning"); + this.isPartial = ApiTypeHelper.requireNonNull(builder.isPartial, this, "isPartial"); + this.columns = ApiTypeHelper.unmodifiable(builder.columns); + this.cursor = builder.cursor; + this.rows = ApiTypeHelper.unmodifiableRequired(builder.rows, this, "rows"); + + } + + public static GetAsyncResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Identifier for the search. This value is only returned for async + * and saved synchronous searches. For CSV, TSV, and TXT responses, this value + * is returned in the Async-ID HTTP header. + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - If true, the search is still running. If false, the + * search has finished. This value is only returned for async and saved + * synchronous searches. For CSV, TSV, and TXT responses, this value is returned + * in the Async-partial HTTP header. + *

+ * API name: {@code is_running} + */ + public final boolean isRunning() { + return this.isRunning; + } + + /** + * Required - If true, the response does not contain complete + * search results. If is_partial is true and + * is_running is true, the search is still running. If + * is_partial is true but is_running is + * false, the results are partial due to a failure or timeout. This + * value is only returned for async and saved synchronous searches. For CSV, + * TSV, and TXT responses, this value is returned in the + * Async-partial HTTP header. + *

+ * API name: {@code is_partial} + */ + public final boolean isPartial() { + return this.isPartial; + } + + /** + * Column headings for the search results. Each object is a column. + *

+ * API name: {@code columns} + */ + public final List columns() { + return this.columns; + } + + /** + * Cursor for the next set of paginated results. For CSV, TSV, and TXT + * responses, this value is returned in the Cursor HTTP header. + *

+ * API name: {@code cursor} + */ + @Nullable + public final String cursor() { + return this.cursor; + } + + /** + * Required - Values for the search results. + *

+ * API name: {@code rows} + */ + public final List> rows() { + return this.rows; + } + + /** + * 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("id"); + generator.write(this.id); + + generator.writeKey("is_running"); + generator.write(this.isRunning); + + generator.writeKey("is_partial"); + generator.write(this.isPartial); + + if (ApiTypeHelper.isDefined(this.columns)) { + generator.writeKey("columns"); + generator.writeStartArray(); + for (Column item0 : this.columns) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.cursor != null) { + generator.writeKey("cursor"); + generator.write(this.cursor); + + } + if (ApiTypeHelper.isDefined(this.rows)) { + generator.writeKey("rows"); + generator.writeStartArray(); + for (List item0 : this.rows) { + generator.writeStartArray(); + if (item0 != null) { + for (JsonData item1 : item0) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetAsyncResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String id; + + private Boolean isRunning; + + private Boolean isPartial; + + @Nullable + private List columns; + + @Nullable + private String cursor; + + private List> rows; + + /** + * Required - Identifier for the search. This value is only returned for async + * and saved synchronous searches. For CSV, TSV, and TXT responses, this value + * is returned in the Async-ID HTTP header. + *

+ * API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - If true, the search is still running. If false, the + * search has finished. This value is only returned for async and saved + * synchronous searches. For CSV, TSV, and TXT responses, this value is returned + * in the Async-partial HTTP header. + *

+ * API name: {@code is_running} + */ + public final Builder isRunning(boolean value) { + this.isRunning = value; + return this; + } + + /** + * Required - If true, the response does not contain complete + * search results. If is_partial is true and + * is_running is true, the search is still running. If + * is_partial is true but is_running is + * false, the results are partial due to a failure or timeout. This + * value is only returned for async and saved synchronous searches. For CSV, + * TSV, and TXT responses, this value is returned in the + * Async-partial HTTP header. + *

+ * API name: {@code is_partial} + */ + public final Builder isPartial(boolean value) { + this.isPartial = value; + return this; + } + + /** + * Column headings for the search results. Each object is a column. + *

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

+ * Adds all elements of list to columns. + */ + public final Builder columns(List list) { + this.columns = _listAddAll(this.columns, list); + return this; + } + + /** + * Column headings for the search results. Each object is a column. + *

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

+ * Adds one or more values to columns. + */ + public final Builder columns(Column value, Column... values) { + this.columns = _listAdd(this.columns, value, values); + return this; + } + + /** + * Column headings for the search results. Each object is a column. + *

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

+ * Adds a value to columns using a builder lambda. + */ + public final Builder columns(Function> fn) { + return columns(fn.apply(new Column.Builder()).build()); + } + + /** + * Cursor for the next set of paginated results. For CSV, TSV, and TXT + * responses, this value is returned in the Cursor HTTP header. + *

+ * API name: {@code cursor} + */ + public final Builder cursor(@Nullable String value) { + this.cursor = value; + return this; + } + + /** + * Required - Values for the search results. + *

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

+ * Adds all elements of list to rows. + */ + public final Builder rows(List> list) { + this.rows = _listAddAll(this.rows, list); + return this; + } + + /** + * Required - Values for the search results. + *

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

+ * Adds one or more values to rows. + */ + public final Builder rows(List value, List... values) { + this.rows = _listAdd(this.rows, value, values); + return this; + } + + /** + * Builds a {@link GetAsyncResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetAsyncResponse build() { + _checkSingleUse(); + + return new GetAsyncResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetAsyncResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GetAsyncResponse::setupGetAsyncResponseDeserializer); + + protected static void setupGetAsyncResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); + op.add(Builder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); + op.add(Builder::columns, JsonpDeserializer.arrayDeserializer(Column._DESERIALIZER), "columns"); + op.add(Builder::cursor, JsonpDeserializer.stringDeserializer(), "cursor"); + op.add(Builder::rows, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER)), + "rows"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java new file mode 100644 index 000000000..1c0542989 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java @@ -0,0 +1,150 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.sql; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: sql.get_async_status.Request + +/** + * Returns the current status of an async SQL search or a stored synchronous SQL + * search + * + * @see API + * specification + */ + +public class GetAsyncStatusRequest extends RequestBase { + private final String id; + + // --------------------------------------------------------------------------------------------- + + private GetAsyncStatusRequest(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + + } + + public static GetAsyncStatusRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetAsyncStatusRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String id; + + /** + * Required - The async search ID + *

+ * API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Builds a {@link GetAsyncStatusRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetAsyncStatusRequest build() { + _checkSingleUse(); + + return new GetAsyncStatusRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code sql.get_async_status}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/sql.get_async_status", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _id = 1 << 0; + + int propsSet = 0; + + propsSet |= _id; + + if (propsSet == (_id)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_sql"); + buf.append("/async"); + buf.append("/status"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, GetAsyncStatusResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusResponse.java new file mode 100644 index 000000000..0af13b978 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusResponse.java @@ -0,0 +1,303 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.sql; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Number; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: sql.get_async_status.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetAsyncStatusResponse implements JsonpSerializable { + private final String id; + + private final boolean isRunning; + + private final boolean isPartial; + + private final Number startTimeInMillis; + + private final Number expirationTimeInMillis; + + @Nullable + private final Number completionStatus; + + // --------------------------------------------------------------------------------------------- + + private GetAsyncStatusResponse(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.isRunning = ApiTypeHelper.requireNonNull(builder.isRunning, this, "isRunning"); + this.isPartial = ApiTypeHelper.requireNonNull(builder.isPartial, this, "isPartial"); + this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); + this.expirationTimeInMillis = ApiTypeHelper.requireNonNull(builder.expirationTimeInMillis, this, + "expirationTimeInMillis"); + this.completionStatus = builder.completionStatus; + + } + + public static GetAsyncStatusResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Identifier for the search. + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - If true, the search is still running. If + * false, the search has finished. + *

+ * API name: {@code is_running} + */ + public final boolean isRunning() { + return this.isRunning; + } + + /** + * Required - If true, the response does not contain complete + * search results. If is_partial is true and + * is_running is true, the search is still running. If + * is_partial is true but is_running is + * false, the results are partial due to a failure or timeout. + *

+ * API name: {@code is_partial} + */ + public final boolean isPartial() { + return this.isPartial; + } + + /** + * Required - Timestamp, in milliseconds since the Unix epoch, when the search + * started. The API only returns this property for running searches. + *

+ * API name: {@code start_time_in_millis} + */ + public final Number startTimeInMillis() { + return this.startTimeInMillis; + } + + /** + * Required - Timestamp, in milliseconds since the Unix epoch, when + * Elasticsearch will delete the search and its results, even if the search is + * still running. + *

+ * API name: {@code expiration_time_in_millis} + */ + public final Number expirationTimeInMillis() { + return this.expirationTimeInMillis; + } + + /** + * HTTP status code for the search. The API only returns this property for + * completed searches. + *

+ * API name: {@code completion_status} + */ + @Nullable + public final Number completionStatus() { + return this.completionStatus; + } + + /** + * 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("id"); + generator.write(this.id); + + generator.writeKey("is_running"); + generator.write(this.isRunning); + + generator.writeKey("is_partial"); + generator.write(this.isPartial); + + generator.writeKey("start_time_in_millis"); + generator.write(this.startTimeInMillis.doubleValue()); + + generator.writeKey("expiration_time_in_millis"); + generator.write(this.expirationTimeInMillis.doubleValue()); + + if (this.completionStatus != null) { + generator.writeKey("completion_status"); + generator.write(this.completionStatus.doubleValue()); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetAsyncStatusResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String id; + + private Boolean isRunning; + + private Boolean isPartial; + + private Number startTimeInMillis; + + private Number expirationTimeInMillis; + + @Nullable + private Number completionStatus; + + /** + * Required - Identifier for the search. + *

+ * API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - If true, the search is still running. If + * false, the search has finished. + *

+ * API name: {@code is_running} + */ + public final Builder isRunning(boolean value) { + this.isRunning = value; + return this; + } + + /** + * Required - If true, the response does not contain complete + * search results. If is_partial is true and + * is_running is true, the search is still running. If + * is_partial is true but is_running is + * false, the results are partial due to a failure or timeout. + *

+ * API name: {@code is_partial} + */ + public final Builder isPartial(boolean value) { + this.isPartial = value; + return this; + } + + /** + * Required - Timestamp, in milliseconds since the Unix epoch, when the search + * started. The API only returns this property for running searches. + *

+ * API name: {@code start_time_in_millis} + */ + public final Builder startTimeInMillis(Number value) { + this.startTimeInMillis = value; + return this; + } + + /** + * Required - Timestamp, in milliseconds since the Unix epoch, when + * Elasticsearch will delete the search and its results, even if the search is + * still running. + *

+ * API name: {@code expiration_time_in_millis} + */ + public final Builder expirationTimeInMillis(Number value) { + this.expirationTimeInMillis = value; + return this; + } + + /** + * HTTP status code for the search. The API only returns this property for + * completed searches. + *

+ * API name: {@code completion_status} + */ + public final Builder completionStatus(@Nullable Number value) { + this.completionStatus = value; + return this; + } + + /** + * Builds a {@link GetAsyncStatusResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetAsyncStatusResponse build() { + _checkSingleUse(); + + return new GetAsyncStatusResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetAsyncStatusResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetAsyncStatusResponse::setupGetAsyncStatusResponseDeserializer); + + protected static void setupGetAsyncStatusResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); + op.add(Builder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); + op.add(Builder::startTimeInMillis, JsonpDeserializer.numberDeserializer(), "start_time_in_millis"); + op.add(Builder::expirationTimeInMillis, JsonpDeserializer.numberDeserializer(), "expiration_time_in_millis"); + op.add(Builder::completionStatus, JsonpDeserializer.numberDeserializer(), "completion_status"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryResponse.java index 19cc86537..cec019da4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryResponse.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.sql; -import co.elastic.clients.elasticsearch.sql.query.Column; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -35,6 +34,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.List; import java.util.Objects; @@ -50,6 +50,15 @@ */ @JsonpDeserializable public class QueryResponse implements JsonpSerializable { + @Nullable + private final String id; + + @Nullable + private final Boolean isRunning; + + @Nullable + private final Boolean isPartial; + private final List columns; @Nullable @@ -61,6 +70,9 @@ public class QueryResponse implements JsonpSerializable { private QueryResponse(Builder builder) { + this.id = builder.id; + this.isRunning = builder.isRunning; + this.isPartial = builder.isPartial; this.columns = ApiTypeHelper.unmodifiable(builder.columns); this.cursor = builder.cursor; this.rows = ApiTypeHelper.unmodifiableRequired(builder.rows, this, "rows"); @@ -72,6 +84,49 @@ public static QueryResponse of(Function> f } /** + * Identifier for the search. This value is only returned for async and saved + * synchronous searches. For CSV, TSV, and TXT responses, this value is returned + * in the Async-ID HTTP header. + *

+ * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + + /** + * If true, the search is still running. If false, the search has + * finished. This value is only returned for async and saved synchronous + * searches. For CSV, TSV, and TXT responses, this value is returned in the + * Async-partial HTTP header. + *

+ * API name: {@code is_running} + */ + @Nullable + public final Boolean isRunning() { + return this.isRunning; + } + + /** + * If true, the response does not contain complete search results. + * If is_partial is true and is_running + * is true, the search is still running. If is_partial + * is true but is_running is false, the + * results are partial due to a failure or timeout. This value is only returned + * for async and saved synchronous searches. For CSV, TSV, and TXT responses, + * this value is returned in the Async-partial HTTP header. + *

+ * API name: {@code is_partial} + */ + @Nullable + public final Boolean isPartial() { + return this.isPartial; + } + + /** + * Column headings for the search results. Each object is a column. + *

* API name: {@code columns} */ public final List columns() { @@ -79,6 +134,9 @@ public final List columns() { } /** + * Cursor for the next set of paginated results. For CSV, TSV, and TXT + * responses, this value is returned in the Cursor HTTP header. + *

* API name: {@code cursor} */ @Nullable @@ -87,7 +145,9 @@ public final String cursor() { } /** - * Required - API name: {@code rows} + * Required - Values for the search results. + *

+ * API name: {@code rows} */ public final List> rows() { return this.rows; @@ -104,6 +164,21 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } + if (this.isRunning != null) { + generator.writeKey("is_running"); + generator.write(this.isRunning); + + } + if (this.isPartial != null) { + generator.writeKey("is_partial"); + generator.write(this.isPartial); + + } if (ApiTypeHelper.isDefined(this.columns)) { generator.writeKey("columns"); generator.writeStartArray(); @@ -146,6 +221,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String id; + + @Nullable + private Boolean isRunning; + + @Nullable + private Boolean isPartial; + @Nullable private List columns; @@ -155,6 +239,49 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder> rows; /** + * Identifier for the search. This value is only returned for async and saved + * synchronous searches. For CSV, TSV, and TXT responses, this value is returned + * in the Async-ID HTTP header. + *

+ * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * If true, the search is still running. If false, the search has + * finished. This value is only returned for async and saved synchronous + * searches. For CSV, TSV, and TXT responses, this value is returned in the + * Async-partial HTTP header. + *

+ * API name: {@code is_running} + */ + public final Builder isRunning(@Nullable Boolean value) { + this.isRunning = value; + return this; + } + + /** + * If true, the response does not contain complete search results. + * If is_partial is true and is_running + * is true, the search is still running. If is_partial + * is true but is_running is false, the + * results are partial due to a failure or timeout. This value is only returned + * for async and saved synchronous searches. For CSV, TSV, and TXT responses, + * this value is returned in the Async-partial HTTP header. + *

+ * API name: {@code is_partial} + */ + public final Builder isPartial(@Nullable Boolean value) { + this.isPartial = value; + return this; + } + + /** + * Column headings for the search results. Each object is a column. + *

* API name: {@code columns} *

* Adds all elements of list to columns. @@ -165,6 +292,8 @@ public final Builder columns(List list) { } /** + * Column headings for the search results. Each object is a column. + *

* API name: {@code columns} *

* Adds one or more values to columns. @@ -175,6 +304,8 @@ public final Builder columns(Column value, Column... values) { } /** + * Column headings for the search results. Each object is a column. + *

* API name: {@code columns} *

* Adds a value to columns using a builder lambda. @@ -184,6 +315,9 @@ public final Builder columns(Function> fn) } /** + * Cursor for the next set of paginated results. For CSV, TSV, and TXT + * responses, this value is returned in the Cursor HTTP header. + *

* API name: {@code cursor} */ public final Builder cursor(@Nullable String value) { @@ -192,7 +326,9 @@ public final Builder cursor(@Nullable String value) { } /** - * Required - API name: {@code rows} + * Required - Values for the search results. + *

+ * API name: {@code rows} *

* Adds all elements of list to rows. */ @@ -202,7 +338,9 @@ public final Builder rows(List> list) { } /** - * Required - API name: {@code rows} + * Required - Values for the search results. + *

+ * API name: {@code rows} *

* Adds one or more values to rows. */ @@ -234,6 +372,9 @@ public QueryResponse build() { protected static void setupQueryResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); + op.add(Builder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); op.add(Builder::columns, JsonpDeserializer.arrayDeserializer(Column._DESERIALIZER), "columns"); op.add(Builder::cursor, JsonpDeserializer.stringDeserializer(), "cursor"); op.add(Builder::rows, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Info.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Info.java deleted file mode 100644 index 21f953419..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Info.java +++ /dev/null @@ -1,479 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.tasks; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: tasks._types.Info - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Info implements JsonpSerializable { - private final String action; - - private final boolean cancellable; - - private final List children; - - @Nullable - private final String description; - - private final Map> headers; - - private final long id; - - private final String node; - - private final long runningTimeInNanos; - - private final long startTimeInMillis; - - @Nullable - private final Status status; - - private final String type; - - @Nullable - private final String parentTaskId; - - // --------------------------------------------------------------------------------------------- - - private Info(Builder builder) { - - this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); - this.cancellable = ApiTypeHelper.requireNonNull(builder.cancellable, this, "cancellable"); - this.children = ApiTypeHelper.unmodifiable(builder.children); - this.description = builder.description; - this.headers = ApiTypeHelper.unmodifiableRequired(builder.headers, this, "headers"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.runningTimeInNanos = ApiTypeHelper.requireNonNull(builder.runningTimeInNanos, this, "runningTimeInNanos"); - this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); - this.status = builder.status; - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.parentTaskId = builder.parentTaskId; - - } - - public static Info of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code action} - */ - public final String action() { - return this.action; - } - - /** - * Required - API name: {@code cancellable} - */ - public final boolean cancellable() { - return this.cancellable; - } - - /** - * API name: {@code children} - */ - public final List children() { - return this.children; - } - - /** - * API name: {@code description} - */ - @Nullable - public final String description() { - return this.description; - } - - /** - * Required - API name: {@code headers} - */ - public final Map> headers() { - return this.headers; - } - - /** - * Required - API name: {@code id} - */ - public final long id() { - return this.id; - } - - /** - * Required - API name: {@code node} - */ - public final String node() { - return this.node; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final long runningTimeInNanos() { - return this.runningTimeInNanos; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final long startTimeInMillis() { - return this.startTimeInMillis; - } - - /** - * API name: {@code status} - */ - @Nullable - public final Status status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * API name: {@code parent_task_id} - */ - @Nullable - public final String parentTaskId() { - return this.parentTaskId; - } - - /** - * 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("action"); - generator.write(this.action); - - generator.writeKey("cancellable"); - generator.write(this.cancellable); - - if (ApiTypeHelper.isDefined(this.children)) { - generator.writeKey("children"); - generator.writeStartArray(); - for (Info item0 : this.children) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - - } - if (ApiTypeHelper.isDefined(this.headers)) { - generator.writeKey("headers"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.headers.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (String item1 : item0.getValue()) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("node"); - generator.write(this.node); - - generator.writeKey("running_time_in_nanos"); - generator.write(this.runningTimeInNanos); - - generator.writeKey("start_time_in_millis"); - generator.write(this.startTimeInMillis); - - if (this.status != null) { - generator.writeKey("status"); - this.status.serialize(generator, mapper); - - } - generator.writeKey("type"); - generator.write(this.type); - - if (this.parentTaskId != null) { - generator.writeKey("parent_task_id"); - generator.write(this.parentTaskId); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Info}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String action; - - private Boolean cancellable; - - @Nullable - private List children; - - @Nullable - private String description; - - private Map> headers; - - private Long id; - - private String node; - - private Long runningTimeInNanos; - - private Long startTimeInMillis; - - @Nullable - private Status status; - - private String type; - - @Nullable - private String parentTaskId; - - /** - * Required - API name: {@code action} - */ - public final Builder action(String value) { - this.action = value; - return this; - } - - /** - * Required - API name: {@code cancellable} - */ - public final Builder cancellable(boolean value) { - this.cancellable = value; - return this; - } - - /** - * API name: {@code children} - *

- * Adds all elements of list to children. - */ - public final Builder children(List list) { - this.children = _listAddAll(this.children, list); - return this; - } - - /** - * API name: {@code children} - *

- * Adds one or more values to children. - */ - public final Builder children(Info value, Info... values) { - this.children = _listAdd(this.children, value, values); - return this; - } - - /** - * API name: {@code children} - *

- * Adds a value to children using a builder lambda. - */ - public final Builder children(Function> fn) { - return children(fn.apply(new Info.Builder()).build()); - } - - /** - * API name: {@code description} - */ - public final Builder description(@Nullable String value) { - this.description = value; - return this; - } - - /** - * Required - API name: {@code headers} - *

- * Adds all entries of map to headers. - */ - public final Builder headers(Map> map) { - this.headers = _mapPutAll(this.headers, map); - return this; - } - - /** - * Required - API name: {@code headers} - *

- * Adds an entry to headers. - */ - public final Builder headers(String key, List value) { - this.headers = _mapPut(this.headers, key, value); - return this; - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(long value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code node} - */ - public final Builder node(String value) { - this.node = value; - return this; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final Builder runningTimeInNanos(long value) { - this.runningTimeInNanos = value; - return this; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final Builder startTimeInMillis(long value) { - this.startTimeInMillis = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(@Nullable Status value) { - this.status = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(Function> fn) { - return this.status(fn.apply(new Status.Builder()).build()); - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * API name: {@code parent_task_id} - */ - public final Builder parentTaskId(@Nullable String value) { - this.parentTaskId = value; - return this; - } - - /** - * Builds a {@link Info}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Info build() { - _checkSingleUse(); - - return new Info(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Info} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Info::setupInfoDeserializer); - - protected static void setupInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::action, JsonpDeserializer.stringDeserializer(), "action"); - op.add(Builder::cancellable, JsonpDeserializer.booleanDeserializer(), "cancellable"); - op.add(Builder::children, JsonpDeserializer.arrayDeserializer(Info._DESERIALIZER), "children"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::headers, JsonpDeserializer.stringMapDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "headers"); - op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(Builder::status, Status._DESERIALIZER, "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::parentTaskId, JsonpDeserializer.stringDeserializer(), "parent_task_id"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/State.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/State.java deleted file mode 100644 index fadbfed2e..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/State.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.tasks; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: tasks._types.State - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class State implements JsonpSerializable { - private final String action; - - private final boolean cancellable; - - @Nullable - private final String description; - - private final Map> headers; - - private final long id; - - private final String node; - - @Nullable - private final String parentTaskId; - - private final long runningTimeInNanos; - - private final long startTimeInMillis; - - @Nullable - private final Status status; - - private final String type; - - // --------------------------------------------------------------------------------------------- - - private State(Builder builder) { - - this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); - this.cancellable = ApiTypeHelper.requireNonNull(builder.cancellable, this, "cancellable"); - this.description = builder.description; - this.headers = ApiTypeHelper.unmodifiableRequired(builder.headers, this, "headers"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.parentTaskId = builder.parentTaskId; - this.runningTimeInNanos = ApiTypeHelper.requireNonNull(builder.runningTimeInNanos, this, "runningTimeInNanos"); - this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); - this.status = builder.status; - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - - } - - public static State of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code action} - */ - public final String action() { - return this.action; - } - - /** - * Required - API name: {@code cancellable} - */ - public final boolean cancellable() { - return this.cancellable; - } - - /** - * API name: {@code description} - */ - @Nullable - public final String description() { - return this.description; - } - - /** - * Required - API name: {@code headers} - */ - public final Map> headers() { - return this.headers; - } - - /** - * Required - API name: {@code id} - */ - public final long id() { - return this.id; - } - - /** - * Required - API name: {@code node} - */ - public final String node() { - return this.node; - } - - /** - * API name: {@code parent_task_id} - */ - @Nullable - public final String parentTaskId() { - return this.parentTaskId; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final long runningTimeInNanos() { - return this.runningTimeInNanos; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final long startTimeInMillis() { - return this.startTimeInMillis; - } - - /** - * API name: {@code status} - */ - @Nullable - public final Status status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * 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("action"); - generator.write(this.action); - - generator.writeKey("cancellable"); - generator.write(this.cancellable); - - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - - } - if (ApiTypeHelper.isDefined(this.headers)) { - generator.writeKey("headers"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.headers.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (String item1 : item0.getValue()) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("node"); - generator.write(this.node); - - if (this.parentTaskId != null) { - generator.writeKey("parent_task_id"); - generator.write(this.parentTaskId); - - } - generator.writeKey("running_time_in_nanos"); - generator.write(this.runningTimeInNanos); - - generator.writeKey("start_time_in_millis"); - generator.write(this.startTimeInMillis); - - if (this.status != null) { - generator.writeKey("status"); - this.status.serialize(generator, mapper); - - } - generator.writeKey("type"); - generator.write(this.type); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link State}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String action; - - private Boolean cancellable; - - @Nullable - private String description; - - private Map> headers; - - private Long id; - - private String node; - - @Nullable - private String parentTaskId; - - private Long runningTimeInNanos; - - private Long startTimeInMillis; - - @Nullable - private Status status; - - private String type; - - /** - * Required - API name: {@code action} - */ - public final Builder action(String value) { - this.action = value; - return this; - } - - /** - * Required - API name: {@code cancellable} - */ - public final Builder cancellable(boolean value) { - this.cancellable = value; - return this; - } - - /** - * API name: {@code description} - */ - public final Builder description(@Nullable String value) { - this.description = value; - return this; - } - - /** - * Required - API name: {@code headers} - *

- * Adds all entries of map to headers. - */ - public final Builder headers(Map> map) { - this.headers = _mapPutAll(this.headers, map); - return this; - } - - /** - * Required - API name: {@code headers} - *

- * Adds an entry to headers. - */ - public final Builder headers(String key, List value) { - this.headers = _mapPut(this.headers, key, value); - return this; - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(long value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code node} - */ - public final Builder node(String value) { - this.node = value; - return this; - } - - /** - * API name: {@code parent_task_id} - */ - public final Builder parentTaskId(@Nullable String value) { - this.parentTaskId = value; - return this; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final Builder runningTimeInNanos(long value) { - this.runningTimeInNanos = value; - return this; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final Builder startTimeInMillis(long value) { - this.startTimeInMillis = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(@Nullable Status value) { - this.status = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(Function> fn) { - return this.status(fn.apply(new Status.Builder()).build()); - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Builds a {@link State}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public State build() { - _checkSingleUse(); - - return new State(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link State} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - State::setupStateDeserializer); - - protected static void setupStateDeserializer(ObjectDeserializer op) { - - op.add(Builder::action, JsonpDeserializer.stringDeserializer(), "action"); - op.add(Builder::cancellable, JsonpDeserializer.booleanDeserializer(), "cancellable"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::headers, JsonpDeserializer.stringMapDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "headers"); - op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::parentTaskId, JsonpDeserializer.stringDeserializer(), "parent_task_id"); - op.add(Builder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(Builder::status, Status._DESERIALIZER, "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Status.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Status.java deleted file mode 100644 index b8c96c70b..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/Status.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.tasks; - -import co.elastic.clients.elasticsearch._types.Retries; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Float; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: tasks._types.Status - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Status implements JsonpSerializable { - private final long batches; - - @Nullable - private final String canceled; - - private final long created; - - private final long deleted; - - private final long noops; - - private final List failures; - - private final float requestsPerSecond; - - private final Retries retries; - - @Nullable - private final Time throttled; - - private final long throttledMillis; - - @Nullable - private final Time throttledUntil; - - private final long throttledUntilMillis; - - @Nullable - private final Boolean timedOut; - - @Nullable - private final Long took; - - private final long total; - - private final long updated; - - private final long versionConflicts; - - // --------------------------------------------------------------------------------------------- - - private Status(Builder builder) { - - this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches"); - this.canceled = builder.canceled; - this.created = ApiTypeHelper.requireNonNull(builder.created, this, "created"); - this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); - this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops"); - this.failures = ApiTypeHelper.unmodifiable(builder.failures); - this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond"); - this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); - this.throttled = builder.throttled; - this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); - this.throttledUntil = builder.throttledUntil; - this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, - "throttledUntilMillis"); - this.timedOut = builder.timedOut; - this.took = builder.took; - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.updated = ApiTypeHelper.requireNonNull(builder.updated, this, "updated"); - this.versionConflicts = ApiTypeHelper.requireNonNull(builder.versionConflicts, this, "versionConflicts"); - - } - - public static Status of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code batches} - */ - public final long batches() { - return this.batches; - } - - /** - * API name: {@code canceled} - */ - @Nullable - public final String canceled() { - return this.canceled; - } - - /** - * Required - API name: {@code created} - */ - public final long created() { - return this.created; - } - - /** - * Required - API name: {@code deleted} - */ - public final long deleted() { - return this.deleted; - } - - /** - * Required - API name: {@code noops} - */ - public final long noops() { - return this.noops; - } - - /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - API name: {@code requests_per_second} - */ - public final float requestsPerSecond() { - return this.requestsPerSecond; - } - - /** - * Required - API name: {@code retries} - */ - public final Retries retries() { - return this.retries; - } - - /** - * API name: {@code throttled} - */ - @Nullable - public final Time throttled() { - return this.throttled; - } - - /** - * Required - API name: {@code throttled_millis} - */ - public final long throttledMillis() { - return this.throttledMillis; - } - - /** - * API name: {@code throttled_until} - */ - @Nullable - public final Time throttledUntil() { - return this.throttledUntil; - } - - /** - * Required - API name: {@code throttled_until_millis} - */ - public final long throttledUntilMillis() { - return this.throttledUntilMillis; - } - - /** - * API name: {@code timed_out} - */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; - } - - /** - * API name: {@code took} - */ - @Nullable - public final Long took() { - return this.took; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * Required - API name: {@code updated} - */ - public final long updated() { - return this.updated; - } - - /** - * Required - API name: {@code version_conflicts} - */ - public final long versionConflicts() { - return this.versionConflicts; - } - - /** - * 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("batches"); - generator.write(this.batches); - - if (this.canceled != null) { - generator.writeKey("canceled"); - generator.write(this.canceled); - - } - generator.writeKey("created"); - generator.write(this.created); - - generator.writeKey("deleted"); - generator.write(this.deleted); - - generator.writeKey("noops"); - generator.write(this.noops); - - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (String item0 : this.failures) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("requests_per_second"); - generator.write(this.requestsPerSecond); - - generator.writeKey("retries"); - this.retries.serialize(generator, mapper); - - if (this.throttled != null) { - generator.writeKey("throttled"); - this.throttled.serialize(generator, mapper); - - } - generator.writeKey("throttled_millis"); - generator.write(this.throttledMillis); - - if (this.throttledUntil != null) { - generator.writeKey("throttled_until"); - this.throttledUntil.serialize(generator, mapper); - - } - generator.writeKey("throttled_until_millis"); - generator.write(this.throttledUntilMillis); - - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - - } - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("updated"); - generator.write(this.updated); - - generator.writeKey("version_conflicts"); - generator.write(this.versionConflicts); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Status}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long batches; - - @Nullable - private String canceled; - - private Long created; - - private Long deleted; - - private Long noops; - - @Nullable - private List failures; - - private Float requestsPerSecond; - - private Retries retries; - - @Nullable - private Time throttled; - - private Long throttledMillis; - - @Nullable - private Time throttledUntil; - - private Long throttledUntilMillis; - - @Nullable - private Boolean timedOut; - - @Nullable - private Long took; - - private Long total; - - private Long updated; - - private Long versionConflicts; - - /** - * Required - API name: {@code batches} - */ - public final Builder batches(long value) { - this.batches = value; - return this; - } - - /** - * API name: {@code canceled} - */ - public final Builder canceled(@Nullable String value) { - this.canceled = value; - return this; - } - - /** - * Required - API name: {@code created} - */ - public final Builder created(long value) { - this.created = value; - return this; - } - - /** - * Required - API name: {@code deleted} - */ - public final Builder deleted(long value) { - this.deleted = value; - return this; - } - - /** - * Required - API name: {@code noops} - */ - public final Builder noops(long value) { - this.noops = value; - return this; - } - - /** - * API name: {@code failures} - *

- * Adds all elements of list to failures. - */ - public final Builder failures(List list) { - this.failures = _listAddAll(this.failures, list); - return this; - } - - /** - * API name: {@code failures} - *

- * Adds one or more values to failures. - */ - public final Builder failures(String value, String... values) { - this.failures = _listAdd(this.failures, value, values); - return this; - } - - /** - * Required - API name: {@code requests_per_second} - */ - public final Builder requestsPerSecond(float value) { - this.requestsPerSecond = value; - return this; - } - - /** - * Required - API name: {@code retries} - */ - public final Builder retries(Retries value) { - this.retries = value; - return this; - } - - /** - * Required - API name: {@code retries} - */ - public final Builder retries(Function> fn) { - return this.retries(fn.apply(new Retries.Builder()).build()); - } - - /** - * API name: {@code throttled} - */ - public final Builder throttled(@Nullable Time value) { - this.throttled = value; - return this; - } - - /** - * API name: {@code throttled} - */ - public final Builder throttled(Function> fn) { - return this.throttled(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - API name: {@code throttled_millis} - */ - public final Builder throttledMillis(long value) { - this.throttledMillis = value; - return this; - } - - /** - * API name: {@code throttled_until} - */ - public final Builder throttledUntil(@Nullable Time value) { - this.throttledUntil = value; - return this; - } - - /** - * API name: {@code throttled_until} - */ - public final Builder throttledUntil(Function> fn) { - return this.throttledUntil(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - API name: {@code throttled_until_millis} - */ - public final Builder throttledUntilMillis(long value) { - this.throttledUntilMillis = value; - return this; - } - - /** - * API name: {@code timed_out} - */ - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; - return this; - } - - /** - * API name: {@code took} - */ - public final Builder took(@Nullable Long value) { - this.took = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * Required - API name: {@code updated} - */ - public final Builder updated(long value) { - this.updated = value; - return this; - } - - /** - * Required - API name: {@code version_conflicts} - */ - public final Builder versionConflicts(long value) { - this.versionConflicts = value; - return this; - } - - /** - * Builds a {@link Status}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Status build() { - _checkSingleUse(); - - return new Status(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Status} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Status::setupStatusDeserializer); - - protected static void setupStatusDeserializer(ObjectDeserializer op) { - - op.add(Builder::batches, JsonpDeserializer.longDeserializer(), "batches"); - op.add(Builder::canceled, JsonpDeserializer.stringDeserializer(), "canceled"); - op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); - op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); - op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "failures"); - op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); - op.add(Builder::retries, Retries._DESERIALIZER, "retries"); - op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); - op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); - op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); - op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); - op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); - op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskExecutingNode.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskExecutingNode.java deleted file mode 100644 index a19f2de5b..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskExecutingNode.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.tasks; - -import co.elastic.clients.elasticsearch._types.BaseNode; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: tasks._types.TaskExecutingNode - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TaskExecutingNode extends BaseNode { - private final Map tasks; - - // --------------------------------------------------------------------------------------------- - - private TaskExecutingNode(Builder builder) { - super(builder); - - this.tasks = ApiTypeHelper.unmodifiableRequired(builder.tasks, this, "tasks"); - - } - - public static TaskExecutingNode of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code tasks} - */ - public final Map tasks() { - return this.tasks; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.tasks)) { - generator.writeKey("tasks"); - generator.writeStartObject(); - for (Map.Entry item0 : this.tasks.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link TaskExecutingNode}. - */ - - public static class Builder extends BaseNode.AbstractBuilder implements ObjectBuilder { - private Map tasks; - - /** - * Required - API name: {@code tasks} - *

- * Adds all entries of map to tasks. - */ - public final Builder tasks(Map map) { - this.tasks = _mapPutAll(this.tasks, map); - return this; - } - - /** - * Required - API name: {@code tasks} - *

- * Adds an entry to tasks. - */ - public final Builder tasks(String key, State value) { - this.tasks = _mapPut(this.tasks, key, value); - return this; - } - - /** - * Required - API name: {@code tasks} - *

- * Adds an entry to tasks using a builder lambda. - */ - public final Builder tasks(String key, Function> fn) { - return tasks(key, fn.apply(new State.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link TaskExecutingNode}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public TaskExecutingNode build() { - _checkSingleUse(); - - return new TaskExecutingNode(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link TaskExecutingNode} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, TaskExecutingNode::setupTaskExecutingNodeDeserializer); - - protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer op) { - BaseNode.setupBaseNodeDeserializer(op); - op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(State._DESERIALIZER), "tasks"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java index f8bd201fa..988f0ac00 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java @@ -39,9 +39,11 @@ import java.lang.Long; import java.lang.String; 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.Nullable; // typedef: transform.get_transform_stats.Request @@ -64,7 +66,7 @@ public class GetTransformStatsRequest extends RequestBase { @Nullable private final Long size; - private final String transformId; + private final List transformId; // --------------------------------------------------------------------------------------------- @@ -73,7 +75,7 @@ private GetTransformStatsRequest(Builder builder) { this.allowNoMatch = builder.allowNoMatch; this.from = builder.from; this.size = builder.size; - this.transformId = ApiTypeHelper.requireNonNull(builder.transformId, this, "transformId"); + this.transformId = ApiTypeHelper.unmodifiableRequired(builder.transformId, this, "transformId"); } @@ -129,7 +131,7 @@ public final Long size() { *

* API name: {@code transform_id} */ - public final String transformId() { + public final List transformId() { return this.transformId; } @@ -149,7 +151,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder transformId; /** * Specifies what to do when the request: @@ -198,9 +200,27 @@ public final Builder size(@Nullable Long value) { * <transform_id>. *

* API name: {@code transform_id} + *

+ * Adds all elements of list to transformId. + */ + public final Builder transformId(List list) { + this.transformId = _listAddAll(this.transformId, list); + return this; + } + + /** + * Required - Identifier for the transform. It can be a transform identifier or + * a wildcard expression. You can get information for all transforms by using + * _all, by specifying * as the + * <transform_id>, or by omitting the + * <transform_id>. + *

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

+ * Adds one or more values to transformId. */ - public final Builder transformId(String value) { - this.transformId = value; + public final Builder transformId(String value, String... values) { + this.transformId = _listAdd(this.transformId, value, values); return this; } @@ -243,7 +263,8 @@ public GetTransformStatsRequest build() { StringBuilder buf = new StringBuilder(); buf.append("/_transform"); buf.append("/"); - SimpleEndpoint.pathEncode(request.transformId, buf); + SimpleEndpoint.pathEncode(request.transformId.stream().map(v -> v).collect(Collectors.joining(",")), + buf); buf.append("/_stats"); return buf.toString(); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java index 853c7323f..dab02fb9e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java @@ -55,6 +55,9 @@ public class Settings implements JsonpSerializable { @Nullable private final Boolean datesAsEpochMillis; + @Nullable + private final Boolean deduceMappings; + @Nullable private final Float docsPerSecond; @@ -67,6 +70,7 @@ private Settings(Builder builder) { this.alignCheckpoints = builder.alignCheckpoints; this.datesAsEpochMillis = builder.datesAsEpochMillis; + this.deduceMappings = builder.deduceMappings; this.docsPerSecond = builder.docsPerSecond; this.maxPageSearchSize = builder.maxPageSearchSize; @@ -103,6 +107,17 @@ public final Boolean datesAsEpochMillis() { return this.datesAsEpochMillis; } + /** + * Specifies whether the transform should deduce the destination index mappings + * from the transform configuration. + *

+ * API name: {@code deduce_mappings} + */ + @Nullable + public final Boolean deduceMappings() { + return this.deduceMappings; + } + /** * Specifies a limit on the number of input documents per second. This setting * throttles the transform by adding a wait time between search requests. The @@ -148,6 +163,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("dates_as_epoch_millis"); generator.write(this.datesAsEpochMillis); + } + if (this.deduceMappings != null) { + generator.writeKey("deduce_mappings"); + generator.write(this.deduceMappings); + } if (this.docsPerSecond != null) { generator.writeKey("docs_per_second"); @@ -175,6 +195,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder + * API name: {@code deduce_mappings} + */ + public final Builder deduceMappings(@Nullable Boolean value) { + this.deduceMappings = value; + return this; + } + /** * Specifies a limit on the number of input documents per second. This setting * throttles the transform by adding a wait time between search requests. The @@ -258,6 +292,7 @@ protected static void setupSettingsDeserializer(ObjectDeserializer runtimeMappings; + private final Map> runtimeMappings; // --------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ public final Query query() { *

* API name: {@code runtime_mappings} */ - public final Map runtimeMappings() { + public final Map> runtimeMappings() { return this.runtimeMappings; } @@ -140,9 +140,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); } generator.writeEnd(); @@ -164,7 +171,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder runtimeMappings; + private Map> runtimeMappings; /** * Required - The source indices for the transform. It can be a single index, an @@ -236,7 +243,7 @@ public final Builder query(Function> fn) { *

* Adds all entries of map to runtimeMappings. */ - public final Builder runtimeMappings(Map map) { + public final Builder runtimeMappings(Map> map) { this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); return this; } @@ -250,25 +257,11 @@ public final Builder runtimeMappings(Map map) { *

* Adds an entry to runtimeMappings. */ - public final Builder runtimeMappings(String key, RuntimeField value) { + public final Builder runtimeMappings(String key, List value) { this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); return this; } - /** - * Definitions of search-time runtime fields that can be used by the transform. - * For search runtime fields all data nodes, including remote nodes, must be - * 7.12 or later. - *

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

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Builds a {@link Source}. * @@ -294,8 +287,8 @@ protected static void setupSourceDeserializer(ObjectDeserializer op.add(Builder::index, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index"); op.add(Builder::query, Query._DESERIALIZER, "query"); - op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), - "runtime_mappings"); + op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.arrayDeserializer(RuntimeField._DESERIALIZER)), "runtime_mappings"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java index 401b1486f..6ed317c14 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java @@ -74,13 +74,22 @@ public class Action implements JsonpSerializable { private final Transform transform; @Nullable - private final Index index; + private final IndexAction index; @Nullable - private final Logging logging; + private final LoggingAction logging; @Nullable - private final ActionWebhook webhook; + private final EmailAction email; + + @Nullable + private final PagerDutyAction pagerduty; + + @Nullable + private final SlackAction slack; + + @Nullable + private final WebhookAction webhook; // --------------------------------------------------------------------------------------------- @@ -96,6 +105,9 @@ private Action(Builder builder) { this.transform = builder.transform; this.index = builder.index; this.logging = builder.logging; + this.email = builder.email; + this.pagerduty = builder.pagerduty; + this.slack = builder.slack; this.webhook = builder.webhook; } @@ -172,7 +184,7 @@ public final Transform transform() { * API name: {@code index} */ @Nullable - public final Index index() { + public final IndexAction index() { return this.index; } @@ -180,15 +192,39 @@ public final Index index() { * API name: {@code logging} */ @Nullable - public final Logging logging() { + public final LoggingAction logging() { return this.logging; } + /** + * API name: {@code email} + */ + @Nullable + public final EmailAction email() { + return this.email; + } + + /** + * API name: {@code pagerduty} + */ + @Nullable + public final PagerDutyAction pagerduty() { + return this.pagerduty; + } + + /** + * API name: {@code slack} + */ + @Nullable + public final SlackAction slack() { + return this.slack; + } + /** * API name: {@code webhook} */ @Nullable - public final ActionWebhook webhook() { + public final WebhookAction webhook() { return this.webhook; } @@ -251,6 +287,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("logging"); this.logging.serialize(generator, mapper); + } + if (this.email != null) { + generator.writeKey("email"); + this.email.serialize(generator, mapper); + + } + if (this.pagerduty != null) { + generator.writeKey("pagerduty"); + this.pagerduty.serialize(generator, mapper); + + } + if (this.slack != null) { + generator.writeKey("slack"); + this.slack.serialize(generator, mapper); + } if (this.webhook != null) { generator.writeKey("webhook"); @@ -292,13 +343,22 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder> fn) { - return this.index(fn.apply(new Index.Builder()).build()); + public final Builder index(Function> fn) { + return this.index(fn.apply(new IndexAction.Builder()).build()); } /** * API name: {@code logging} */ - public final Builder logging(@Nullable Logging value) { + public final Builder logging(@Nullable LoggingAction value) { this.logging = value; return this; } @@ -411,14 +471,59 @@ public final Builder logging(@Nullable Logging value) { /** * API name: {@code logging} */ - public final Builder logging(Function> fn) { - return this.logging(fn.apply(new Logging.Builder()).build()); + public final Builder logging(Function> fn) { + return this.logging(fn.apply(new LoggingAction.Builder()).build()); + } + + /** + * API name: {@code email} + */ + public final Builder email(@Nullable EmailAction value) { + this.email = value; + return this; + } + + /** + * API name: {@code email} + */ + public final Builder email(Function> fn) { + return this.email(fn.apply(new EmailAction.Builder()).build()); + } + + /** + * API name: {@code pagerduty} + */ + public final Builder pagerduty(@Nullable PagerDutyAction value) { + this.pagerduty = value; + return this; + } + + /** + * API name: {@code pagerduty} + */ + public final Builder pagerduty(Function> fn) { + return this.pagerduty(fn.apply(new PagerDutyAction.Builder()).build()); + } + + /** + * API name: {@code slack} + */ + public final Builder slack(@Nullable SlackAction value) { + this.slack = value; + return this; + } + + /** + * API name: {@code slack} + */ + public final Builder slack(Function> fn) { + return this.slack(fn.apply(new SlackAction.Builder()).build()); } /** * API name: {@code webhook} */ - public final Builder webhook(@Nullable ActionWebhook value) { + public final Builder webhook(@Nullable WebhookAction value) { this.webhook = value; return this; } @@ -426,8 +531,8 @@ public final Builder webhook(@Nullable ActionWebhook value) { /** * API name: {@code webhook} */ - public final Builder webhook(Function> fn) { - return this.webhook(fn.apply(new ActionWebhook.Builder()).build()); + public final Builder webhook(Function> fn) { + return this.webhook(fn.apply(new WebhookAction.Builder()).build()); } /** @@ -461,9 +566,12 @@ protected static void setupActionDeserializer(ObjectDeserializer op.add(Builder::throttlePeriod, Time._DESERIALIZER, "throttle_period"); op.add(Builder::throttlePeriodInMillis, JsonpDeserializer.stringDeserializer(), "throttle_period_in_millis"); op.add(Builder::transform, Transform._DESERIALIZER, "transform"); - op.add(Builder::index, Index._DESERIALIZER, "index"); - op.add(Builder::logging, Logging._DESERIALIZER, "logging"); - op.add(Builder::webhook, ActionWebhook._DESERIALIZER, "webhook"); + op.add(Builder::index, IndexAction._DESERIALIZER, "index"); + op.add(Builder::logging, LoggingAction._DESERIALIZER, "logging"); + op.add(Builder::email, EmailAction._DESERIALIZER, "email"); + op.add(Builder::pagerduty, PagerDutyAction._DESERIALIZER, "pagerduty"); + op.add(Builder::slack, SlackAction._DESERIALIZER, "slack"); + op.add(Builder::webhook, WebhookAction._DESERIALIZER, "webhook"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/CompareCondition.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/CompareCondition.java index 01ee80597..a7edd4182 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/CompareCondition.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/CompareCondition.java @@ -56,12 +56,6 @@ public class CompareCondition implements ConditionVariant, JsonpSerializable { @Nullable private final JsonData value; - @Nullable - private final CompareContextPayloadCondition ctxPayloadMatch; - - @Nullable - private final CompareContextPayloadCondition ctxPayloadValue; - // --------------------------------------------------------------------------------------------- private CompareCondition(Builder builder) { @@ -69,8 +63,6 @@ private CompareCondition(Builder builder) { this.comparison = builder.comparison; this.path = builder.path; this.value = builder.value; - this.ctxPayloadMatch = builder.ctxPayloadMatch; - this.ctxPayloadValue = builder.ctxPayloadValue; } @@ -110,22 +102,6 @@ public final JsonData value() { return this.value; } - /** - * API name: {@code ctx.payload.match} - */ - @Nullable - public final CompareContextPayloadCondition ctxPayloadMatch() { - return this.ctxPayloadMatch; - } - - /** - * API name: {@code ctx.payload.value} - */ - @Nullable - public final CompareContextPayloadCondition ctxPayloadValue() { - return this.ctxPayloadValue; - } - /** * Serialize this object to JSON. */ @@ -152,16 +128,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.value.serialize(generator, mapper); } - if (this.ctxPayloadMatch != null) { - generator.writeKey("ctx.payload.match"); - this.ctxPayloadMatch.serialize(generator, mapper); - - } - if (this.ctxPayloadValue != null) { - generator.writeKey("ctx.payload.value"); - this.ctxPayloadValue.serialize(generator, mapper); - - } } @@ -181,12 +147,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder> fn) { - return this.ctxPayloadMatch(fn.apply(new CompareContextPayloadCondition.Builder()).build()); - } - - /** - * API name: {@code ctx.payload.value} - */ - public final Builder ctxPayloadValue(@Nullable CompareContextPayloadCondition value) { - this.ctxPayloadValue = value; - return this; - } - - /** - * API name: {@code ctx.payload.value} - */ - public final Builder ctxPayloadValue( - Function> fn) { - return this.ctxPayloadValue(fn.apply(new CompareContextPayloadCondition.Builder()).build()); - } - /** * Builds a {@link CompareCondition}. * @@ -269,8 +197,6 @@ protected static void setupCompareConditionDeserializer(ObjectDeserializerAPI - * specification - */ -@JsonpDeserializable -public class CompareContextPayloadCondition implements JsonpSerializable { - @Nullable - private final JsonData eq; - - @Nullable - private final JsonData lt; - - @Nullable - private final JsonData gt; - - @Nullable - private final JsonData lte; - - @Nullable - private final JsonData gte; - - // --------------------------------------------------------------------------------------------- - - private CompareContextPayloadCondition(Builder builder) { - - this.eq = builder.eq; - this.lt = builder.lt; - this.gt = builder.gt; - this.lte = builder.lte; - this.gte = builder.gte; - - } - - public static CompareContextPayloadCondition of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code eq} - */ - @Nullable - public final JsonData eq() { - return this.eq; - } - - /** - * API name: {@code lt} - */ - @Nullable - public final JsonData lt() { - return this.lt; - } - - /** - * API name: {@code gt} - */ - @Nullable - public final JsonData gt() { - return this.gt; - } - - /** - * API name: {@code lte} - */ - @Nullable - public final JsonData lte() { - return this.lte; - } - - /** - * API name: {@code gte} - */ - @Nullable - public final JsonData gte() { - return this.gte; - } - - /** - * 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.eq != null) { - generator.writeKey("eq"); - this.eq.serialize(generator, mapper); - - } - if (this.lt != null) { - generator.writeKey("lt"); - this.lt.serialize(generator, mapper); - - } - if (this.gt != null) { - generator.writeKey("gt"); - this.gt.serialize(generator, mapper); - - } - if (this.lte != null) { - generator.writeKey("lte"); - this.lte.serialize(generator, mapper); - - } - if (this.gte != null) { - generator.writeKey("gte"); - this.gte.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CompareContextPayloadCondition}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private JsonData eq; - - @Nullable - private JsonData lt; - - @Nullable - private JsonData gt; - - @Nullable - private JsonData lte; - - @Nullable - private JsonData gte; - - /** - * API name: {@code eq} - */ - public final Builder eq(@Nullable JsonData value) { - this.eq = value; - return this; - } - - /** - * API name: {@code lt} - */ - public final Builder lt(@Nullable JsonData value) { - this.lt = value; - return this; - } - - /** - * API name: {@code gt} - */ - public final Builder gt(@Nullable JsonData value) { - this.gt = value; - return this; - } - - /** - * API name: {@code lte} - */ - public final Builder lte(@Nullable JsonData value) { - this.lte = value; - return this; - } - - /** - * API name: {@code gte} - */ - public final Builder gte(@Nullable JsonData value) { - this.gte = value; - return this; - } - - /** - * Builds a {@link CompareContextPayloadCondition}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompareContextPayloadCondition build() { - _checkSingleUse(); - - return new CompareContextPayloadCondition(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CompareContextPayloadCondition} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, CompareContextPayloadCondition::setupCompareContextPayloadConditionDeserializer); - - protected static void setupCompareContextPayloadConditionDeserializer( - ObjectDeserializer op) { - - op.add(Builder::eq, JsonData._DESERIALIZER, "eq"); - op.add(Builder::lt, JsonData._DESERIALIZER, "lt"); - op.add(Builder::gt, JsonData._DESERIALIZER, "gt"); - op.add(Builder::lte, JsonData._DESERIALIZER, "lte"); - op.add(Builder::gte, JsonData._DESERIALIZER, "gte"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/thread_pool/ThreadPoolSize.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataAttachmentFormat.java similarity index 76% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/cat/thread_pool/ThreadPoolSize.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataAttachmentFormat.java index ffef7576f..f711bcac1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/thread_pool/ThreadPoolSize.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataAttachmentFormat.java @@ -21,7 +21,7 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.cat.thread_pool; +package co.elastic.clients.elasticsearch.watcher; import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; @@ -30,26 +30,20 @@ /** * * @see API + * "../doc-files/api-spec.html#watcher._types.DataAttachmentFormat">API * specification */ @JsonpDeserializable -public enum ThreadPoolSize implements JsonEnum { - K("k"), +public enum DataAttachmentFormat implements JsonEnum { + Json("json"), - M("m"), - - G("g"), - - T("t"), - - P("p"), + Yaml("yaml"), ; private final String jsonValue; - ThreadPoolSize(String jsonValue) { + DataAttachmentFormat(String jsonValue) { this.jsonValue = jsonValue; } @@ -57,6 +51,6 @@ public String jsonValue() { return this.jsonValue; } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ThreadPoolSize.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + DataAttachmentFormat.values()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataEmailAttachment.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataEmailAttachment.java new file mode 100644 index 000000000..dcffc4da6 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DataEmailAttachment.java @@ -0,0 +1,143 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: watcher._types.DataEmailAttachment + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataEmailAttachment implements EmailAttachmentVariant, JsonpSerializable { + @Nullable + private final DataAttachmentFormat format; + + // --------------------------------------------------------------------------------------------- + + private DataEmailAttachment(Builder builder) { + + this.format = builder.format; + + } + + public static DataEmailAttachment of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * EmailAttachment variant kind. + */ + @Override + public EmailAttachment.Kind _emailAttachmentKind() { + return EmailAttachment.Kind.Data; + } + + /** + * API name: {@code format} + */ + @Nullable + public final DataAttachmentFormat format() { + return this.format; + } + + /** + * 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.format != null) { + generator.writeKey("format"); + this.format.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataEmailAttachment}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private DataAttachmentFormat format; + + /** + * API name: {@code format} + */ + public final Builder format(@Nullable DataAttachmentFormat value) { + this.format = value; + return this; + } + + /** + * Builds a {@link DataEmailAttachment}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataEmailAttachment build() { + _checkSingleUse(); + + return new DataEmailAttachment(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataEmailAttachment} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataEmailAttachment::setupDataEmailAttachmentDeserializer); + + protected static void setupDataEmailAttachmentDeserializer(ObjectDeserializer op) { + + op.add(Builder::format, DataAttachmentFormat._DESERIALIZER, "format"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Email.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Email.java index f68d4d21f..36d95798d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Email.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Email.java @@ -35,6 +35,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -58,37 +59,38 @@ public class Email implements JsonpSerializable { @Nullable private final String from; - private final String id; - @Nullable private final EmailPriority priority; private final List replyTo; + @Nullable private final String sentDate; private final String subject; private final List to; + private final Map attachments; + // --------------------------------------------------------------------------------------------- - private Email(Builder builder) { + protected Email(AbstractBuilder builder) { this.bcc = ApiTypeHelper.unmodifiable(builder.bcc); this.body = builder.body; this.cc = ApiTypeHelper.unmodifiable(builder.cc); this.from = builder.from; - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.priority = builder.priority; this.replyTo = ApiTypeHelper.unmodifiable(builder.replyTo); - this.sentDate = ApiTypeHelper.requireNonNull(builder.sentDate, this, "sentDate"); + this.sentDate = builder.sentDate; this.subject = ApiTypeHelper.requireNonNull(builder.subject, this, "subject"); this.to = ApiTypeHelper.unmodifiableRequired(builder.to, this, "to"); + this.attachments = ApiTypeHelper.unmodifiable(builder.attachments); } - public static Email of(Function> fn) { + public static Email emailOf(Function> fn) { return fn.apply(new Builder()).build(); } @@ -122,13 +124,6 @@ public final String from() { return this.from; } - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - /** * API name: {@code priority} */ @@ -145,8 +140,9 @@ public final List replyTo() { } /** - * Required - API name: {@code sent_date} + * API name: {@code sent_date} */ + @Nullable public final String sentDate() { return this.sentDate; } @@ -165,6 +161,13 @@ public final List to() { return this.to; } + /** + * API name: {@code attachments} + */ + public final Map attachments() { + return this.attachments; + } + /** * Serialize this object to JSON. */ @@ -206,9 +209,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.from); } - generator.writeKey("id"); - generator.write(this.id); - if (this.priority != null) { generator.writeKey("priority"); this.priority.serialize(generator, mapper); @@ -223,9 +223,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("sent_date"); - generator.write(this.sentDate); + if (this.sentDate != null) { + generator.writeKey("sent_date"); + generator.write(this.sentDate); + } generator.writeKey("subject"); generator.write(this.subject); @@ -239,6 +241,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (ApiTypeHelper.isDefined(this.attachments)) { + generator.writeKey("attachments"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attachments.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -248,7 +261,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link Email}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends Email.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Email}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Email build() { + _checkSingleUse(); + + return new Email(this); + } + } + + protected abstract static class AbstractBuilder> + extends + ObjectBuilderBase { @Nullable private List bcc; @@ -261,28 +295,30 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder replyTo; + @Nullable private String sentDate; private String subject; private List to; + @Nullable + private Map attachments; + /** * API name: {@code bcc} *

* Adds all elements of list to bcc. */ - public final Builder bcc(List list) { + public final BuilderT bcc(List list) { this.bcc = _listAddAll(this.bcc, list); - return this; + return self(); } /** @@ -290,23 +326,23 @@ public final Builder bcc(List list) { *

* Adds one or more values to bcc. */ - public final Builder bcc(String value, String... values) { + public final BuilderT bcc(String value, String... values) { this.bcc = _listAdd(this.bcc, value, values); - return this; + return self(); } /** * API name: {@code body} */ - public final Builder body(@Nullable EmailBody value) { + public final BuilderT body(@Nullable EmailBody value) { this.body = value; - return this; + return self(); } /** * API name: {@code body} */ - public final Builder body(Function> fn) { + public final BuilderT body(Function> fn) { return this.body(fn.apply(new EmailBody.Builder()).build()); } @@ -315,9 +351,9 @@ public final Builder body(Function> *

* Adds all elements of list to cc. */ - public final Builder cc(List list) { + public final BuilderT cc(List list) { this.cc = _listAddAll(this.cc, list); - return this; + return self(); } /** @@ -325,33 +361,25 @@ public final Builder cc(List list) { *

* Adds one or more values to cc. */ - public final Builder cc(String value, String... values) { + public final BuilderT cc(String value, String... values) { this.cc = _listAdd(this.cc, value, values); - return this; + return self(); } /** * API name: {@code from} */ - public final Builder from(@Nullable String value) { + public final BuilderT from(@Nullable String value) { this.from = value; - return this; - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; + return self(); } /** * API name: {@code priority} */ - public final Builder priority(@Nullable EmailPriority value) { + public final BuilderT priority(@Nullable EmailPriority value) { this.priority = value; - return this; + return self(); } /** @@ -359,9 +387,9 @@ public final Builder priority(@Nullable EmailPriority value) { *

* Adds all elements of list to replyTo. */ - public final Builder replyTo(List list) { + public final BuilderT replyTo(List list) { this.replyTo = _listAddAll(this.replyTo, list); - return this; + return self(); } /** @@ -369,25 +397,25 @@ public final Builder replyTo(List list) { *

* Adds one or more values to replyTo. */ - public final Builder replyTo(String value, String... values) { + public final BuilderT replyTo(String value, String... values) { this.replyTo = _listAdd(this.replyTo, value, values); - return this; + return self(); } /** - * Required - API name: {@code sent_date} + * API name: {@code sent_date} */ - public final Builder sentDate(String value) { + public final BuilderT sentDate(@Nullable String value) { this.sentDate = value; - return this; + return self(); } /** * Required - API name: {@code subject} */ - public final Builder subject(String value) { + public final BuilderT subject(String value) { this.subject = value; - return this; + return self(); } /** @@ -395,9 +423,9 @@ public final Builder subject(String value) { *

* Adds all elements of list to to. */ - public final Builder to(List list) { + public final BuilderT to(List list) { this.to = _listAddAll(this.to, list); - return this; + return self(); } /** @@ -405,22 +433,43 @@ public final Builder to(List list) { *

* Adds one or more values to to. */ - public final Builder to(String value, String... values) { + public final BuilderT to(String value, String... values) { this.to = _listAdd(this.to, value, values); - return this; + return self(); } /** - * Builds a {@link Email}. - * - * @throws NullPointerException - * if some of the required fields are null. + * API name: {@code attachments} + *

+ * Adds all entries of map to attachments. */ - public Email build() { - _checkSingleUse(); + public final BuilderT attachments(Map map) { + this.attachments = _mapPutAll(this.attachments, map); + return self(); + } - return new Email(this); + /** + * API name: {@code attachments} + *

+ * Adds an entry to attachments. + */ + public final BuilderT attachments(String key, EmailAttachment value) { + this.attachments = _mapPut(this.attachments, key, value); + return self(); } + + /** + * API name: {@code attachments} + *

+ * Adds an entry to attachments using a builder lambda. + */ + public final BuilderT attachments(String key, + Function> fn) { + return attachments(key, fn.apply(new EmailAttachment.Builder()).build()); + } + + protected abstract BuilderT self(); + } // --------------------------------------------------------------------------------------------- @@ -431,19 +480,22 @@ public Email build() { public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Email::setupEmailDeserializer); - protected static void setupEmailDeserializer(ObjectDeserializer op) { + protected static > void setupEmailDeserializer( + ObjectDeserializer op) { - op.add(Builder::bcc, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "bcc"); - op.add(Builder::body, EmailBody._DESERIALIZER, "body"); - op.add(Builder::cc, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "cc"); - op.add(Builder::from, JsonpDeserializer.stringDeserializer(), "from"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::priority, EmailPriority._DESERIALIZER, "priority"); - op.add(Builder::replyTo, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + op.add(AbstractBuilder::bcc, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "bcc"); + op.add(AbstractBuilder::body, EmailBody._DESERIALIZER, "body"); + op.add(AbstractBuilder::cc, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "cc"); + op.add(AbstractBuilder::from, JsonpDeserializer.stringDeserializer(), "from"); + op.add(AbstractBuilder::priority, EmailPriority._DESERIALIZER, "priority"); + op.add(AbstractBuilder::replyTo, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "reply_to"); - op.add(Builder::sentDate, JsonpDeserializer.stringDeserializer(), "sent_date"); - op.add(Builder::subject, JsonpDeserializer.stringDeserializer(), "subject"); - op.add(Builder::to, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "to"); + op.add(AbstractBuilder::sentDate, JsonpDeserializer.stringDeserializer(), "sent_date"); + op.add(AbstractBuilder::subject, JsonpDeserializer.stringDeserializer(), "subject"); + op.add(AbstractBuilder::to, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "to"); + op.add(AbstractBuilder::attachments, JsonpDeserializer.stringMapDeserializer(EmailAttachment._DESERIALIZER), + "attachments"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAction.java new file mode 100644 index 000000000..f7945170b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAction.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: watcher._types.EmailAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EmailAction extends Email { + // --------------------------------------------------------------------------------------------- + + private EmailAction(Builder builder) { + super(builder); + + } + + public static EmailAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EmailAction}. + */ + + public static class Builder extends Email.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EmailAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EmailAction build() { + _checkSingleUse(); + + return new EmailAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EmailAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + EmailAction::setupEmailActionDeserializer); + + protected static void setupEmailActionDeserializer(ObjectDeserializer op) { + Email.setupEmailDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachment.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachment.java new file mode 100644 index 000000000..c7febccbb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachment.java @@ -0,0 +1,238 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: watcher._types.EmailAttachmentContainer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EmailAttachment implements TaggedUnion, JsonpSerializable { + + /** + * {@link EmailAttachment} variant kinds. + */ + /** + * {@link EmailAttachment} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Http("http"), + + Reporting("reporting"), + + Data("data"), + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public EmailAttachment(EmailAttachmentVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._emailAttachmentKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private EmailAttachment(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static EmailAttachment of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code http}? + */ + public boolean isHttp() { + return _kind == Kind.Http; + } + + /** + * Get the {@code http} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code http} kind. + */ + public HttpEmailAttachment http() { + return TaggedUnionUtils.get(this, Kind.Http); + } + + /** + * Is this variant instance of kind {@code reporting}? + */ + public boolean isReporting() { + return _kind == Kind.Reporting; + } + + /** + * Get the {@code reporting} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code reporting} kind. + */ + public ReportingEmailAttachment reporting() { + return TaggedUnionUtils.get(this, Kind.Reporting); + } + + /** + * Is this variant instance of kind {@code data}? + */ + public boolean isData() { + return _kind == Kind.Data; + } + + /** + * Get the {@code data} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code data} kind. + */ + public DataEmailAttachment data() { + return TaggedUnionUtils.get(this, Kind.Data); + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); + + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + generator.writeEnd(); + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder http(HttpEmailAttachment v) { + this._kind = Kind.Http; + this._value = v; + return this; + } + + public ObjectBuilder http( + Function> fn) { + return this.http(fn.apply(new HttpEmailAttachment.Builder()).build()); + } + + public ObjectBuilder reporting(ReportingEmailAttachment v) { + this._kind = Kind.Reporting; + this._value = v; + return this; + } + + public ObjectBuilder reporting( + Function> fn) { + return this.reporting(fn.apply(new ReportingEmailAttachment.Builder()).build()); + } + + public ObjectBuilder data(DataEmailAttachment v) { + this._kind = Kind.Data; + this._value = v; + return this; + } + + public ObjectBuilder data( + Function> fn) { + return this.data(fn.apply(new DataEmailAttachment.Builder()).build()); + } + + public EmailAttachment build() { + _checkSingleUse(); + return new EmailAttachment(this); + } + + } + + protected static void setupEmailAttachmentDeserializer(ObjectDeserializer op) { + + op.add(Builder::http, HttpEmailAttachment._DESERIALIZER, "http"); + op.add(Builder::reporting, ReportingEmailAttachment._DESERIALIZER, "reporting"); + op.add(Builder::data, DataEmailAttachment._DESERIALIZER, "data"); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + EmailAttachment::setupEmailAttachmentDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestOptionBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentBuilders.java similarity index 55% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestOptionBuilders.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentBuilders.java index 70b80d741..5c6f60ced 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestOptionBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentBuilders.java @@ -21,37 +21,37 @@ // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. //---------------------------------------------------- -package co.elastic.clients.elasticsearch.core.search; +package co.elastic.clients.elasticsearch.watcher; /** - * Builders for {@link SuggestOption} variants. + * Builders for {@link EmailAttachment} variants. */ -public class SuggestOptionBuilders { - private SuggestOptionBuilders() { +public class EmailAttachmentBuilders { + private EmailAttachmentBuilders() { } /** - * Creates a builder for the {@link CompletionSuggestOption completion} - * {@code SuggestOption} variant. + * Creates a builder for the {@link HttpEmailAttachment http} + * {@code EmailAttachment} variant. */ - public static CompletionSuggestOption.Builder completion() { - return new CompletionSuggestOption.Builder(); + public static HttpEmailAttachment.Builder http() { + return new HttpEmailAttachment.Builder(); } /** - * Creates a builder for the {@link PhraseSuggestOption phrase} - * {@code SuggestOption} variant. + * Creates a builder for the {@link ReportingEmailAttachment reporting} + * {@code EmailAttachment} variant. */ - public static PhraseSuggestOption.Builder phrase() { - return new PhraseSuggestOption.Builder(); + public static ReportingEmailAttachment.Builder reporting() { + return new ReportingEmailAttachment.Builder(); } /** - * Creates a builder for the {@link TermSuggestOption term} - * {@code SuggestOption} variant. + * Creates a builder for the {@link DataEmailAttachment data} + * {@code EmailAttachment} variant. */ - public static TermSuggestOption.Builder term() { - return new TermSuggestOption.Builder(); + public static DataEmailAttachment.Builder data() { + return new DataEmailAttachment.Builder(); } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentVariant.java new file mode 100644 index 000000000..62c58607f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailAttachmentVariant.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +/** + * Base interface for {@link EmailAttachment} variants. + */ +public interface EmailAttachmentVariant { + + EmailAttachment.Kind _emailAttachmentKind(); + + default EmailAttachment _toEmailAttachment() { + return new EmailAttachment(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailBody.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailBody.java index 28a583e85..c35c20ddd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailBody.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/EmailBody.java @@ -29,7 +29,6 @@ import co.elastic.clients.json.JsonpSerializable; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -47,16 +46,18 @@ */ @JsonpDeserializable public class EmailBody implements JsonpSerializable { + @Nullable private final String html; + @Nullable private final String text; // --------------------------------------------------------------------------------------------- private EmailBody(Builder builder) { - this.html = ApiTypeHelper.requireNonNull(builder.html, this, "html"); - this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text"); + this.html = builder.html; + this.text = builder.text; } @@ -65,15 +66,17 @@ public static EmailBody of(Function> fn) { } /** - * Required - API name: {@code html} + * API name: {@code html} */ + @Nullable public final String html() { return this.html; } /** - * Required - API name: {@code text} + * API name: {@code text} */ + @Nullable public final String text() { return this.text; } @@ -89,11 +92,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("html"); - generator.write(this.html); + if (this.html != null) { + generator.writeKey("html"); + generator.write(this.html); - generator.writeKey("text"); - generator.write(this.text); + } + if (this.text != null) { + generator.writeKey("text"); + generator.write(this.text); + + } } @@ -104,22 +112,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private String html; + @Nullable private String text; /** - * Required - API name: {@code html} + * API name: {@code html} */ - public final Builder html(String value) { + public final Builder html(@Nullable String value) { this.html = value; return this; } /** - * Required - API name: {@code text} + * API name: {@code text} */ - public final Builder text(String value) { + public final Builder text(@Nullable String value) { this.text = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/HttpEmailAttachment.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/HttpEmailAttachment.java new file mode 100644 index 000000000..1828abdbb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/HttpEmailAttachment.java @@ -0,0 +1,212 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: watcher._types.HttpEmailAttachment + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class HttpEmailAttachment implements EmailAttachmentVariant, JsonpSerializable { + @Nullable + private final String contentType; + + @Nullable + private final Boolean inline; + + @Nullable + private final HttpInputRequestDefinition request; + + // --------------------------------------------------------------------------------------------- + + private HttpEmailAttachment(Builder builder) { + + this.contentType = builder.contentType; + this.inline = builder.inline; + this.request = builder.request; + + } + + public static HttpEmailAttachment of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * EmailAttachment variant kind. + */ + @Override + public EmailAttachment.Kind _emailAttachmentKind() { + return EmailAttachment.Kind.Http; + } + + /** + * API name: {@code content_type} + */ + @Nullable + public final String contentType() { + return this.contentType; + } + + /** + * API name: {@code inline} + */ + @Nullable + public final Boolean inline() { + return this.inline; + } + + /** + * API name: {@code request} + */ + @Nullable + public final HttpInputRequestDefinition request() { + return this.request; + } + + /** + * 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.contentType != null) { + generator.writeKey("content_type"); + generator.write(this.contentType); + + } + if (this.inline != null) { + generator.writeKey("inline"); + generator.write(this.inline); + + } + if (this.request != null) { + generator.writeKey("request"); + this.request.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HttpEmailAttachment}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String contentType; + + @Nullable + private Boolean inline; + + @Nullable + private HttpInputRequestDefinition request; + + /** + * API name: {@code content_type} + */ + public final Builder contentType(@Nullable String value) { + this.contentType = value; + return this; + } + + /** + * API name: {@code inline} + */ + public final Builder inline(@Nullable Boolean value) { + this.inline = value; + return this; + } + + /** + * API name: {@code request} + */ + public final Builder request(@Nullable HttpInputRequestDefinition value) { + this.request = value; + return this; + } + + /** + * API name: {@code request} + */ + public final Builder request( + Function> fn) { + return this.request(fn.apply(new HttpInputRequestDefinition.Builder()).build()); + } + + /** + * Builds a {@link HttpEmailAttachment}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HttpEmailAttachment build() { + _checkSingleUse(); + + return new HttpEmailAttachment(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HttpEmailAttachment} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HttpEmailAttachment::setupHttpEmailAttachmentDeserializer); + + protected static void setupHttpEmailAttachmentDeserializer(ObjectDeserializer op) { + + op.add(Builder::contentType, JsonpDeserializer.stringDeserializer(), "content_type"); + op.add(Builder::inline, JsonpDeserializer.booleanDeserializer(), "inline"); + op.add(Builder::request, HttpInputRequestDefinition._DESERIALIZER, "request"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Index.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java similarity index 60% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Index.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java index f936cd3d3..f08de9a9b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Index.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java @@ -23,7 +23,9 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.elasticsearch._types.OpType; import co.elastic.clients.elasticsearch._types.Refresh; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -39,15 +41,15 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: watcher._types.Index +// typedef: watcher._types.IndexAction /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class Index implements JsonpSerializable { +public class IndexAction implements JsonpSerializable { private final String index; @Nullable @@ -56,17 +58,29 @@ public class Index implements JsonpSerializable { @Nullable private final Refresh refresh; + @Nullable + private final OpType opType; + + @Nullable + private final Time timeout; + + @Nullable + private final String executionTimeField; + // --------------------------------------------------------------------------------------------- - private Index(Builder builder) { + private IndexAction(Builder builder) { this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.docId = builder.docId; this.refresh = builder.refresh; + this.opType = builder.opType; + this.timeout = builder.timeout; + this.executionTimeField = builder.executionTimeField; } - public static Index of(Function> fn) { + public static IndexAction of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -93,6 +107,30 @@ public final Refresh refresh() { return this.refresh; } + /** + * API name: {@code op_type} + */ + @Nullable + public final OpType opType() { + return this.opType; + } + + /** + * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * API name: {@code execution_time_field} + */ + @Nullable + public final String executionTimeField() { + return this.executionTimeField; + } + /** * Serialize this object to JSON. */ @@ -116,16 +154,30 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("refresh"); this.refresh.serialize(generator, mapper); } + if (this.opType != null) { + generator.writeKey("op_type"); + this.opType.serialize(generator, mapper); + } + if (this.timeout != null) { + generator.writeKey("timeout"); + this.timeout.serialize(generator, mapper); + + } + if (this.executionTimeField != null) { + generator.writeKey("execution_time_field"); + generator.write(this.executionTimeField); + + } } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Index}. + * Builder for {@link IndexAction}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String index; @Nullable @@ -134,6 +186,15 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder> fn) { + return this.timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code execution_time_field} + */ + public final Builder executionTimeField(@Nullable String value) { + this.executionTimeField = value; + return this; + } + + /** + * Builds a {@link IndexAction}. * * @throws NullPointerException * if some of the required fields are null. */ - public Index build() { + public IndexAction build() { _checkSingleUse(); - return new Index(this); + return new IndexAction(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Index} + * Json deserializer for {@link IndexAction} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Index::setupIndexDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + IndexAction::setupIndexActionDeserializer); - protected static void setupIndexDeserializer(ObjectDeserializer op) { + protected static void setupIndexActionDeserializer(ObjectDeserializer op) { op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::docId, JsonpDeserializer.stringDeserializer(), "doc_id"); op.add(Builder::refresh, Refresh._DESERIALIZER, "refresh"); + op.add(Builder::opType, OpType._DESERIALIZER, "op_type"); + op.add(Builder::timeout, Time._DESERIALIZER, "timeout"); + op.add(Builder::executionTimeField, JsonpDeserializer.stringDeserializer(), "execution_time_field"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Logging.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/LoggingAction.java similarity index 85% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Logging.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/LoggingAction.java index c76d28480..53ffc70fd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Logging.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/LoggingAction.java @@ -38,15 +38,15 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: watcher._types.Logging +// typedef: watcher._types.LoggingAction /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class Logging implements JsonpSerializable { +public class LoggingAction implements JsonpSerializable { @Nullable private final String level; @@ -57,7 +57,7 @@ public class Logging implements JsonpSerializable { // --------------------------------------------------------------------------------------------- - private Logging(Builder builder) { + private LoggingAction(Builder builder) { this.level = builder.level; this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text"); @@ -65,7 +65,7 @@ private Logging(Builder builder) { } - public static Logging of(Function> fn) { + public static LoggingAction of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -122,10 +122,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Logging}. + * Builder for {@link LoggingAction}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private String level; @@ -159,27 +159,27 @@ public final Builder category(@Nullable String value) { } /** - * Builds a {@link Logging}. + * Builds a {@link LoggingAction}. * * @throws NullPointerException * if some of the required fields are null. */ - public Logging build() { + public LoggingAction build() { _checkSingleUse(); - return new Logging(this); + return new LoggingAction(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Logging} + * Json deserializer for {@link LoggingAction} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Logging::setupLoggingDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + LoggingAction::setupLoggingActionDeserializer); - protected static void setupLoggingDeserializer(ObjectDeserializer op) { + protected static void setupLoggingActionDeserializer(ObjectDeserializer op) { op.add(Builder::level, JsonpDeserializer.stringDeserializer(), "level"); op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyAction.java new file mode 100644 index 000000000..38000ecab --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyAction.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: watcher._types.PagerDutyAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PagerDutyAction extends PagerDutyEvent { + // --------------------------------------------------------------------------------------------- + + private PagerDutyAction(Builder builder) { + super(builder); + + } + + public static PagerDutyAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PagerDutyAction}. + */ + + public static class Builder extends PagerDutyEvent.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PagerDutyAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PagerDutyAction build() { + _checkSingleUse(); + + return new PagerDutyAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PagerDutyAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PagerDutyAction::setupPagerDutyActionDeserializer); + + protected static void setupPagerDutyActionDeserializer(ObjectDeserializer op) { + PagerDutyEvent.setupPagerDutyEventDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyActionEventResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyActionEventResult.java deleted file mode 100644 index 143f55c56..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyActionEventResult.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.watcher; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: watcher._types.PagerDutyActionEventResult - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PagerDutyActionEventResult implements JsonpSerializable { - private final PagerDutyEvent event; - - private final String reason; - - private final HttpInputRequestResult request; - - private final HttpInputResponseResult response; - - // --------------------------------------------------------------------------------------------- - - private PagerDutyActionEventResult(Builder builder) { - - this.event = ApiTypeHelper.requireNonNull(builder.event, this, "event"); - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); - this.request = ApiTypeHelper.requireNonNull(builder.request, this, "request"); - this.response = ApiTypeHelper.requireNonNull(builder.response, this, "response"); - - } - - public static PagerDutyActionEventResult of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code event} - */ - public final PagerDutyEvent event() { - return this.event; - } - - /** - * Required - API name: {@code reason} - */ - public final String reason() { - return this.reason; - } - - /** - * Required - API name: {@code request} - */ - public final HttpInputRequestResult request() { - return this.request; - } - - /** - * Required - API name: {@code response} - */ - public final HttpInputResponseResult response() { - return this.response; - } - - /** - * 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("event"); - this.event.serialize(generator, mapper); - - generator.writeKey("reason"); - generator.write(this.reason); - - generator.writeKey("request"); - this.request.serialize(generator, mapper); - - generator.writeKey("response"); - this.response.serialize(generator, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PagerDutyActionEventResult}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private PagerDutyEvent event; - - private String reason; - - private HttpInputRequestResult request; - - private HttpInputResponseResult response; - - /** - * Required - API name: {@code event} - */ - public final Builder event(PagerDutyEvent value) { - this.event = value; - return this; - } - - /** - * Required - API name: {@code event} - */ - public final Builder event(Function> fn) { - return this.event(fn.apply(new PagerDutyEvent.Builder()).build()); - } - - /** - * Required - API name: {@code reason} - */ - public final Builder reason(String value) { - this.reason = value; - return this; - } - - /** - * Required - API name: {@code request} - */ - public final Builder request(HttpInputRequestResult value) { - this.request = value; - return this; - } - - /** - * Required - API name: {@code request} - */ - public final Builder request( - Function> fn) { - return this.request(fn.apply(new HttpInputRequestResult.Builder()).build()); - } - - /** - * Required - API name: {@code response} - */ - public final Builder response(HttpInputResponseResult value) { - this.response = value; - return this; - } - - /** - * Required - API name: {@code response} - */ - public final Builder response( - Function> fn) { - return this.response(fn.apply(new HttpInputResponseResult.Builder()).build()); - } - - /** - * Builds a {@link PagerDutyActionEventResult}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PagerDutyActionEventResult build() { - _checkSingleUse(); - - return new PagerDutyActionEventResult(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PagerDutyActionEventResult} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PagerDutyActionEventResult::setupPagerDutyActionEventResultDeserializer); - - protected static void setupPagerDutyActionEventResultDeserializer( - ObjectDeserializer op) { - - op.add(Builder::event, PagerDutyEvent._DESERIALIZER, "event"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); - op.add(Builder::request, HttpInputRequestResult._DESERIALIZER, "request"); - op.add(Builder::response, HttpInputResponseResult._DESERIALIZER, "response"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEvent.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEvent.java index f108fa7dc..bafadb6a1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEvent.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEvent.java @@ -49,6 +49,7 @@ */ @JsonpDeserializable public class PagerDutyEvent implements JsonpSerializable { + @Nullable private final String account; private final boolean attachPayload; @@ -61,7 +62,6 @@ public class PagerDutyEvent implements JsonpSerializable { private final List contexts; - @Nullable private final String description; @Nullable @@ -69,28 +69,33 @@ public class PagerDutyEvent implements JsonpSerializable { private final String incidentKey; + @Nullable + private final PagerDutyEventProxy proxy; + // --------------------------------------------------------------------------------------------- - private PagerDutyEvent(Builder builder) { + protected PagerDutyEvent(AbstractBuilder builder) { - this.account = ApiTypeHelper.requireNonNull(builder.account, this, "account"); + this.account = builder.account; this.attachPayload = ApiTypeHelper.requireNonNull(builder.attachPayload, this, "attachPayload"); this.client = builder.client; this.clientUrl = builder.clientUrl; - this.contexts = ApiTypeHelper.unmodifiableRequired(builder.contexts, this, "contexts"); - this.description = builder.description; + this.contexts = ApiTypeHelper.unmodifiable(builder.contexts); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); this.eventType = builder.eventType; this.incidentKey = ApiTypeHelper.requireNonNull(builder.incidentKey, this, "incidentKey"); + this.proxy = builder.proxy; } - public static PagerDutyEvent of(Function> fn) { + public static PagerDutyEvent pagerDutyEventOf(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code account} + * API name: {@code account} */ + @Nullable public final String account() { return this.account; } @@ -119,16 +124,15 @@ public final String clientUrl() { } /** - * Required - API name: {@code contexts} + * API name: {@code contexts} */ public final List contexts() { return this.contexts; } /** - * API name: {@code description} + * Required - API name: {@code description} */ - @Nullable public final String description() { return this.description; } @@ -148,6 +152,14 @@ public final String incidentKey() { return this.incidentKey; } + /** + * API name: {@code proxy} + */ + @Nullable + public final PagerDutyEventProxy proxy() { + return this.proxy; + } + /** * Serialize this object to JSON. */ @@ -159,9 +171,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("account"); - generator.write(this.account); + if (this.account != null) { + generator.writeKey("account"); + generator.write(this.account); + } generator.writeKey("attach_payload"); generator.write(this.attachPayload); @@ -185,11 +199,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); + generator.writeKey("description"); + generator.write(this.description); - } if (this.eventType != null) { generator.writeKey("event_type"); this.eventType.serialize(generator, mapper); @@ -197,6 +209,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("incident_key"); generator.write(this.incidentKey); + if (this.proxy != null) { + generator.writeKey("proxy"); + this.proxy.serialize(generator, mapper); + + } + } // --------------------------------------------------------------------------------------------- @@ -205,7 +223,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link PagerDutyEvent}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends PagerDutyEvent.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PagerDutyEvent}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PagerDutyEvent build() { + _checkSingleUse(); + + return new PagerDutyEvent(this); + } + } + + protected abstract static class AbstractBuilder> + extends + ObjectBuilderBase { + @Nullable private String account; private Boolean attachPayload; @@ -216,9 +258,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

contexts; - @Nullable private String description; @Nullable @@ -226,102 +268,111 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

* Adds all elements of list to contexts. */ - public final Builder contexts(List list) { + public final BuilderT contexts(List list) { this.contexts = _listAddAll(this.contexts, list); - return this; + return self(); } /** - * Required - API name: {@code contexts} + * API name: {@code contexts} *

* Adds one or more values to contexts. */ - public final Builder contexts(PagerDutyContext value, PagerDutyContext... values) { + public final BuilderT contexts(PagerDutyContext value, PagerDutyContext... values) { this.contexts = _listAdd(this.contexts, value, values); - return this; + return self(); } /** - * Required - API name: {@code contexts} + * API name: {@code contexts} *

* Adds a value to contexts using a builder lambda. */ - public final Builder contexts(Function> fn) { + public final BuilderT contexts(Function> fn) { return contexts(fn.apply(new PagerDutyContext.Builder()).build()); } /** - * API name: {@code description} + * Required - API name: {@code description} */ - public final Builder description(@Nullable String value) { + public final BuilderT description(String value) { this.description = value; - return this; + return self(); } /** * API name: {@code event_type} */ - public final Builder eventType(@Nullable PagerDutyEventType value) { + public final BuilderT eventType(@Nullable PagerDutyEventType value) { this.eventType = value; - return this; + return self(); } /** * Required - API name: {@code incident_key} */ - public final Builder incidentKey(String value) { + public final BuilderT incidentKey(String value) { this.incidentKey = value; - return this; + return self(); } /** - * Builds a {@link PagerDutyEvent}. - * - * @throws NullPointerException - * if some of the required fields are null. + * API name: {@code proxy} */ - public PagerDutyEvent build() { - _checkSingleUse(); + public final BuilderT proxy(@Nullable PagerDutyEventProxy value) { + this.proxy = value; + return self(); + } - return new PagerDutyEvent(this); + /** + * API name: {@code proxy} + */ + public final BuilderT proxy(Function> fn) { + return this.proxy(fn.apply(new PagerDutyEventProxy.Builder()).build()); } + + protected abstract BuilderT self(); + } // --------------------------------------------------------------------------------------------- @@ -332,16 +383,19 @@ public PagerDutyEvent build() { public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, PagerDutyEvent::setupPagerDutyEventDeserializer); - protected static void setupPagerDutyEventDeserializer(ObjectDeserializer op) { - - op.add(Builder::account, JsonpDeserializer.stringDeserializer(), "account"); - op.add(Builder::attachPayload, JsonpDeserializer.booleanDeserializer(), "attach_payload"); - op.add(Builder::client, JsonpDeserializer.stringDeserializer(), "client"); - op.add(Builder::clientUrl, JsonpDeserializer.stringDeserializer(), "client_url"); - op.add(Builder::contexts, JsonpDeserializer.arrayDeserializer(PagerDutyContext._DESERIALIZER), "contexts"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::eventType, PagerDutyEventType._DESERIALIZER, "event_type"); - op.add(Builder::incidentKey, JsonpDeserializer.stringDeserializer(), "incident_key"); + protected static > void setupPagerDutyEventDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::account, JsonpDeserializer.stringDeserializer(), "account"); + op.add(AbstractBuilder::attachPayload, JsonpDeserializer.booleanDeserializer(), "attach_payload"); + op.add(AbstractBuilder::client, JsonpDeserializer.stringDeserializer(), "client"); + op.add(AbstractBuilder::clientUrl, JsonpDeserializer.stringDeserializer(), "client_url"); + op.add(AbstractBuilder::contexts, JsonpDeserializer.arrayDeserializer(PagerDutyContext._DESERIALIZER), + "contexts", "context"); + op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(AbstractBuilder::eventType, PagerDutyEventType._DESERIALIZER, "event_type"); + op.add(AbstractBuilder::incidentKey, JsonpDeserializer.stringDeserializer(), "incident_key"); + op.add(AbstractBuilder::proxy, PagerDutyEventProxy._DESERIALIZER, "proxy"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionWebhook.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEventProxy.java similarity index 66% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionWebhook.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEventProxy.java index b5fb6a856..10cd73062 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionWebhook.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/PagerDutyEventProxy.java @@ -29,7 +29,6 @@ import co.elastic.clients.json.JsonpSerializable; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -39,43 +38,48 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: watcher._types.ActionWebhook +// typedef: watcher._types.PagerDutyEventProxy /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ActionWebhook implements JsonpSerializable { +public class PagerDutyEventProxy implements JsonpSerializable { + @Nullable private final String host; - private final int port; + @Nullable + private final Integer port; // --------------------------------------------------------------------------------------------- - private ActionWebhook(Builder builder) { + private PagerDutyEventProxy(Builder builder) { - this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host"); - this.port = ApiTypeHelper.requireNonNull(builder.port, this, "port"); + this.host = builder.host; + this.port = builder.port; } - public static ActionWebhook of(Function> fn) { + public static PagerDutyEventProxy of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code host} + * API name: {@code host} */ + @Nullable public final String host() { return this.host; } /** - * Required - API name: {@code port} + * API name: {@code port} */ - public final int port() { + @Nullable + public final Integer port() { return this.port; } @@ -90,63 +94,70 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("host"); - generator.write(this.host); + if (this.host != null) { + generator.writeKey("host"); + generator.write(this.host); - generator.writeKey("port"); - generator.write(this.port); + } + if (this.port != null) { + generator.writeKey("port"); + generator.write(this.port); + + } } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ActionWebhook}. + * Builder for {@link PagerDutyEventProxy}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private String host; + @Nullable private Integer port; /** - * Required - API name: {@code host} + * API name: {@code host} */ - public final Builder host(String value) { + public final Builder host(@Nullable String value) { this.host = value; return this; } /** - * Required - API name: {@code port} + * API name: {@code port} */ - public final Builder port(int value) { + public final Builder port(@Nullable Integer value) { this.port = value; return this; } /** - * Builds a {@link ActionWebhook}. + * Builds a {@link PagerDutyEventProxy}. * * @throws NullPointerException * if some of the required fields are null. */ - public ActionWebhook build() { + public PagerDutyEventProxy build() { _checkSingleUse(); - return new ActionWebhook(this); + return new PagerDutyEventProxy(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ActionWebhook} + * Json deserializer for {@link PagerDutyEventProxy} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ActionWebhook::setupActionWebhookDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PagerDutyEventProxy::setupPagerDutyEventProxyDeserializer); - protected static void setupActionWebhookDeserializer(ObjectDeserializer op) { + protected static void setupPagerDutyEventProxyDeserializer(ObjectDeserializer op) { op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host"); op.add(Builder::port, JsonpDeserializer.integerDeserializer(), "port"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ReportingEmailAttachment.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ReportingEmailAttachment.java new file mode 100644 index 000000000..a3f73690f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ReportingEmailAttachment.java @@ -0,0 +1,276 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: watcher._types.ReportingEmailAttachment + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ReportingEmailAttachment implements EmailAttachmentVariant, JsonpSerializable { + private final String url; + + @Nullable + private final Boolean inline; + + @Nullable + private final Integer retries; + + @Nullable + private final Time interval; + + @Nullable + private final HttpInputRequestDefinition request; + + // --------------------------------------------------------------------------------------------- + + private ReportingEmailAttachment(Builder builder) { + + this.url = ApiTypeHelper.requireNonNull(builder.url, this, "url"); + this.inline = builder.inline; + this.retries = builder.retries; + this.interval = builder.interval; + this.request = builder.request; + + } + + public static ReportingEmailAttachment of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * EmailAttachment variant kind. + */ + @Override + public EmailAttachment.Kind _emailAttachmentKind() { + return EmailAttachment.Kind.Reporting; + } + + /** + * Required - API name: {@code url} + */ + public final String url() { + return this.url; + } + + /** + * API name: {@code inline} + */ + @Nullable + public final Boolean inline() { + return this.inline; + } + + /** + * API name: {@code retries} + */ + @Nullable + public final Integer retries() { + return this.retries; + } + + /** + * API name: {@code interval} + */ + @Nullable + public final Time interval() { + return this.interval; + } + + /** + * API name: {@code request} + */ + @Nullable + public final HttpInputRequestDefinition request() { + return this.request; + } + + /** + * 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("url"); + generator.write(this.url); + + if (this.inline != null) { + generator.writeKey("inline"); + generator.write(this.inline); + + } + if (this.retries != null) { + generator.writeKey("retries"); + generator.write(this.retries); + + } + if (this.interval != null) { + generator.writeKey("interval"); + this.interval.serialize(generator, mapper); + + } + if (this.request != null) { + generator.writeKey("request"); + this.request.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ReportingEmailAttachment}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String url; + + @Nullable + private Boolean inline; + + @Nullable + private Integer retries; + + @Nullable + private Time interval; + + @Nullable + private HttpInputRequestDefinition request; + + /** + * Required - API name: {@code url} + */ + public final Builder url(String value) { + this.url = value; + return this; + } + + /** + * API name: {@code inline} + */ + public final Builder inline(@Nullable Boolean value) { + this.inline = value; + return this; + } + + /** + * API name: {@code retries} + */ + public final Builder retries(@Nullable Integer value) { + this.retries = value; + return this; + } + + /** + * API name: {@code interval} + */ + public final Builder interval(@Nullable Time value) { + this.interval = value; + return this; + } + + /** + * API name: {@code interval} + */ + public final Builder interval(Function> fn) { + return this.interval(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code request} + */ + public final Builder request(@Nullable HttpInputRequestDefinition value) { + this.request = value; + return this; + } + + /** + * API name: {@code request} + */ + public final Builder request( + Function> fn) { + return this.request(fn.apply(new HttpInputRequestDefinition.Builder()).build()); + } + + /** + * Builds a {@link ReportingEmailAttachment}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ReportingEmailAttachment build() { + _checkSingleUse(); + + return new ReportingEmailAttachment(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ReportingEmailAttachment} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ReportingEmailAttachment::setupReportingEmailAttachmentDeserializer); + + protected static void setupReportingEmailAttachmentDeserializer( + ObjectDeserializer op) { + + op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); + op.add(Builder::inline, JsonpDeserializer.booleanDeserializer(), "inline"); + op.add(Builder::retries, JsonpDeserializer.integerDeserializer(), "retries"); + op.add(Builder::interval, Time._DESERIALIZER, "interval"); + op.add(Builder::request, HttpInputRequestDefinition._DESERIALIZER, "request"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScriptCondition.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScriptCondition.java index e259f7ac8..717b20401 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScriptCondition.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScriptCondition.java @@ -49,19 +49,25 @@ */ @JsonpDeserializable public class ScriptCondition implements ConditionVariant, JsonpSerializable { + @Nullable private final String lang; private final Map params; + @Nullable private final String source; + @Nullable + private final String id; + // --------------------------------------------------------------------------------------------- private ScriptCondition(Builder builder) { - this.lang = ApiTypeHelper.requireNonNull(builder.lang, this, "lang"); + this.lang = builder.lang; this.params = ApiTypeHelper.unmodifiable(builder.params); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.source = builder.source; + this.id = builder.id; } @@ -78,8 +84,9 @@ public Condition.Kind _conditionKind() { } /** - * Required - API name: {@code lang} + * API name: {@code lang} */ + @Nullable public final String lang() { return this.lang; } @@ -92,12 +99,21 @@ public final Map params() { } /** - * Required - API name: {@code source} + * API name: {@code source} */ + @Nullable public final String source() { return this.source; } + /** + * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + /** * Serialize this object to JSON. */ @@ -109,9 +125,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("lang"); - generator.write(this.lang); + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + } if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); generator.writeStartObject(); @@ -123,8 +141,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("source"); - generator.write(this.source); + if (this.source != null) { + generator.writeKey("source"); + generator.write(this.source); + + } + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } } @@ -135,17 +161,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private String lang; @Nullable private Map params; + @Nullable private String source; + @Nullable + private String id; + /** - * Required - API name: {@code lang} + * API name: {@code lang} */ - public final Builder lang(String value) { + public final Builder lang(@Nullable String value) { this.lang = value; return this; } @@ -171,13 +202,21 @@ public final Builder params(String key, JsonData value) { } /** - * Required - API name: {@code source} + * API name: {@code source} */ - public final Builder source(String value) { + public final Builder source(@Nullable String value) { this.source = value; return this; } + /** + * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + /** * Builds a {@link ScriptCondition}. * @@ -204,6 +243,7 @@ protected static void setupScriptConditionDeserializer(ObjectDeserializer