From bd77f0dcd01d31518ce199b689c6fa7003b2506a Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 8 Jan 2025 10:30:16 +1300 Subject: [PATCH] Generate ingest namespace (#1375) * Generate ingest.delete_pipeline Signed-off-by: Thomas Farr * Remove ingest.geo_ip_stats Signed-off-by: Thomas Farr * Generate ingest.get_pipeline Signed-off-by: Thomas Farr * Generate ingest.processor_grok Signed-off-by: Thomas Farr * Generate ingest.put_pipeline Signed-off-by: Thomas Farr * Generate ingest.simulate Signed-off-by: Thomas Farr * Simplify filtering Signed-off-by: Thomas Farr * Fix build Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- CHANGELOG.md | 1 + UPGRADING.md | 12 +- .../opensearch/OpenSearchAsyncClientBase.java | 5 + .../opensearch/OpenSearchClientBase.java | 5 + .../_types/ActionStatusOptions.java | 69 ++ .../client/opensearch/_types/Script.java | 12 +- .../opensearch/ingest/AppendProcessor.java | 199 +++-- .../ingest/AttachmentProcessor.java | 218 +++-- .../opensearch/ingest/BytesProcessor.java | 113 ++- .../opensearch/ingest/CircleProcessor.java | 175 +++- .../opensearch/ingest/ConvertProcessor.java | 140 ++- .../client/opensearch/ingest/ConvertType.java | 22 +- .../opensearch/ingest/CsvProcessor.java | 243 ++++-- .../ingest/DateIndexNameProcessor.java | 462 ++++++++++ .../opensearch/ingest/DateProcessor.java | 171 +++- .../ingest/DeletePipelineRequest.java | 233 +++-- .../ingest/DeletePipelineResponse.java | 72 +- .../opensearch/ingest/DissectProcessor.java | 178 +++- .../ingest/DotExpanderProcessor.java | 107 ++- .../opensearch/ingest/DropProcessor.java | 68 +- .../opensearch/ingest/FailProcessor.java | 99 ++- .../opensearch/ingest/ForeachProcessor.java | 120 ++- .../opensearch/ingest/GeoIpProcessor.java | 413 +++++++++ .../opensearch/ingest/GetPipelineRequest.java | 220 ++--- .../ingest/GetPipelineResponse.java | 19 +- .../opensearch/ingest/GrokProcessor.java | 204 ++++- .../opensearch/ingest/GsubProcessor.java | 149 +++- .../opensearch/ingest/JoinProcessor.java | 117 ++- .../opensearch/ingest/JsonProcessor.java | 343 ++++++++ .../ingest/JsonProcessorConflictStrategy.java | 65 ++ .../opensearch/ingest/KeyValueProcessor.java | 261 +++++- .../opensearch/ingest/LowercaseProcessor.java | 118 ++- .../ingest/OpenSearchIngestAsyncClient.java | 129 +-- .../ingest/OpenSearchIngestClient.java | 124 +-- .../client/opensearch/ingest/Pipeline.java | 204 ++++- .../opensearch/ingest/PipelineProcessor.java | 132 ++- .../client/opensearch/ingest/Processor.java | 801 ++++++++---------- .../opensearch/ingest/ProcessorBase.java | 151 +++- .../opensearch/ingest/ProcessorBuilders.java | 223 +++-- .../ingest/ProcessorGrokRequest.java | 186 ++++ .../ingest/ProcessorGrokResponse.java | 97 ++- .../opensearch/ingest/ProcessorVariant.java | 11 +- .../opensearch/ingest/PutPipelineRequest.java | 361 +++++--- .../ingest/PutPipelineResponse.java | 70 +- .../opensearch/ingest/RemoveProcessor.java | 127 ++- .../opensearch/ingest/RenameProcessor.java | 115 ++- .../opensearch/ingest/SetProcessor.java | 392 +++++++++ .../ingest/SetSecurityUserProcessor.java | 118 ++- .../client/opensearch/ingest/ShapeType.java | 12 +- .../opensearch/ingest/SimulateRequest.java | 156 +++- .../opensearch/ingest/SimulateResponse.java | 93 +- .../opensearch/ingest/SortProcessor.java | 136 ++- .../opensearch/ingest/SplitProcessor.java | 143 +++- .../ingest/TextEmbeddingProcessor.java | 244 ++++-- .../opensearch/ingest/TrimProcessor.java | 111 ++- .../opensearch/ingest/UppercaseProcessor.java | 116 ++- .../opensearch/ingest/UrlDecodeProcessor.java | 116 ++- .../opensearch/ingest/UserAgentProcessor.java | 205 ++++- .../opensearch/ingest/UserAgentProperty.java | 22 +- .../opensearch/ingest/simulate/Document.java | 96 ++- .../ingest/simulate/DocumentSimulation.java | 242 ++++-- .../opensearch/ingest/simulate/Ingest.java | 116 ++- .../ingest/simulate/PipelineSimulation.java | 168 +++- .../opensearch/OpenSearchAsyncClient.java | 5 - .../client/opensearch/OpenSearchClient.java | 5 - .../ingest/DateIndexNameProcessor.java | 314 ------- .../opensearch/ingest/GeoIpProcessor.java | 278 ------ .../opensearch/ingest/GeoIpStatsRequest.java | 84 -- .../opensearch/ingest/GeoIpStatsResponse.java | 212 ----- .../opensearch/ingest/InferenceConfig.java | 147 ---- .../ingest/InferenceConfigRegression.java | 134 --- .../opensearch/ingest/InferenceProcessor.java | 247 ------ .../opensearch/ingest/JsonProcessor.java | 186 ---- .../ingest/ProcessorGrokRequest.java | 84 -- .../opensearch/ingest/SetProcessor.java | 193 ----- .../geo_ip_stats/GeoIpDownloadStatistics.java | 250 ------ .../geo_ip_stats/GeoIpNodeDatabaseName.java | 138 --- .../geo_ip_stats/GeoIpNodeDatabases.java | 231 ----- .../ingest/TextEmbeddingProcessorTest.java | 19 +- .../client/codegen/CodeGenerator.java | 1 + .../codegen/model/overrides/Overrides.java | 2 + .../client/codegen/utils/NameSanitizer.java | 1 + 82 files changed, 7594 insertions(+), 4787 deletions(-) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/ActionStatusOptions.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/BytesProcessor.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/CircleProcessor.java (54%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ConvertProcessor.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ConvertType.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java (58%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DateProcessor.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DeletePipelineRequest.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java (52%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/DropProcessor.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/FailProcessor.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java (64%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GeoIpProcessor.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/GsubProcessor.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/JoinProcessor.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessorConflictStrategy.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/LowercaseProcessor.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/Pipeline.java (58%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java (52%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/Processor.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java (85%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/RenameProcessor.java (64%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SetProcessor.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/ShapeType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/SimulateResponse.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/SortProcessor.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/SplitProcessor.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessor.java (52%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/UppercaseProcessor.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/UrlDecodeProcessor.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/UserAgentProcessor.java (51%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/UserAgentProperty.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/simulate/Document.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java (57%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java (73%) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpProcessor.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfig.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfigRegression.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceProcessor.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetProcessor.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabaseName.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabases.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6533ddb7..f2ae271506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed - Removed the `features` and `shutdown` namespaces as they're not supported by OpenSearch ([#1361](https://github.com/opensearch-project/opensearch-java/pull/1361)) - Removed the `indices.diskUsage` operation as it's not supported by OpenSearch ([#1361](https://github.com/opensearch-project/opensearch-java/pull/1361)) +- Removed the `ingest.geoIpStats` operation as it's not supported by OpenSearch ([#]()) ### Fixed - Fix version and build ([#254](https://github.com/opensearch-project/opensearch-java/pull/254)) diff --git a/UPGRADING.md b/UPGRADING.md index 1d3b165111..21219502b2 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -426,4 +426,14 @@ After: ### NodeUsage - The `restActions` property has been corrected to be of type `Map` instead of `Map`. -- The `since` and `timestamp` properties have been corrected to be of type `long` instead of `String`. \ No newline at end of file +- The `since` and `timestamp` properties have been corrected to be of type `long` instead of `String`. + +### GetPipelineRequest +- The `summary` property has been removed as it is not supported by OpenSearch. + +### InferenceProcessor +- The `InferenceProcessor` class has been removed as it is not supported by OpenSearch. + - This also affects the associated `InferenceConfig` and `InferenceConfigRegression` classes. + +### DocumentSimulation +- The `type` property has been removed as it is no longer supported by OpenSearch. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index a5bed7c9f6..d9ba1b3596 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -47,6 +47,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesAsyncClient; +import org.opensearch.client.opensearch.ingest.OpenSearchIngestAsyncClient; import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; import org.opensearch.client.opensearch.nodes.OpenSearchNodesAsyncClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; @@ -77,6 +78,10 @@ public OpenSearchIndicesAsyncClient indices() { return new OpenSearchIndicesAsyncClient(this.transport, this.transportOptions); } + public OpenSearchIngestAsyncClient ingest() { + return new OpenSearchIngestAsyncClient(this.transport, this.transportOptions); + } + public OpenSearchMlAsyncClient ml() { return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index 0a85bee629..1269efecaf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -46,6 +46,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesClient; +import org.opensearch.client.opensearch.ingest.OpenSearchIngestClient; import org.opensearch.client.opensearch.ml.OpenSearchMlClient; import org.opensearch.client.opensearch.nodes.OpenSearchNodesClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; @@ -76,6 +77,10 @@ public OpenSearchIndicesClient indices() { return new OpenSearchIndicesClient(this.transport, this.transportOptions); } + public OpenSearchIngestClient ingest() { + return new OpenSearchIngestClient(this.transport, this.transportOptions); + } + public OpenSearchMlClient ml() { return new OpenSearchMlClient(this.transport, this.transportOptions); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ActionStatusOptions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ActionStatusOptions.java new file mode 100644 index 0000000000..7fbeab43d7 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ActionStatusOptions.java @@ -0,0 +1,69 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: _types.ActionStatusOptions + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ActionStatusOptions implements JsonEnum { + Failure("failure"), + + Simulated("simulated"), + + Success("success"), + + Throttled("throttled"); + + private final String jsonValue; + + ActionStatusOptions(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ActionStatusOptions.values() + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java index a15e98f626..e616300f1a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java @@ -49,6 +49,8 @@ import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.opensearch._types.query_dsl.IntervalsFilter; import org.opensearch.client.opensearch._types.query_dsl.IntervalsFilterVariant; +import org.opensearch.client.opensearch.ingest.Processor; +import org.opensearch.client.opensearch.ingest.ProcessorVariant; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -59,7 +61,7 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class Script implements TaggedUnion, IntervalsFilterVariant, PlainJsonSerializable { +public class Script implements TaggedUnion, IntervalsFilterVariant, ProcessorVariant, PlainJsonSerializable { /** * {@link Script} variant kinds. */ @@ -76,6 +78,14 @@ public IntervalsFilter.Kind _intervalsFilterKind() { return IntervalsFilter.Kind.Script; } + /** + * {@link Processor} variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Script; + } + private final Kind _kind; private final Object _value; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java index 6b71e07008..0de8faedd1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AppendProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -43,149 +50,207 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.AppendProcessor +// typedef: ingest.AppendProcessor @JsonpDeserializable -public class AppendProcessor extends ProcessorBase implements ProcessorVariant { - private final String field; - - private final List value; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AppendProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { @Nullable private final Boolean allowDuplicates; + @Nonnull + private final String field; + + @Nonnull + private final List value; + // --------------------------------------------------------------------------------------------- private AppendProcessor(Builder builder) { super(builder); - + this.allowDuplicates = builder.allowDuplicates; this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.value = ApiTypeHelper.unmodifiableRequired(builder.value, this, "value"); - this.allowDuplicates = builder.allowDuplicates; - } - public static AppendProcessor of(Function> fn) { + public static AppendProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { return Processor.Kind.Append; } + /** + * If false, the processor does not append values already present in the field. + *

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

+ */ + @Nullable + public final Boolean allowDuplicates() { + return this.allowDuplicates; + } + /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code value} + * Required - The value to be appended. Supports template snippets. + *

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

*/ + @Nonnull public final List value() { return this.value; } - /** - * API name: {@code allow_duplicates} - */ - @Nullable - public final Boolean allowDuplicates() { - return this.allowDuplicates; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("field"); - generator.write(this.field); - - if (ApiTypeHelper.isDefined(this.value)) { - generator.writeKey("value"); - generator.writeStartArray(); - for (JsonData item0 : this.value) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } if (this.allowDuplicates != null) { generator.writeKey("allow_duplicates"); generator.write(this.allowDuplicates); - } + generator.writeKey("field"); + generator.write(this.field); + + generator.writeKey("value"); + generator.writeStartArray(); + for (JsonData item0 : this.value) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AppendProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Boolean allowDuplicates; private String field; - private List value; - @Nullable - private Boolean allowDuplicates; + public Builder() {} + + private Builder(AppendProcessor o) { + super(o); + this.allowDuplicates = o.allowDuplicates; + this.field = o.field; + this.value = _listCopy(o.value); + } + + private Builder(Builder o) { + super(o); + this.allowDuplicates = o.allowDuplicates; + this.field = o.field; + this.value = _listCopy(o.value); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * If false, the processor does not append values already present in the field. + *

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

+ */ + @Nonnull + public final Builder allowDuplicates(@Nullable Boolean value) { + this.allowDuplicates = value; + return this; + } /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code value} + * Required - The value to be appended. Supports template snippets. + *

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

+ * *

* Adds all elements of list to value. + *

*/ + @Nonnull public final Builder value(List list) { this.value = _listAddAll(this.value, list); return this; } /** - * Required - API name: {@code value} + * Required - The value to be appended. Supports template snippets. + *

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

+ * *

* Adds one or more values to value. + *

*/ + @Nonnull public final Builder value(JsonData value, JsonData... values) { this.value = _listAdd(this.value, value, values); return this; } - /** - * API name: {@code allow_duplicates} - */ - public final Builder allowDuplicates(@Nullable Boolean value) { - this.allowDuplicates = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link AppendProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AppendProcessor build() { _checkSingleUse(); @@ -205,10 +270,30 @@ public AppendProcessor build() { protected static void setupAppendProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); + op.add(Builder::allowDuplicates, JsonpDeserializer.booleanDeserializer(), "allow_duplicates"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::value, JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER), "value"); - op.add(Builder::allowDuplicates, JsonpDeserializer.booleanDeserializer(), "allow_duplicates"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.allowDuplicates); + result = 31 * result + this.field.hashCode(); + result = 31 * result + this.value.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AppendProcessor other = (AppendProcessor) o; + return Objects.equals(this.allowDuplicates, other.allowDuplicates) + && this.field.equals(other.field) + && this.value.equals(other.value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java index 427871a9da..e22a53bab2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/AttachmentProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,12 +49,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.AttachmentProcessor +// typedef: ingest.AttachmentProcessor @JsonpDeserializable -public class AttachmentProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AttachmentProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final String field; @Nullable @@ -59,35 +74,34 @@ public class AttachmentProcessor extends ProcessorBase implements ProcessorVaria @Nullable private final String indexedCharsField; + @Nonnull private final List properties; @Nullable - private final String targetField; + private final String resourceName; @Nullable - private final String resourceName; + private final String targetField; // --------------------------------------------------------------------------------------------- private AttachmentProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.indexedChars = builder.indexedChars; this.indexedCharsField = builder.indexedCharsField; this.properties = ApiTypeHelper.unmodifiable(builder.properties); - this.targetField = builder.targetField; this.resourceName = builder.resourceName; - + this.targetField = builder.targetField; } - public static AttachmentProcessor of(Function> fn) { + public static AttachmentProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -97,12 +111,16 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -110,7 +128,10 @@ public final Boolean ignoreMissing() { } /** + * The number of chars being used for extraction to prevent huge fields. Use -1 for no limit. + *

* API name: {@code indexed_chars} + *

*/ @Nullable public final Long indexedChars() { @@ -126,30 +147,38 @@ public final String indexedCharsField() { } /** + * Array of properties to select to be stored. Can be content, title, name, author, + * keywords, date, content_type, content_length, language. + *

* API name: {@code properties} + *

*/ + @Nonnull public final List properties() { return this.properties; } /** - * API name: {@code target_field} + * Field containing the name of the resource to decode. If specified, the processor passes this resource name to the underlying Tika + * library to enable Resource Name Based Detection. + *

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

*/ @Nullable - public final String targetField() { - return this.targetField; + public final String resourceName() { + return this.resourceName; } /** - * API name: {@code resource_name} + * API name: {@code target_field} */ @Nullable - public final String resourceName() { - return this.resourceName; + public final String targetField() { + return this.targetField; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -157,87 +186,133 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.indexedChars != null) { generator.writeKey("indexed_chars"); generator.write(this.indexedChars); - } + if (this.indexedCharsField != null) { generator.writeKey("indexed_chars_field"); generator.write(this.indexedCharsField); - } + if (ApiTypeHelper.isDefined(this.properties)) { generator.writeKey("properties"); generator.writeStartArray(); for (String item0 : this.properties) { generator.write(item0); - } generator.writeEnd(); - } - if (this.targetField != null) { - generator.writeKey("target_field"); - generator.write(this.targetField); - } if (this.resourceName != null) { generator.writeKey("resource_name"); generator.write(this.resourceName); - } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AttachmentProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private Long indexedChars; - @Nullable private String indexedCharsField; - @Nullable private List properties; - + @Nullable + private String resourceName; @Nullable private String targetField; - @Nullable - private String resourceName; + public Builder() {} + + private Builder(AttachmentProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.indexedChars = o.indexedChars; + this.indexedCharsField = o.indexedCharsField; + this.properties = _listCopy(o.properties); + this.resourceName = o.resourceName; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.indexedChars = o.indexedChars; + this.indexedCharsField = o.indexedCharsField; + this.properties = _listCopy(o.properties); + this.resourceName = o.resourceName; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** + * The number of chars being used for extraction to prevent huge fields. Use -1 for no limit. + *

* API name: {@code indexed_chars} + *

*/ + @Nonnull public final Builder indexedChars(@Nullable Long value) { this.indexedChars = value; return this; @@ -246,58 +321,77 @@ public final Builder indexedChars(@Nullable Long value) { /** * API name: {@code indexed_chars_field} */ + @Nonnull public final Builder indexedCharsField(@Nullable String value) { this.indexedCharsField = value; return this; } /** + * Array of properties to select to be stored. Can be content, title, name, + * author, keywords, date, content_type, content_length, + * language. + *

* API name: {@code properties} + *

+ * *

* Adds all elements of list to properties. + *

*/ + @Nonnull public final Builder properties(List list) { this.properties = _listAddAll(this.properties, list); return this; } /** + * Array of properties to select to be stored. Can be content, title, name, + * author, keywords, date, content_type, content_length, + * language. + *

* API name: {@code properties} + *

+ * *

* Adds one or more values to properties. + *

*/ + @Nonnull public final Builder properties(String value, String... values) { this.properties = _listAdd(this.properties, value, values); return this; } /** - * API name: {@code target_field} - */ - public final Builder targetField(@Nullable String value) { - this.targetField = value; - return this; - } - - /** + * Field containing the name of the resource to decode. If specified, the processor passes this resource name to the underlying Tika + * library to enable Resource Name Based Detection. + *

* API name: {@code resource_name} + *

*/ + @Nonnull public final Builder resourceName(@Nullable String value) { this.resourceName = value; return this; } - @Override - protected Builder self() { + /** + * API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(@Nullable String value) { + this.targetField = value; return this; } /** * Builds a {@link AttachmentProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AttachmentProcessor build() { _checkSingleUse(); @@ -322,9 +416,37 @@ protected static void setupAttachmentProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable @@ -59,19 +71,17 @@ public class BytesProcessor extends ProcessorBase implements ProcessorVariant { private BytesProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = builder.targetField; - } - public static BytesProcessor of(Function> fn) { + public static BytesProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -81,12 +91,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,7 +117,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -110,42 +124,82 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link BytesProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String targetField; + public Builder() {} + + private Builder(BytesProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -154,22 +208,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link BytesProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public BytesProcessor build() { _checkSingleUse(); @@ -192,7 +243,27 @@ protected static void setupBytesProcessorDeserializer(ObjectDeserializer { + private final double errorDistance; + @Nonnull private final String field; - private final boolean ignoreMissing; + @Nullable + private final Boolean ignoreMissing; + @Nonnull private final ShapeType shapeType; + @Nullable private final String targetField; // --------------------------------------------------------------------------------------------- private CircleProcessor(Builder builder) { super(builder); - this.errorDistance = ApiTypeHelper.requireNonNull(builder.errorDistance, this, "errorDistance"); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.ignoreMissing = ApiTypeHelper.requireNonNull(builder.ignoreMissing, this, "ignoreMissing"); + this.ignoreMissing = builder.ignoreMissing; this.shapeType = ApiTypeHelper.requireNonNull(builder.shapeType, this, "shapeType"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - + this.targetField = builder.targetField; } - public static CircleProcessor of(Function> fn) { + public static CircleProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -82,7 +99,11 @@ public Processor.Kind _processorKind() { } /** - * Required - API name: {@code error_distance} + * Required - The difference between the resulting inscribed distance from center to side and the circle's radius (measured in meters + * for geo_shape, unit-less for shape). + *

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

*/ public final double errorDistance() { return this.errorDistance; @@ -91,33 +112,39 @@ public final double errorDistance() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

*/ - public final boolean ignoreMissing() { + @Nullable + public final Boolean ignoreMissing() { return this.ignoreMissing; } /** * Required - API name: {@code shape_type} */ + @Nonnull public final ShapeType shapeType() { return this.shapeType; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ + @Nullable public final String targetField() { return this.targetField; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("error_distance"); generator.write(this.errorDistance); @@ -125,36 +152,85 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("field"); generator.write(this.field); - generator.writeKey("ignore_missing"); - generator.write(this.ignoreMissing); + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + } generator.writeKey("shape_type"); this.shapeType.serialize(generator, mapper); - generator.writeKey("target_field"); - generator.write(this.targetField); + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CircleProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private Double errorDistance; - private String field; - + @Nullable private Boolean ignoreMissing; - private ShapeType shapeType; - + @Nullable private String targetField; + public Builder() {} + + private Builder(CircleProcessor o) { + super(o); + this.errorDistance = o.errorDistance; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.shapeType = o.shapeType; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.errorDistance = o.errorDistance; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.shapeType = o.shapeType; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** - * Required - API name: {@code error_distance} + * Required - The difference between the resulting inscribed distance from center to side and the circle's radius (measured in + * meters for geo_shape, unit-less for shape). + *

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

*/ + @Nonnull public final Builder errorDistance(double value) { this.errorDistance = value; return this; @@ -163,15 +239,20 @@ public final Builder errorDistance(double value) { /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

*/ - public final Builder ignoreMissing(boolean value) { + @Nonnull + public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } @@ -179,30 +260,28 @@ public final Builder ignoreMissing(boolean value) { /** * Required - API name: {@code shape_type} */ + @Nonnull public final Builder shapeType(ShapeType value) { this.shapeType = value; return this; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ - public final Builder targetField(String value) { + @Nonnull + public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link CircleProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CircleProcessor build() { _checkSingleUse(); @@ -227,7 +306,31 @@ protected static void setupCircleProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable private final Boolean ignoreMissing; + @Nullable private final String targetField; + @Nonnull private final ConvertType type; // --------------------------------------------------------------------------------------------- private ConvertProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); + this.targetField = builder.targetField; this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - } - public static ConvertProcessor of(Function> fn) { + public static ConvertProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -83,12 +98,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -96,8 +116,9 @@ public final Boolean ignoreMissing() { } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ + @Nullable public final String targetField() { return this.targetField; } @@ -105,12 +126,12 @@ public final String targetField() { /** * Required - API name: {@code type} */ + @Nonnull public final ConvertType type() { return this.type; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -118,52 +139,98 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); + } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); } - generator.writeKey("target_field"); - generator.write(this.targetField); generator.writeKey("type"); this.type.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ConvertProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - + @Nullable private String targetField; - private ConvertType type; + public Builder() {} + + private Builder(ConvertProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + this.type = o.type; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ - public final Builder targetField(String value) { + @Nonnull + public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } @@ -171,22 +238,19 @@ public final Builder targetField(String value) { /** * Required - API name: {@code type} */ + @Nonnull public final Builder type(ConvertType value) { this.type = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ConvertProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ConvertProcessor build() { _checkSingleUse(); @@ -205,12 +269,34 @@ public ConvertProcessor build() { ); protected static void setupConvertProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); + setupProcessorBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); op.add(Builder::type, ConvertType._DESERIALIZER, "type"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMissing); + result = 31 * result + Objects.hashCode(this.targetField); + result = 31 * result + this.type.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ConvertProcessor other = (ConvertProcessor) o; + return this.field.equals(other.field) + && Objects.equals(this.ignoreMissing, other.ignoreMissing) + && Objects.equals(this.targetField, other.targetField) + && this.type.equals(other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ConvertType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ConvertType.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ConvertType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ConvertType.java index 1a1e98cdb8..2f678401df 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ConvertType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ConvertType.java @@ -30,28 +30,34 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: ingest.ConvertType + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ConvertType implements JsonEnum { - Integer("integer"), - - Long("long"), + Auto("auto"), - Float("float"), + Boolean("boolean"), Double("double"), - String("string"), + Float("float"), - Boolean("boolean"), + Integer("integer"), - Auto("auto"), + Long("long"), - ; + String("string"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java similarity index 58% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java index 95d35ea598..6238add555 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/CsvProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -43,17 +50,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.CsvProcessor +// typedef: ingest.CsvProcessor @JsonpDeserializable -public class CsvProcessor extends ProcessorBase implements ProcessorVariant { - private final JsonData emptyValue; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CsvProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { @Nullable - private final String description; + private final JsonData emptyValue; + @Nonnull private final String field; @Nullable @@ -65,32 +75,31 @@ public class CsvProcessor extends ProcessorBase implements ProcessorVariant { @Nullable private final String separator; + @Nonnull private final List targetFields; - private final boolean trim; + @Nullable + private final Boolean trim; // --------------------------------------------------------------------------------------------- private CsvProcessor(Builder builder) { super(builder); - - this.emptyValue = ApiTypeHelper.requireNonNull(builder.emptyValue, this, "emptyValue"); - this.description = builder.description; + this.emptyValue = builder.emptyValue; this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.quote = builder.quote; this.separator = builder.separator; this.targetFields = ApiTypeHelper.unmodifiableRequired(builder.targetFields, this, "targetFields"); - this.trim = ApiTypeHelper.requireNonNull(builder.trim, this, "trim"); - + this.trim = builder.trim; } - public static CsvProcessor of(Function> fn) { + public static CsvProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -98,29 +107,30 @@ public Processor.Kind _processorKind() { } /** - * Required - API name: {@code empty_value} + * Value used to fill empty fields. Empty fields are skipped if this is not provided. An empty field is one with no value (2 consecutive + * separators) or empty quotes (""). + *

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

*/ + @Nullable public final JsonData emptyValue() { return this.emptyValue; } - /** - * API name: {@code description} - */ - @Nullable - public final String description() { - return this.description; - } - /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -128,7 +138,10 @@ public final Boolean ignoreMissing() { } /** + * Quote used in CSV, has to be single character string. + *

* API name: {@code quote} + *

*/ @Nullable public final String quote() { @@ -136,7 +149,10 @@ public final String quote() { } /** + * Separator used in CSV, has to be single character string. + *

* API name: {@code separator} + *

*/ @Nullable public final String separator() { @@ -146,131 +162,179 @@ public final String separator() { /** * Required - API name: {@code target_fields} */ + @Nonnull public final List targetFields() { return this.targetFields; } /** - * Required - API name: {@code trim} + * Trim white spaces in unquoted fields. + *

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

*/ - public final boolean trim() { + @Nullable + public final Boolean trim() { return this.trim; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("empty_value"); - this.emptyValue.serialize(generator, mapper); - - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - + if (this.emptyValue != null) { + generator.writeKey("empty_value"); + this.emptyValue.serialize(generator, mapper); } + generator.writeKey("field"); generator.write(this.field); if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.quote != null) { generator.writeKey("quote"); generator.write(this.quote); - } + if (this.separator != null) { generator.writeKey("separator"); generator.write(this.separator); - } - if (ApiTypeHelper.isDefined(this.targetFields)) { - generator.writeKey("target_fields"); - generator.writeStartArray(); - for (String item0 : this.targetFields) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("target_fields"); + generator.writeStartArray(); + for (String item0 : this.targetFields) { + generator.write(item0); } - generator.writeKey("trim"); - generator.write(this.trim); + generator.writeEnd(); + if (this.trim != null) { + generator.writeKey("trim"); + generator.write(this.trim); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CsvProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private JsonData emptyValue; - + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { @Nullable - private String description; - + private JsonData emptyValue; private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String quote; - @Nullable private String separator; - private List targetFields; - + @Nullable private Boolean trim; - /** - * Required - API name: {@code empty_value} - */ - public final Builder emptyValue(JsonData value) { - this.emptyValue = value; + public Builder() {} + + private Builder(CsvProcessor o) { + super(o); + this.emptyValue = o.emptyValue; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.quote = o.quote; + this.separator = o.separator; + this.targetFields = _listCopy(o.targetFields); + this.trim = o.trim; + } + + private Builder(Builder o) { + super(o); + this.emptyValue = o.emptyValue; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.quote = o.quote; + this.separator = o.separator; + this.targetFields = _listCopy(o.targetFields); + this.trim = o.trim; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { return this; } /** - * API name: {@code description} + * Value used to fill empty fields. Empty fields are skipped if this is not provided. An empty field is one with no value (2 + * consecutive separators) or empty quotes (""). + *

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

*/ - public final Builder description(@Nullable String value) { - this.description = value; + @Nonnull + public final Builder emptyValue(@Nullable JsonData value) { + this.emptyValue = value; return this; } /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** + * Quote used in CSV, has to be single character string. + *

* API name: {@code quote} + *

*/ + @Nonnull public final Builder quote(@Nullable String value) { this.quote = value; return this; } /** + * Separator used in CSV, has to be single character string. + *

* API name: {@code separator} + *

*/ + @Nonnull public final Builder separator(@Nullable String value) { this.separator = value; return this; @@ -278,9 +342,12 @@ public final Builder separator(@Nullable String value) { /** * Required - API name: {@code target_fields} + * *

* Adds all elements of list to targetFields. + *

*/ + @Nonnull public final Builder targetFields(List list) { this.targetFields = _listAddAll(this.targetFields, list); return this; @@ -288,33 +355,36 @@ public final Builder targetFields(List list) { /** * Required - API name: {@code target_fields} + * *

* Adds one or more values to targetFields. + *

*/ + @Nonnull public final Builder targetFields(String value, String... values) { this.targetFields = _listAdd(this.targetFields, value, values); return this; } /** - * Required - API name: {@code trim} + * Trim white spaces in unquoted fields. + *

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

*/ - public final Builder trim(boolean value) { + @Nonnull + public final Builder trim(@Nullable Boolean value) { this.trim = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link CsvProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CsvProcessor build() { _checkSingleUse(); @@ -335,14 +405,41 @@ public CsvProcessor build() { protected static void setupCsvProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); op.add(Builder::emptyValue, JsonData._DESERIALIZER, "empty_value"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); op.add(Builder::quote, JsonpDeserializer.stringDeserializer(), "quote"); op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator"); op.add(Builder::targetFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "target_fields"); op.add(Builder::trim, JsonpDeserializer.booleanDeserializer(), "trim"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.emptyValue); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMissing); + result = 31 * result + Objects.hashCode(this.quote); + result = 31 * result + Objects.hashCode(this.separator); + result = 31 * result + this.targetFields.hashCode(); + result = 31 * result + Objects.hashCode(this.trim); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CsvProcessor other = (CsvProcessor) o; + return Objects.equals(this.emptyValue, other.emptyValue) + && this.field.equals(other.field) + && Objects.equals(this.ignoreMissing, other.ignoreMissing) + && Objects.equals(this.quote, other.quote) + && Objects.equals(this.separator, other.separator) + && this.targetFields.equals(other.targetFields) + && Objects.equals(this.trim, other.trim); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java new file mode 100644 index 0000000000..29f75ea8be --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java @@ -0,0 +1,462 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ingest; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ingest.DateIndexNameProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DateIndexNameProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull + private final List dateFormats; + + @Nonnull + private final String dateRounding; + + @Nonnull + private final String field; + + @Nullable + private final String indexNameFormat; + + @Nullable + private final String indexNamePrefix; + + @Nullable + private final String locale; + + @Nullable + private final String timezone; + + // --------------------------------------------------------------------------------------------- + + private DateIndexNameProcessor(Builder builder) { + super(builder); + this.dateFormats = ApiTypeHelper.unmodifiableRequired(builder.dateFormats, this, "dateFormats"); + this.dateRounding = ApiTypeHelper.requireNonNull(builder.dateRounding, this, "dateRounding"); + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.indexNameFormat = builder.indexNameFormat; + this.indexNamePrefix = builder.indexNamePrefix; + this.locale = builder.locale; + this.timezone = builder.timezone; + } + + public static DateIndexNameProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Processor} variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.DateIndexName; + } + + /** + * Required - An array of the expected date formats for parsing dates/timestamps in the document being preprocessed. Can be a java time + * pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. + *

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

+ */ + @Nonnull + public final List dateFormats() { + return this.dateFormats; + } + + /** + * Required - How to round the date when formatting the date into the index name. Valid values are: y (year), + * M (month), w (week), d (day), h (hour), m (minute) and + * s (second). Supports template snippets. + *

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

+ */ + @Nonnull + public final String dateRounding() { + return this.dateRounding; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * The format to be used when printing the parsed date into the index name. A valid java time pattern is expected here. Supports + * template snippets. + *

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

+ */ + @Nullable + public final String indexNameFormat() { + return this.indexNameFormat; + } + + /** + * A prefix of the index name to be prepended before the printed date. Supports template snippets. + *

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

+ */ + @Nullable + public final String indexNamePrefix() { + return this.indexNamePrefix; + } + + /** + * The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. + *

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

+ */ + @Nullable + public final String locale() { + return this.locale; + } + + /** + * The time zone to use when parsing the date and when date math index supports resolves expressions into concrete index names. + *

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

+ */ + @Nullable + public final String timezone() { + return this.timezone; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + generator.writeKey("date_formats"); + generator.writeStartArray(); + for (String item0 : this.dateFormats) { + generator.write(item0); + } + generator.writeEnd(); + + generator.writeKey("date_rounding"); + generator.write(this.dateRounding); + + generator.writeKey("field"); + generator.write(this.field); + + if (this.indexNameFormat != null) { + generator.writeKey("index_name_format"); + generator.write(this.indexNameFormat); + } + + if (this.indexNamePrefix != null) { + generator.writeKey("index_name_prefix"); + generator.write(this.indexNamePrefix); + } + + if (this.locale != null) { + generator.writeKey("locale"); + generator.write(this.locale); + } + + if (this.timezone != null) { + generator.writeKey("timezone"); + generator.write(this.timezone); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DateIndexNameProcessor}. + */ + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + private List dateFormats; + private String dateRounding; + private String field; + @Nullable + private String indexNameFormat; + @Nullable + private String indexNamePrefix; + @Nullable + private String locale; + @Nullable + private String timezone; + + public Builder() {} + + private Builder(DateIndexNameProcessor o) { + super(o); + this.dateFormats = _listCopy(o.dateFormats); + this.dateRounding = o.dateRounding; + this.field = o.field; + this.indexNameFormat = o.indexNameFormat; + this.indexNamePrefix = o.indexNamePrefix; + this.locale = o.locale; + this.timezone = o.timezone; + } + + private Builder(Builder o) { + super(o); + this.dateFormats = _listCopy(o.dateFormats); + this.dateRounding = o.dateRounding; + this.field = o.field; + this.indexNameFormat = o.indexNameFormat; + this.indexNamePrefix = o.indexNamePrefix; + this.locale = o.locale; + this.timezone = o.timezone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - An array of the expected date formats for parsing dates/timestamps in the document being preprocessed. Can be a java + * time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or + * TAI64N. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder dateFormats(List list) { + this.dateFormats = _listAddAll(this.dateFormats, list); + return this; + } + + /** + * Required - An array of the expected date formats for parsing dates/timestamps in the document being preprocessed. Can be a java + * time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or + * TAI64N. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder dateFormats(String value, String... values) { + this.dateFormats = _listAdd(this.dateFormats, value, values); + return this; + } + + /** + * Required - How to round the date when formatting the date into the index name. Valid values are: y (year), + * M (month), w (week), d (day), h (hour), m (minute) and + * s (second). Supports template snippets. + *

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

+ */ + @Nonnull + public final Builder dateRounding(String value) { + this.dateRounding = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * The format to be used when printing the parsed date into the index name. A valid java time pattern is expected here. Supports + * template snippets. + *

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

+ */ + @Nonnull + public final Builder indexNameFormat(@Nullable String value) { + this.indexNameFormat = value; + return this; + } + + /** + * A prefix of the index name to be prepended before the printed date. Supports template snippets. + *

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

+ */ + @Nonnull + public final Builder indexNamePrefix(@Nullable String value) { + this.indexNamePrefix = value; + return this; + } + + /** + * The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. + *

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

+ */ + @Nonnull + public final Builder locale(@Nullable String value) { + this.locale = value; + return this; + } + + /** + * The time zone to use when parsing the date and when date math index supports resolves expressions into concrete index names. + *

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

+ */ + @Nonnull + public final Builder timezone(@Nullable String value) { + this.timezone = value; + return this; + } + + /** + * Builds a {@link DateIndexNameProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DateIndexNameProcessor build() { + _checkSingleUse(); + + return new DateIndexNameProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DateIndexNameProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DateIndexNameProcessor::setupDateIndexNameProcessorDeserializer + ); + + protected static void setupDateIndexNameProcessorDeserializer(ObjectDeserializer op) { + setupProcessorBaseDeserializer(op); + op.add(Builder::dateFormats, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "date_formats"); + op.add(Builder::dateRounding, JsonpDeserializer.stringDeserializer(), "date_rounding"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::indexNameFormat, JsonpDeserializer.stringDeserializer(), "index_name_format"); + op.add(Builder::indexNamePrefix, JsonpDeserializer.stringDeserializer(), "index_name_prefix"); + op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); + op.add(Builder::timezone, JsonpDeserializer.stringDeserializer(), "timezone"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.dateFormats.hashCode(); + result = 31 * result + this.dateRounding.hashCode(); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.indexNameFormat); + result = 31 * result + Objects.hashCode(this.indexNamePrefix); + result = 31 * result + Objects.hashCode(this.locale); + result = 31 * result + Objects.hashCode(this.timezone); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DateIndexNameProcessor other = (DateIndexNameProcessor) o; + return this.dateFormats.equals(other.dateFormats) + && this.dateRounding.equals(other.dateRounding) + && this.field.equals(other.field) + && Objects.equals(this.indexNameFormat, other.indexNameFormat) + && Objects.equals(this.indexNamePrefix, other.indexNamePrefix) + && Objects.equals(this.locale, other.locale) + && Objects.equals(this.timezone, other.timezone); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateProcessor.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateProcessor.java index a454dfc6e9..3e1a6640d1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DateProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,14 +49,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.DateProcessor +// typedef: ingest.DateProcessor @JsonpDeserializable -public class DateProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DateProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nonnull private final String field; + @Nonnull private final List formats; @Nullable @@ -65,21 +78,19 @@ public class DateProcessor extends ProcessorBase implements ProcessorVariant { private DateProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.formats = ApiTypeHelper.unmodifiableRequired(builder.formats, this, "formats"); this.locale = builder.locale; this.targetField = builder.targetField; this.timezone = builder.timezone; - } - public static DateProcessor of(Function> fn) { + public static DateProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -89,19 +100,28 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code formats} + * Required - An array of the expected date formats. Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, + * or TAI64N. + *

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

*/ + @Nonnull public final List formats() { return this.formats; } /** + * The locale to use when parsing the date, relevant when parsing month names or week days. Supports template snippets. + *

* API name: {@code locale} + *

*/ @Nullable public final String locale() { @@ -117,7 +137,10 @@ public final String targetField() { } /** + * The time zone to use when parsing the date. Supports template snippets. + *

* API name: {@code timezone} + *

*/ @Nullable public final String timezone() { @@ -125,90 +148,141 @@ public final String timezone() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); - if (ApiTypeHelper.isDefined(this.formats)) { - generator.writeKey("formats"); - generator.writeStartArray(); - for (String item0 : this.formats) { - generator.write(item0); - - } - generator.writeEnd(); - + generator.writeKey("formats"); + generator.writeStartArray(); + for (String item0 : this.formats) { + generator.write(item0); } + generator.writeEnd(); + if (this.locale != null) { generator.writeKey("locale"); generator.write(this.locale); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } + if (this.timezone != null) { generator.writeKey("timezone"); generator.write(this.timezone); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DateProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - private List formats; - @Nullable private String locale; - @Nullable private String targetField; - @Nullable private String timezone; + public Builder() {} + + private Builder(DateProcessor o) { + super(o); + this.field = o.field; + this.formats = _listCopy(o.formats); + this.locale = o.locale; + this.targetField = o.targetField; + this.timezone = o.timezone; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.formats = _listCopy(o.formats); + this.locale = o.locale; + this.targetField = o.targetField; + this.timezone = o.timezone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code formats} + * Required - An array of the expected date formats. Can be a java time pattern or one of the following formats: ISO8601, UNIX, + * UNIX_MS, or TAI64N. + *

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

+ * *

* Adds all elements of list to formats. + *

*/ + @Nonnull public final Builder formats(List list) { this.formats = _listAddAll(this.formats, list); return this; } /** - * Required - API name: {@code formats} + * Required - An array of the expected date formats. Can be a java time pattern or one of the following formats: ISO8601, UNIX, + * UNIX_MS, or TAI64N. + *

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

+ * *

* Adds one or more values to formats. + *

*/ + @Nonnull public final Builder formats(String value, String... values) { this.formats = _listAdd(this.formats, value, values); return this; } /** + * The locale to use when parsing the date, relevant when parsing month names or week days. Supports template snippets. + *

* API name: {@code locale} + *

*/ + @Nonnull public final Builder locale(@Nullable String value) { this.locale = value; return this; @@ -217,30 +291,31 @@ public final Builder locale(@Nullable String value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } /** + * The time zone to use when parsing the date. Supports template snippets. + *

* API name: {@code timezone} + *

*/ + @Nonnull public final Builder timezone(@Nullable String value) { this.timezone = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link DateProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DateProcessor build() { _checkSingleUse(); @@ -265,7 +340,31 @@ protected static void setupDateProcessorDeserializer(ObjectDeserializer { -public class DeletePipelineRequest extends RequestBase { + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final String id; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; // --------------------------------------------------------------------------------------------- private DeletePipelineRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; - } - public static DeletePipelineRequest of(Function> fn) { + public static DeletePipelineRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - Pipeline ID + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Required - Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, + * use a value of *. *

* API name: {@code id} + *

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

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -101,19 +125,10 @@ public final Time masterTimeout() { } /** - * Explicit operation timeout for connection to cluster-manager node - *

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

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -122,98 +137,144 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeletePipelineRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; private String id; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; + public Builder() {} + + private Builder(DeletePipelineRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - Pipeline ID + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to master node + * Required - Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a + * cluster, use a value of *. *

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

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

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

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

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

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

* API name: {@code timeout} + *

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

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link DeletePipelineRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeletePipelineRequest build() { _checkSingleUse(); @@ -227,50 +288,52 @@ public DeletePipelineRequest build() { * Endpoint "{@code ingest.delete_pipeline}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_ingest"); - buf.append("/pipeline"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.id, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_ingest/pipeline/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, DeletePipelineResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.id.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeletePipelineRequest other = (DeletePipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && this.id.equals(other.id) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java index 64d67573e5..1e9232be9b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DeletePipelineResponse.java @@ -30,37 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.delete_pipeline.Response -public class DeletePipelineResponse extends AcknowledgedResponseBase { +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeletePipelineResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DeletePipelineResponse(Builder builder) { super(builder); - } - public static DeletePipelineResponse of(Function> fn) { + public static DeletePipelineResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeletePipelineResponse}. */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeletePipelineResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -68,9 +111,10 @@ protected Builder self() { /** * Builds a {@link DeletePipelineResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeletePipelineResponse build() { _checkSingleUse(); @@ -89,8 +133,22 @@ public DeletePipelineResponse build() { ); protected static void setupDeletePipelineResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java index 8d1b5e9dbe..84e961f1cf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DissectProcessor.java @@ -30,48 +30,65 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.DissectProcessor +// typedef: ingest.DissectProcessor @JsonpDeserializable -public class DissectProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DissectProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nullable private final String appendSeparator; + @Nonnull private final String field; - private final boolean ignoreMissing; + @Nullable + private final Boolean ignoreMissing; + @Nonnull private final String pattern; // --------------------------------------------------------------------------------------------- private DissectProcessor(Builder builder) { super(builder); - - this.appendSeparator = ApiTypeHelper.requireNonNull(builder.appendSeparator, this, "appendSeparator"); + this.appendSeparator = builder.appendSeparator; this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.ignoreMissing = ApiTypeHelper.requireNonNull(builder.ignoreMissing, this, "ignoreMissing"); + this.ignoreMissing = builder.ignoreMissing; this.pattern = ApiTypeHelper.requireNonNull(builder.pattern, this, "pattern"); - } - public static DissectProcessor of(Function> fn) { + public static DissectProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -79,8 +96,12 @@ public Processor.Kind _processorKind() { } /** - * Required - API name: {@code append_separator} + * The character(s) that separate the appended fields. + *

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

*/ + @Nullable public final String appendSeparator() { return this.appendSeparator; } @@ -88,60 +109,115 @@ public final String appendSeparator() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

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

*/ - public final boolean ignoreMissing() { + @Nullable + public final Boolean ignoreMissing() { return this.ignoreMissing; } /** - * Required - API name: {@code pattern} + * Required - The pattern to apply to the field. + *

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

*/ + @Nonnull public final String pattern() { return this.pattern; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("append_separator"); - generator.write(this.appendSeparator); + if (this.appendSeparator != null) { + generator.writeKey("append_separator"); + generator.write(this.appendSeparator); + } generator.writeKey("field"); generator.write(this.field); - generator.writeKey("ignore_missing"); - generator.write(this.ignoreMissing); + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + } generator.writeKey("pattern"); generator.write(this.pattern); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DissectProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable private String appendSeparator; - private String field; - + @Nullable private Boolean ignoreMissing; - private String pattern; + public Builder() {} + + private Builder(DissectProcessor o) { + super(o); + this.appendSeparator = o.appendSeparator; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.pattern = o.pattern; + } + + private Builder(Builder o) { + super(o); + this.appendSeparator = o.appendSeparator; + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.pattern = o.pattern; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** - * Required - API name: {@code append_separator} + * The character(s) that separate the appended fields. + *

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

*/ - public final Builder appendSeparator(String value) { + @Nonnull + public final Builder appendSeparator(@Nullable String value) { this.appendSeparator = value; return this; } @@ -149,38 +225,44 @@ public final Builder appendSeparator(String value) { /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

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

*/ - public final Builder ignoreMissing(boolean value) { + @Nonnull + public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** - * Required - API name: {@code pattern} + * Required - The pattern to apply to the field. + *

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

*/ + @Nonnull public final Builder pattern(String value) { this.pattern = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link DissectProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DissectProcessor build() { _checkSingleUse(); @@ -199,12 +281,34 @@ public DissectProcessor build() { ); protected static void setupDissectProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); + setupProcessorBaseDeserializer(op); op.add(Builder::appendSeparator, JsonpDeserializer.stringDeserializer(), "append_separator"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); op.add(Builder::pattern, JsonpDeserializer.stringDeserializer(), "pattern"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.appendSeparator); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMissing); + result = 31 * result + this.pattern.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DissectProcessor other = (DissectProcessor) o; + return Objects.equals(this.appendSeparator, other.appendSeparator) + && this.field.equals(other.field) + && Objects.equals(this.ignoreMissing, other.ignoreMissing) + && this.pattern.equals(other.pattern); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java index 735b18479a..1161bc346a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/DotExpanderProcessor.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.DotExpanderProcessor +// typedef: ingest.DotExpanderProcessor @JsonpDeserializable -public class DotExpanderProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DotExpanderProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final String field; @Nullable @@ -56,18 +71,16 @@ public class DotExpanderProcessor extends ProcessorBase implements ProcessorVari private DotExpanderProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.path = builder.path; - } - public static DotExpanderProcessor of(Function> fn) { + public static DotExpanderProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -77,12 +90,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * The field that contains the field to expand. Only required if the field to expand is part another object field, because the + * field option can only understand leaf fields. + *

* API name: {@code path} + *

*/ @Nullable public final String path() { @@ -90,7 +108,6 @@ public final String path() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -98,50 +115,85 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.path != null) { generator.writeKey("path"); generator.write(this.path); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DotExpanderProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private String path; + public Builder() {} + + private Builder(DotExpanderProcessor o) { + super(o); + this.field = o.field; + this.path = o.path; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.path = o.path; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * The field that contains the field to expand. Only required if the field to expand is part another object field, because the + * field option can only understand leaf fields. + *

* API name: {@code path} + *

*/ + @Nonnull public final Builder path(@Nullable String value) { this.path = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link DotExpanderProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DotExpanderProcessor build() { _checkSingleUse(); @@ -163,7 +215,24 @@ protected static void setupDotExpanderProcessorDeserializer(ObjectDeserializer { + // --------------------------------------------------------------------------------------------- private DropProcessor(Builder builder) { super(builder); - } - public static DropProcessor of(Function> fn) { + public static DropProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -64,12 +73,40 @@ public Processor.Kind _processorKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DropProcessor}. */ + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + + public Builder() {} + + private Builder(DropProcessor o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +114,10 @@ protected Builder self() { /** * Builds a {@link DropProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DropProcessor build() { _checkSingleUse(); @@ -99,7 +137,21 @@ public DropProcessor build() { protected static void setupDropProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/FailProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/FailProcessor.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/FailProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/FailProcessor.java index 57714792b4..4faa9c8879 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/FailProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/FailProcessor.java @@ -30,39 +30,48 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.FailProcessor +// typedef: ingest.FailProcessor @JsonpDeserializable -public class FailProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FailProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nonnull private final String message; // --------------------------------------------------------------------------------------------- private FailProcessor(Builder builder) { super(builder); - this.message = ApiTypeHelper.requireNonNull(builder.message, this, "message"); - } - public static FailProcessor of(Function> fn) { + public static FailProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -70,48 +79,84 @@ public Processor.Kind _processorKind() { } /** - * Required - API name: {@code message} + * Required - The error message thrown by the processor. Supports template snippets. + *

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

*/ + @Nonnull public final String message() { return this.message; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("message"); generator.write(this.message); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FailProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String message; - /** - * Required - API name: {@code message} - */ - public final Builder message(String value) { - this.message = value; - return this; + public Builder() {} + + private Builder(FailProcessor o) { + super(o); + this.message = o.message; + } + + private Builder(Builder o) { + super(o); + this.message = o.message; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } @Override + @Nonnull protected Builder self() { return this; } + /** + * Required - The error message thrown by the processor. Supports template snippets. + *

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

+ */ + @Nonnull + public final Builder message(String value) { + this.message = value; + return this; + } + /** * Builds a {@link FailProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FailProcessor build() { _checkSingleUse(); @@ -132,7 +177,23 @@ public FailProcessor build() { protected static void setupFailProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); op.add(Builder::message, JsonpDeserializer.stringDeserializer(), "message"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.message.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FailProcessor other = (FailProcessor) o; + return this.message.equals(other.message); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java index 0ca379f39e..41f86eee7d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ForeachProcessor.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,36 +48,43 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.ForeachProcessor +// typedef: ingest.ForeachProcessor @JsonpDeserializable -public class ForeachProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ForeachProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final String field; @Nullable private final Boolean ignoreMissing; + @Nonnull private final Processor processor; // --------------------------------------------------------------------------------------------- private ForeachProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.processor = ApiTypeHelper.requireNonNull(builder.processor, this, "processor"); - } - public static ForeachProcessor of(Function> fn) { + public static ForeachProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -80,12 +94,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true, the processor silently exits without changing the document if the field is null or + * missing. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -95,12 +114,12 @@ public final Boolean ignoreMissing() { /** * Required - API name: {@code processor} */ + @Nonnull public final Processor processor() { return this.processor; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -108,38 +127,79 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + generator.writeKey("processor"); this.processor.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ForeachProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - private Processor processor; + public Builder() {} + + private Builder(ForeachProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.processor = o.processor; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.processor = o.processor; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true, the processor silently exits without changing the document if the field is null + * or missing. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -148,6 +208,7 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * Required - API name: {@code processor} */ + @Nonnull public final Builder processor(Processor value) { this.processor = value; return this; @@ -156,21 +217,18 @@ public final Builder processor(Processor value) { /** * Required - API name: {@code processor} */ + @Nonnull public final Builder processor(Function> fn) { - return this.processor(fn.apply(new Processor.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return processor(fn.apply(new Processor.Builder()).build()); } /** * Builds a {@link ForeachProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ForeachProcessor build() { _checkSingleUse(); @@ -193,7 +251,27 @@ protected static void setupForeachProcessorDeserializer(ObjectDeserializer { + + @Nullable + private final String databaseFile; + + @Nonnull + private final String field; + + @Nullable + private final Boolean firstOnly; + + @Nullable + private final Boolean ignoreMissing; + + @Nonnull + private final List properties; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private GeoIpProcessor(Builder builder) { + super(builder); + this.databaseFile = builder.databaseFile; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.firstOnly = builder.firstOnly; + this.ignoreMissing = builder.ignoreMissing; + this.properties = ApiTypeHelper.unmodifiable(builder.properties); + this.targetField = builder.targetField; + } + + public static GeoIpProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Processor} variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Geoip; + } + + /** + * The database filename referring to a database the module ships with (GeoLite2-City.mmdb, + * GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config + * directory. + *

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

+ */ + @Nullable + public final String databaseFile() { + return this.databaseFile; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * If true, only the first found geoip data will be returned, even if the field contains an array. + *

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

+ */ + @Nullable + public final Boolean firstOnly() { + return this.firstOnly; + } + + /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

+ */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * Controls what properties are added to the target_field based on the geoip lookup. + *

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

+ */ + @Nonnull + public final List properties() { + return this.properties; + } + + /** + * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.databaseFile != null) { + generator.writeKey("database_file"); + generator.write(this.databaseFile); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.firstOnly != null) { + generator.writeKey("first_only"); + generator.write(this.firstOnly); + } + + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + } + + if (ApiTypeHelper.isDefined(this.properties)) { + generator.writeKey("properties"); + generator.writeStartArray(); + for (String item0 : this.properties) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GeoIpProcessor}. + */ + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String databaseFile; + private String field; + @Nullable + private Boolean firstOnly; + @Nullable + private Boolean ignoreMissing; + @Nullable + private List properties; + @Nullable + private String targetField; + + public Builder() {} + + private Builder(GeoIpProcessor o) { + super(o); + this.databaseFile = o.databaseFile; + this.field = o.field; + this.firstOnly = o.firstOnly; + this.ignoreMissing = o.ignoreMissing; + this.properties = _listCopy(o.properties); + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.databaseFile = o.databaseFile; + this.field = o.field; + this.firstOnly = o.firstOnly; + this.ignoreMissing = o.ignoreMissing; + this.properties = _listCopy(o.properties); + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The database filename referring to a database the module ships with (GeoLite2-City.mmdb, + * GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip + * config directory. + *

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

+ */ + @Nonnull + public final Builder databaseFile(@Nullable String value) { + this.databaseFile = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * If true, only the first found geoip data will be returned, even if the field contains an array. + *

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

+ */ + @Nonnull + public final Builder firstOnly(@Nullable Boolean value) { + this.firstOnly = value; + return this; + } + + /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

+ */ + @Nonnull + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * Controls what properties are added to the target_field based on the geoip lookup. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder properties(List list) { + this.properties = _listAddAll(this.properties, list); + return this; + } + + /** + * Controls what properties are added to the target_field based on the geoip lookup. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder properties(String value, String... values) { + this.properties = _listAdd(this.properties, value, values); + return this; + } + + /** + * API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + /** + * Builds a {@link GeoIpProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GeoIpProcessor build() { + _checkSingleUse(); + + return new GeoIpProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoIpProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoIpProcessor::setupGeoIpProcessorDeserializer + ); + + protected static void setupGeoIpProcessorDeserializer(ObjectDeserializer op) { + setupProcessorBaseDeserializer(op); + op.add(Builder::databaseFile, JsonpDeserializer.stringDeserializer(), "database_file"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::firstOnly, JsonpDeserializer.booleanDeserializer(), "first_only"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::properties, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "properties"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.databaseFile); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.firstOnly); + result = 31 * result + Objects.hashCode(this.ignoreMissing); + result = 31 * result + Objects.hashCode(this.properties); + result = 31 * result + Objects.hashCode(this.targetField); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoIpProcessor other = (GeoIpProcessor) o; + return Objects.equals(this.databaseFile, other.databaseFile) + && this.field.equals(other.field) + && Objects.equals(this.firstOnly, other.firstOnly) + && Objects.equals(this.ignoreMissing, other.ignoreMissing) + && Objects.equals(this.properties, other.properties) + && Objects.equals(this.targetField, other.targetField); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java index 3dbbdbfe39..c7b8fe5aa7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java @@ -30,28 +30,40 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.get_pipeline.Request /** * Returns a pipeline. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetPipelineRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class GetPipelineRequest extends RequestBase { @Nullable private final String id; @@ -59,31 +71,35 @@ public class GetPipelineRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - - @Nullable - private final Boolean summary; - // --------------------------------------------------------------------------------------------- private GetPipelineRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.id = builder.id; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.summary = builder.summary; - } - public static GetPipelineRequest of(Function> fn) { + public static GetPipelineRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Comma separated list of pipeline ids. Wildcards supported + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Comma-separated list of pipeline IDs to retrieve. Wildcard (*) expressions are supported. To get all ingest pipelines, + * omit this parameter or use *. *

* API name: {@code id} + *

*/ @Nullable public final String id() { @@ -91,9 +107,11 @@ public final String id() { } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -101,112 +119,120 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } + // --------------------------------------------------------------------------------------------- - /** - * Return pipelines without their definitions (default: false) - *

- * API name: {@code summary} - */ - @Nullable - public final Boolean summary() { - return this.summary; + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link GetPipelineRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private String id; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} - @Nullable - private Boolean summary; + private Builder(GetPipelineRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + } - /** - * Comma separated list of pipeline ids. Wildcards supported - *

- * API name: {@code id} - */ - public final Builder id(@Nullable String value) { - this.id = value; - return this; + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to cluster-manager node + * Comma-separated list of pipeline IDs to retrieve. Wildcard (*) expressions are supported. To get all ingest + * pipelines, omit this parameter or use *. *

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

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

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

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

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

*/ - public final Builder summary(@Nullable Boolean value) { - this.summary = value; - return this; + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link GetPipelineRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetPipelineRequest build() { _checkSingleUse(); @@ -220,13 +246,8 @@ public GetPipelineRequest build() { * Endpoint "{@code ingest.get_pipeline}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _id = 1 << 0; @@ -236,40 +257,49 @@ public GetPipelineRequest build() { if (request.id() != null) propsSet |= _id; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_ingest"); - buf.append("/pipeline"); - return buf.toString(); + return "/_ingest/pipeline"; } if (propsSet == (_id)) { StringBuilder buf = new StringBuilder(); - buf.append("/_ingest"); - buf.append("/pipeline"); - buf.append("/"); + buf.append("/_ingest/pipeline/"); SimpleEndpoint.pathEncode(request.id, buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.summary != null) { - params.put("summary", String.valueOf(request.summary)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, GetPipelineResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.id); + result = 31 * result + Objects.hashCode(this.masterTimeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetPipelineRequest other = (GetPipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.id, other.id) + && Objects.equals(this.masterTimeout, other.masterTimeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java index 5b499b1f33..76afc53568 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GetPipelineResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +49,15 @@ // typedef: ingest.get_pipeline.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetPipelineResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private GetPipelineResponse(Builder builder) { super(builder); - } - public static GetPipelineResponse of(Function> fn) { + public static GetPipelineResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,11 +66,11 @@ public static GetPipelineResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -72,8 +78,7 @@ protected Builder self() { /** * Builds a {@link GetPipelineResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetPipelineResponse build() { _checkSingleUse(); @@ -95,8 +100,6 @@ public GetPipelineResponse build() { ); protected static void setupGetPipelineResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), Pipeline._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), Pipeline._DESERIALIZER); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java index 68cefe708c..99b7df1cf5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/GrokProcessor.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,19 +50,26 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.GrokProcessor +// typedef: ingest.GrokProcessor @JsonpDeserializable -public class GrokProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GrokProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nonnull private final String field; @Nullable private final Boolean ignoreMissing; + @Nonnull private final Map patternDefinitions; + @Nonnull private final List patterns; @Nullable @@ -65,21 +79,19 @@ public class GrokProcessor extends ProcessorBase implements ProcessorVariant { private GrokProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; - this.patternDefinitions = ApiTypeHelper.unmodifiableRequired(builder.patternDefinitions, this, "patternDefinitions"); + this.patternDefinitions = ApiTypeHelper.unmodifiable(builder.patternDefinitions); this.patterns = ApiTypeHelper.unmodifiableRequired(builder.patterns, this, "patterns"); this.traceMatch = builder.traceMatch; - } - public static GrokProcessor of(Function> fn) { + public static GrokProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -89,12 +101,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,21 +119,35 @@ public final Boolean ignoreMissing() { } /** - * Required - API name: {@code pattern_definitions} + * A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing + * names will override the pre-existing definition. + *

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

*/ + @Nonnull public final Map patternDefinitions() { return this.patternDefinitions; } /** - * Required - API name: {@code patterns} + * Required - An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the list + * that matches. + *

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

*/ + @Nonnull public final List patterns() { return this.patterns; } /** + * When true, _ingest._grok_match_index will be inserted into your matched document's metadata with the index + * into the pattern found in patterns that matched. + *

* API name: {@code trace_match} + *

*/ @Nullable public final Boolean traceMatch() { @@ -124,7 +155,6 @@ public final Boolean traceMatch() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -132,131 +162,199 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (ApiTypeHelper.isDefined(this.patternDefinitions)) { generator.writeKey("pattern_definitions"); generator.writeStartObject(); for (Map.Entry item0 : this.patternDefinitions.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - } - if (ApiTypeHelper.isDefined(this.patterns)) { - generator.writeKey("patterns"); - generator.writeStartArray(); - for (String item0 : this.patterns) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("patterns"); + generator.writeStartArray(); + for (String item0 : this.patterns) { + generator.write(item0); } + generator.writeEnd(); + if (this.traceMatch != null) { generator.writeKey("trace_match"); generator.write(this.traceMatch); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GrokProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - + @Nullable private Map patternDefinitions; - private List patterns; - @Nullable private Boolean traceMatch; + public Builder() {} + + private Builder(GrokProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.patternDefinitions = _mapCopy(o.patternDefinitions); + this.patterns = _listCopy(o.patterns); + this.traceMatch = o.traceMatch; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.patternDefinitions = _mapCopy(o.patternDefinitions); + this.patterns = _listCopy(o.patterns); + this.traceMatch = o.traceMatch; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** - * Required - API name: {@code pattern_definitions} + * A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing + * names will override the pre-existing definition. + *

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

+ * *

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

*/ + @Nonnull public final Builder patternDefinitions(Map map) { this.patternDefinitions = _mapPutAll(this.patternDefinitions, map); return this; } /** - * Required - API name: {@code pattern_definitions} + * A map of pattern-name and pattern tuples defining custom patterns to be used by the current processor. Patterns matching existing + * names will override the pre-existing definition. + *

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

+ * *

* Adds an entry to patternDefinitions. + *

*/ + @Nonnull public final Builder patternDefinitions(String key, String value) { this.patternDefinitions = _mapPut(this.patternDefinitions, key, value); return this; } /** - * Required - API name: {@code patterns} + * Required - An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the + * list that matches. + *

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

+ * *

* Adds all elements of list to patterns. + *

*/ + @Nonnull public final Builder patterns(List list) { this.patterns = _listAddAll(this.patterns, list); return this; } /** - * Required - API name: {@code patterns} + * Required - An ordered list of grok expression to match and extract named captures with. Returns on the first expression in the + * list that matches. + *

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

+ * *

* Adds one or more values to patterns. + *

*/ + @Nonnull public final Builder patterns(String value, String... values) { this.patterns = _listAdd(this.patterns, value, values); return this; } /** + * When true, _ingest._grok_match_index will be inserted into your matched document's metadata with the + * index into the pattern found in patterns that matched. + *

* API name: {@code trace_match} + *

*/ + @Nonnull public final Builder traceMatch(@Nullable Boolean value) { this.traceMatch = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link GrokProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GrokProcessor build() { _checkSingleUse(); @@ -285,7 +383,31 @@ protected static void setupGrokProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable private final Boolean ignoreMissing; + @Nonnull private final String pattern; + @Nonnull private final String replacement; @Nullable @@ -63,21 +77,19 @@ public class GsubProcessor extends ProcessorBase implements ProcessorVariant { private GsubProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.pattern = ApiTypeHelper.requireNonNull(builder.pattern, this, "pattern"); this.replacement = ApiTypeHelper.requireNonNull(builder.replacement, this, "replacement"); this.targetField = builder.targetField; - } - public static GsubProcessor of(Function> fn) { + public static GsubProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -87,12 +99,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -100,15 +117,23 @@ public final Boolean ignoreMissing() { } /** - * Required - API name: {@code pattern} + * Required - The pattern to be replaced. + *

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

*/ + @Nonnull public final String pattern() { return this.pattern; } /** - * Required - API name: {@code replacement} + * Required - The string to replace the matching patterns with. + *

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

*/ + @Nonnull public final String replacement() { return this.replacement; } @@ -122,7 +147,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -130,8 +154,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + generator.writeKey("pattern"); generator.write(this.pattern); @@ -141,57 +165,107 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GsubProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - private String pattern; - private String replacement; - @Nullable private String targetField; + public Builder() {} + + private Builder(GsubProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.pattern = o.pattern; + this.replacement = o.replacement; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.pattern = o.pattern; + this.replacement = o.replacement; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** - * Required - API name: {@code pattern} + * Required - The pattern to be replaced. + *

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

*/ + @Nonnull public final Builder pattern(String value) { this.pattern = value; return this; } /** - * Required - API name: {@code replacement} + * Required - The string to replace the matching patterns with. + *

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

*/ + @Nonnull public final Builder replacement(String value) { this.replacement = value; return this; @@ -200,22 +274,19 @@ public final Builder replacement(String value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link GsubProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GsubProcessor build() { _checkSingleUse(); @@ -240,7 +311,31 @@ protected static void setupGsubProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; + @Nonnull private final String separator; @Nullable @@ -58,19 +71,17 @@ public class JoinProcessor extends ProcessorBase implements ProcessorVariant { private JoinProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.separator = ApiTypeHelper.requireNonNull(builder.separator, this, "separator"); this.targetField = builder.targetField; - } - public static JoinProcessor of(Function> fn) { + public static JoinProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -80,13 +91,18 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code separator} + * Required - The separator character. + *

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

*/ + @Nonnull public final String separator() { return this.separator; } @@ -100,7 +116,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -111,36 +126,75 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link JoinProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - private String separator; - @Nullable private String targetField; + public Builder() {} + + private Builder(JoinProcessor o) { + super(o); + this.field = o.field; + this.separator = o.separator; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.separator = o.separator; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code separator} + * Required - The separator character. + *

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

*/ + @Nonnull public final Builder separator(String value) { this.separator = value; return this; @@ -149,22 +203,19 @@ public final Builder separator(String value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link JoinProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public JoinProcessor build() { _checkSingleUse(); @@ -183,11 +234,31 @@ public JoinProcessor build() { ); protected static void setupJoinProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); + setupProcessorBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator"); op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.field.hashCode(); + result = 31 * result + this.separator.hashCode(); + result = 31 * result + Objects.hashCode(this.targetField); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + JoinProcessor other = (JoinProcessor) o; + return this.field.equals(other.field) + && this.separator.equals(other.separator) + && Objects.equals(this.targetField, other.targetField); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java new file mode 100644 index 0000000000..e7600c0e1e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java @@ -0,0 +1,343 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ingest; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ingest.JsonProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class JsonProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nullable + private final Boolean addToRoot; + + @Nullable + private final JsonProcessorConflictStrategy addToRootConflictStrategy; + + @Nullable + private final Boolean allowDuplicateKeys; + + @Nonnull + private final String field; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private JsonProcessor(Builder builder) { + super(builder); + this.addToRoot = builder.addToRoot; + this.addToRootConflictStrategy = builder.addToRootConflictStrategy; + this.allowDuplicateKeys = builder.allowDuplicateKeys; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.targetField = builder.targetField; + } + + public static JsonProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Processor} variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Json; + } + + /** + * Flag that forces the parsed JSON to be added at the top level of the document. target_field must not be set when this + * option is chosen. + *

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

+ */ + @Nullable + public final Boolean addToRoot() { + return this.addToRoot; + } + + /** + * API name: {@code add_to_root_conflict_strategy} + */ + @Nullable + public final JsonProcessorConflictStrategy addToRootConflictStrategy() { + return this.addToRootConflictStrategy; + } + + /** + * When set to true, the JSON parser will not fail if the JSON contains duplicate keys. Instead, the last encountered value + * for any duplicate key wins. + *

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

+ */ + @Nullable + public final Boolean allowDuplicateKeys() { + return this.allowDuplicateKeys; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.addToRoot != null) { + generator.writeKey("add_to_root"); + generator.write(this.addToRoot); + } + + if (this.addToRootConflictStrategy != null) { + generator.writeKey("add_to_root_conflict_strategy"); + this.addToRootConflictStrategy.serialize(generator, mapper); + } + + if (this.allowDuplicateKeys != null) { + generator.writeKey("allow_duplicate_keys"); + generator.write(this.allowDuplicateKeys); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link JsonProcessor}. + */ + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Boolean addToRoot; + @Nullable + private JsonProcessorConflictStrategy addToRootConflictStrategy; + @Nullable + private Boolean allowDuplicateKeys; + private String field; + @Nullable + private String targetField; + + public Builder() {} + + private Builder(JsonProcessor o) { + super(o); + this.addToRoot = o.addToRoot; + this.addToRootConflictStrategy = o.addToRootConflictStrategy; + this.allowDuplicateKeys = o.allowDuplicateKeys; + this.field = o.field; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.addToRoot = o.addToRoot; + this.addToRootConflictStrategy = o.addToRootConflictStrategy; + this.allowDuplicateKeys = o.allowDuplicateKeys; + this.field = o.field; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Flag that forces the parsed JSON to be added at the top level of the document. target_field must not be set when + * this option is chosen. + *

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

+ */ + @Nonnull + public final Builder addToRoot(@Nullable Boolean value) { + this.addToRoot = value; + return this; + } + + /** + * API name: {@code add_to_root_conflict_strategy} + */ + @Nonnull + public final Builder addToRootConflictStrategy(@Nullable JsonProcessorConflictStrategy value) { + this.addToRootConflictStrategy = value; + return this; + } + + /** + * When set to true, the JSON parser will not fail if the JSON contains duplicate keys. Instead, the last encountered + * value for any duplicate key wins. + *

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

+ */ + @Nonnull + public final Builder allowDuplicateKeys(@Nullable Boolean value) { + this.allowDuplicateKeys = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + /** + * Builds a {@link JsonProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public JsonProcessor build() { + _checkSingleUse(); + + return new JsonProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link JsonProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + JsonProcessor::setupJsonProcessorDeserializer + ); + + protected static void setupJsonProcessorDeserializer(ObjectDeserializer op) { + setupProcessorBaseDeserializer(op); + op.add(Builder::addToRoot, JsonpDeserializer.booleanDeserializer(), "add_to_root"); + op.add(Builder::addToRootConflictStrategy, JsonProcessorConflictStrategy._DESERIALIZER, "add_to_root_conflict_strategy"); + op.add(Builder::allowDuplicateKeys, JsonpDeserializer.booleanDeserializer(), "allow_duplicate_keys"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.addToRoot); + result = 31 * result + Objects.hashCode(this.addToRootConflictStrategy); + result = 31 * result + Objects.hashCode(this.allowDuplicateKeys); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.targetField); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + JsonProcessor other = (JsonProcessor) o; + return Objects.equals(this.addToRoot, other.addToRoot) + && Objects.equals(this.addToRootConflictStrategy, other.addToRootConflictStrategy) + && Objects.equals(this.allowDuplicateKeys, other.allowDuplicateKeys) + && this.field.equals(other.field) + && Objects.equals(this.targetField, other.targetField); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessorConflictStrategy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessorConflictStrategy.java new file mode 100644 index 0000000000..6830b305b6 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/JsonProcessorConflictStrategy.java @@ -0,0 +1,65 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ingest; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: ingest.JsonProcessorConflictStrategy + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum JsonProcessorConflictStrategy implements JsonEnum { + Merge("merge"), + + Replace("replace"); + + private final String jsonValue; + + JsonProcessorConflictStrategy(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + JsonProcessorConflictStrategy.values() + ); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java index dc3302e715..bc0204d96e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/KeyValueProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,21 +49,32 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.KeyValueProcessor +// typedef: ingest.KeyValueProcessor @JsonpDeserializable -public class KeyValueProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class KeyValueProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final List excludeKeys; + @Nonnull private final String field; + @Nonnull private final String fieldSplit; @Nullable private final Boolean ignoreMissing; + @Nonnull private final List includeKeys; @Nullable @@ -74,13 +92,13 @@ public class KeyValueProcessor extends ProcessorBase implements ProcessorVariant @Nullable private final String trimValue; + @Nonnull private final String valueSplit; // --------------------------------------------------------------------------------------------- private KeyValueProcessor(Builder builder) { super(builder); - this.excludeKeys = ApiTypeHelper.unmodifiable(builder.excludeKeys); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.fieldSplit = ApiTypeHelper.requireNonNull(builder.fieldSplit, this, "fieldSplit"); @@ -92,15 +110,14 @@ private KeyValueProcessor(Builder builder) { this.trimKey = builder.trimKey; this.trimValue = builder.trimValue; this.valueSplit = ApiTypeHelper.requireNonNull(builder.valueSplit, this, "valueSplit"); - } - public static KeyValueProcessor of(Function> fn) { + public static KeyValueProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -108,8 +125,12 @@ public Processor.Kind _processorKind() { } /** + * List of keys to exclude from document. + *

* API name: {@code exclude_keys} + *

*/ + @Nonnull public final List excludeKeys() { return this.excludeKeys; } @@ -117,19 +138,28 @@ public final List excludeKeys() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code field_split} + * Required - Regex pattern to use for splitting key-value pairs. + *

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

*/ + @Nonnull public final String fieldSplit() { return this.fieldSplit; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -137,14 +167,21 @@ public final Boolean ignoreMissing() { } /** + * List of keys to filter and insert into document. Defaults to including all keys. + *

* API name: {@code include_keys} + *

*/ + @Nonnull public final List includeKeys() { return this.includeKeys; } /** + * Prefix to be added to extracted keys. + *

* API name: {@code prefix} + *

*/ @Nullable public final String prefix() { @@ -152,7 +189,11 @@ public final String prefix() { } /** + * If true. strip brackets (), <>, [] as well as quotes ' and + * " from extracted values. + *

* API name: {@code strip_brackets} + *

*/ @Nullable public final Boolean stripBrackets() { @@ -168,7 +209,10 @@ public final String targetField() { } /** + * String of characters to trim from extracted keys. + *

* API name: {@code trim_key} + *

*/ @Nullable public final String trimKey() { @@ -176,7 +220,10 @@ public final String trimKey() { } /** + * String of characters to trim from extracted values. + *

* API name: {@code trim_value} + *

*/ @Nullable public final String trimValue() { @@ -184,25 +231,27 @@ public final String trimValue() { } /** - * Required - API name: {@code value_split} + * Required - Regex pattern to use for splitting the key from the value within a key-value pair. + *

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

*/ + @Nonnull public final String valueSplit() { return this.valueSplit; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.excludeKeys)) { generator.writeKey("exclude_keys"); generator.writeStartArray(); for (String item0 : this.excludeKeys) { generator.write(item0); - } generator.writeEnd(); - } + generator.writeKey("field"); generator.write(this.field); @@ -212,100 +261,154 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (ApiTypeHelper.isDefined(this.includeKeys)) { generator.writeKey("include_keys"); generator.writeStartArray(); for (String item0 : this.includeKeys) { generator.write(item0); - } generator.writeEnd(); - } + if (this.prefix != null) { generator.writeKey("prefix"); generator.write(this.prefix); - } + if (this.stripBrackets != null) { generator.writeKey("strip_brackets"); generator.write(this.stripBrackets); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } + if (this.trimKey != null) { generator.writeKey("trim_key"); generator.write(this.trimKey); - } + if (this.trimValue != null) { generator.writeKey("trim_value"); generator.write(this.trimValue); - } + generator.writeKey("value_split"); generator.write(this.valueSplit); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link KeyValueProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { @Nullable private List excludeKeys; - private String field; - private String fieldSplit; - @Nullable private Boolean ignoreMissing; - @Nullable private List includeKeys; - @Nullable private String prefix; - @Nullable private Boolean stripBrackets; - @Nullable private String targetField; - @Nullable private String trimKey; - @Nullable private String trimValue; - private String valueSplit; + public Builder() {} + + private Builder(KeyValueProcessor o) { + super(o); + this.excludeKeys = _listCopy(o.excludeKeys); + this.field = o.field; + this.fieldSplit = o.fieldSplit; + this.ignoreMissing = o.ignoreMissing; + this.includeKeys = _listCopy(o.includeKeys); + this.prefix = o.prefix; + this.stripBrackets = o.stripBrackets; + this.targetField = o.targetField; + this.trimKey = o.trimKey; + this.trimValue = o.trimValue; + this.valueSplit = o.valueSplit; + } + + private Builder(Builder o) { + super(o); + this.excludeKeys = _listCopy(o.excludeKeys); + this.field = o.field; + this.fieldSplit = o.fieldSplit; + this.ignoreMissing = o.ignoreMissing; + this.includeKeys = _listCopy(o.includeKeys); + this.prefix = o.prefix; + this.stripBrackets = o.stripBrackets; + this.targetField = o.targetField; + this.trimKey = o.trimKey; + this.trimValue = o.trimValue; + this.valueSplit = o.valueSplit; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * List of keys to exclude from document. + *

* API name: {@code exclude_keys} + *

+ * *

* Adds all elements of list to excludeKeys. + *

*/ + @Nonnull public final Builder excludeKeys(List list) { this.excludeKeys = _listAddAll(this.excludeKeys, list); return this; } /** + * List of keys to exclude from document. + *

* API name: {@code exclude_keys} + *

+ * *

* Adds one or more values to excludeKeys. + *

*/ + @Nonnull public final Builder excludeKeys(String value, String... values) { this.excludeKeys = _listAdd(this.excludeKeys, value, values); return this; @@ -314,58 +417,89 @@ public final Builder excludeKeys(String value, String... values) { /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code field_split} + * Required - Regex pattern to use for splitting key-value pairs. + *

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

*/ + @Nonnull public final Builder fieldSplit(String value) { this.fieldSplit = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** + * List of keys to filter and insert into document. Defaults to including all keys. + *

* API name: {@code include_keys} + *

+ * *

* Adds all elements of list to includeKeys. + *

*/ + @Nonnull public final Builder includeKeys(List list) { this.includeKeys = _listAddAll(this.includeKeys, list); return this; } /** + * List of keys to filter and insert into document. Defaults to including all keys. + *

* API name: {@code include_keys} + *

+ * *

* Adds one or more values to includeKeys. + *

*/ + @Nonnull public final Builder includeKeys(String value, String... values) { this.includeKeys = _listAdd(this.includeKeys, value, values); return this; } /** + * Prefix to be added to extracted keys. + *

* API name: {@code prefix} + *

*/ + @Nonnull public final Builder prefix(@Nullable String value) { this.prefix = value; return this; } /** + * If true. strip brackets (), <>, [] as well as quotes ' and + * " from extracted values. + *

* API name: {@code strip_brackets} + *

*/ + @Nonnull public final Builder stripBrackets(@Nullable Boolean value) { this.stripBrackets = value; return this; @@ -374,46 +508,55 @@ public final Builder stripBrackets(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } /** + * String of characters to trim from extracted keys. + *

* API name: {@code trim_key} + *

*/ + @Nonnull public final Builder trimKey(@Nullable String value) { this.trimKey = value; return this; } /** + * String of characters to trim from extracted values. + *

* API name: {@code trim_value} + *

*/ + @Nonnull public final Builder trimValue(@Nullable String value) { this.trimValue = value; return this; } /** - * Required - API name: {@code value_split} + * Required - Regex pattern to use for splitting the key from the value within a key-value pair. + *

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

*/ + @Nonnull public final Builder valueSplit(String value) { this.valueSplit = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link KeyValueProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public KeyValueProcessor build() { _checkSingleUse(); @@ -444,7 +587,43 @@ protected static void setupKeyValueProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable @@ -59,19 +74,17 @@ public class LowercaseProcessor extends ProcessorBase implements ProcessorVarian private LowercaseProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = builder.targetField; - } - public static LowercaseProcessor of(Function> fn) { + public static LowercaseProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -81,12 +94,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,7 +120,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -110,42 +127,82 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link LowercaseProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String targetField; + public Builder() {} + + private Builder(LowercaseProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -154,22 +211,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link LowercaseProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public LowercaseProcessor build() { _checkSingleUse(); @@ -188,11 +242,31 @@ public LowercaseProcessor build() { ); protected static void setupLowercaseProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); + setupProcessorBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMissing); + result = 31 * result + Objects.hashCode(this.targetField); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LowercaseProcessor other = (LowercaseProcessor) o; + return this.field.equals(other.field) + && Objects.equals(this.ignoreMissing, other.ignoreMissing) + && Objects.equals(this.targetField, other.targetField); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java index 43c48b460f..0d27cce366 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestAsyncClient.java @@ -30,16 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -47,8 +50,8 @@ /** * Client for the ingest namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchIngestAsyncClient extends ApiClient { - public OpenSearchIngestAsyncClient(OpenSearchTransport transport) { super(transport, null); } @@ -66,73 +69,36 @@ public OpenSearchIngestAsyncClient withTransportOptions(@Nullable TransportOptio /** * Deletes a pipeline. - * - * */ - public CompletableFuture deletePipeline(DeletePipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeletePipelineRequest, - DeletePipelineResponse, - ErrorResponse>) DeletePipelineRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeletePipelineRequest._ENDPOINT, this.transportOptions); } /** * Deletes a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link DeletePipelineRequest} */ - public final CompletableFuture deletePipeline( Function> fn ) throws IOException, OpenSearchException { return deletePipeline(fn.apply(new DeletePipelineRequest.Builder()).build()); } - // ----- Endpoint: ingest.geo_ip_stats - - /** - * Returns statistical information about geoip databases - * - * - */ - public CompletableFuture geoIpStats() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(GeoIpStatsRequest._INSTANCE, GeoIpStatsRequest._ENDPOINT, this.transportOptions); - } - // ----- Endpoint: ingest.get_pipeline /** * Returns a pipeline. - * - * */ - public CompletableFuture getPipeline(GetPipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetPipelineRequest, - GetPipelineResponse, - ErrorResponse>) GetPipelineRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetPipelineRequest._ENDPOINT, this.transportOptions); } /** * Returns a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link GetPipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link GetPipelineRequest} */ - public final CompletableFuture getPipeline( Function> fn ) throws IOException, OpenSearchException { @@ -141,56 +107,52 @@ public final CompletableFuture getPipeline( /** * Returns a pipeline. - * - * */ - - public CompletableFuture getPipeline() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetPipelineRequest.Builder().build(), - GetPipelineRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture getPipeline() throws IOException, OpenSearchException { + return getPipeline(new GetPipelineRequest.Builder().build()); } // ----- Endpoint: ingest.processor_grok + /** + * Returns a list of the built-in patterns. + */ + public CompletableFuture processorGrok(ProcessorGrokRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ProcessorGrokRequest._ENDPOINT, this.transportOptions); + } + /** * Returns a list of the built-in patterns. * - * + * @param fn a function that initializes a builder to create the {@link ProcessorGrokRequest} */ - public CompletableFuture processorGrok() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(ProcessorGrokRequest._INSTANCE, ProcessorGrokRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture processorGrok( + Function> fn + ) throws IOException, OpenSearchException { + return processorGrok(fn.apply(new ProcessorGrokRequest.Builder()).build()); + } + + /** + * Returns a list of the built-in patterns. + */ + public final CompletableFuture processorGrok() throws IOException, OpenSearchException { + return processorGrok(new ProcessorGrokRequest.Builder().build()); } // ----- Endpoint: ingest.put_pipeline /** * Creates or updates a pipeline. - * - * */ - public CompletableFuture putPipeline(PutPipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutPipelineRequest, - PutPipelineResponse, - ErrorResponse>) PutPipelineRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, PutPipelineRequest._ENDPOINT, this.transportOptions); } /** * Creates or updates a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link PutPipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link PutPipelineRequest} */ - public final CompletableFuture putPipeline( Function> fn ) throws IOException, OpenSearchException { @@ -201,29 +163,16 @@ public final CompletableFuture putPipeline( /** * Allows to simulate a pipeline with example documents. - * - * */ - public CompletableFuture simulate(SimulateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SimulateRequest, - SimulateResponse, - ErrorResponse>) SimulateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, SimulateRequest._ENDPOINT, this.transportOptions); } /** * Allows to simulate a pipeline with example documents. * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateRequest} - * + * @param fn a function that initializes a builder to create the {@link SimulateRequest} */ - public final CompletableFuture simulate(Function> fn) throws IOException, OpenSearchException { return simulate(fn.apply(new SimulateRequest.Builder()).build()); @@ -231,12 +180,8 @@ public final CompletableFuture simulate(Function simulate() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new SimulateRequest.Builder().build(), SimulateRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture simulate() throws IOException, OpenSearchException { + return simulate(new SimulateRequest.Builder().build()); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java index f8448e2f3a..2da38e6215 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/OpenSearchIngestClient.java @@ -30,15 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.io.IOException; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -46,8 +49,8 @@ /** * Client for the ingest namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchIngestClient extends ApiClient { - public OpenSearchIngestClient(OpenSearchTransport transport) { super(transport, null); } @@ -65,72 +68,35 @@ public OpenSearchIngestClient withTransportOptions(@Nullable TransportOptions tr /** * Deletes a pipeline. - * - * */ - public DeletePipelineResponse deletePipeline(DeletePipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeletePipelineRequest, - DeletePipelineResponse, - ErrorResponse>) DeletePipelineRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeletePipelineRequest._ENDPOINT, this.transportOptions); } /** * Deletes a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link DeletePipelineRequest} */ - public final DeletePipelineResponse deletePipeline(Function> fn) throws IOException, OpenSearchException { return deletePipeline(fn.apply(new DeletePipelineRequest.Builder()).build()); } - // ----- Endpoint: ingest.geo_ip_stats - - /** - * Returns statistical information about geoip databases - * - * - */ - public GeoIpStatsResponse geoIpStats() throws IOException, OpenSearchException { - return this.transport.performRequest(GeoIpStatsRequest._INSTANCE, GeoIpStatsRequest._ENDPOINT, this.transportOptions); - } - // ----- Endpoint: ingest.get_pipeline /** * Returns a pipeline. - * - * */ - public GetPipelineResponse getPipeline(GetPipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetPipelineRequest, - GetPipelineResponse, - ErrorResponse>) GetPipelineRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetPipelineRequest._ENDPOINT, this.transportOptions); } /** * Returns a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link GetPipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link GetPipelineRequest} */ - public final GetPipelineResponse getPipeline(Function> fn) throws IOException, OpenSearchException { return getPipeline(fn.apply(new GetPipelineRequest.Builder()).build()); @@ -138,52 +104,51 @@ public final GetPipelineResponse getPipeline(Function> fn) + throws IOException, OpenSearchException { + return processorGrok(fn.apply(new ProcessorGrokRequest.Builder()).build()); + } + + /** + * Returns a list of the built-in patterns. + */ + public final ProcessorGrokResponse processorGrok() throws IOException, OpenSearchException { + return processorGrok(new ProcessorGrokRequest.Builder().build()); } // ----- Endpoint: ingest.put_pipeline /** * Creates or updates a pipeline. - * - * */ - public PutPipelineResponse putPipeline(PutPipelineRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutPipelineRequest, - PutPipelineResponse, - ErrorResponse>) PutPipelineRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, PutPipelineRequest._ENDPOINT, this.transportOptions); } /** * Creates or updates a pipeline. * - * @param fn - * a function that initializes a builder to create the - * {@link PutPipelineRequest} - * + * @param fn a function that initializes a builder to create the {@link PutPipelineRequest} */ - public final PutPipelineResponse putPipeline(Function> fn) throws IOException, OpenSearchException { return putPipeline(fn.apply(new PutPipelineRequest.Builder()).build()); @@ -193,29 +158,16 @@ public final PutPipelineResponse putPipeline(Function endpoint = (JsonEndpoint< - SimulateRequest, - SimulateResponse, - ErrorResponse>) SimulateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, SimulateRequest._ENDPOINT, this.transportOptions); } /** * Allows to simulate a pipeline with example documents. * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateRequest} - * + * @param fn a function that initializes a builder to create the {@link SimulateRequest} */ - public final SimulateResponse simulate(Function> fn) throws IOException, OpenSearchException { return simulate(fn.apply(new SimulateRequest.Builder()).build()); @@ -223,12 +175,8 @@ public final SimulateResponse simulate(Function { + @Nullable private final String description; + @Nonnull + private final Map meta; + + @Nonnull private final List onFailure; + @Nonnull private final List processors; @Nullable @@ -63,20 +81,22 @@ public class Pipeline implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private Pipeline(Builder builder) { - this.description = builder.description; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); this.version = builder.version; - } - public static Pipeline of(Function> fn) { + public static Pipeline of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Description of the ingest pipeline. + *

* API name: {@code description} + *

*/ @Nullable public final String description() { @@ -84,15 +104,31 @@ public final String description() { } /** + * API name: {@code _meta} + */ + @Nonnull + public final Map meta() { + return this.meta; + } + + /** + * Processors to run immediately after a processor failure. + *

* API name: {@code on_failure} + *

*/ + @Nonnull public final List onFailure() { return this.onFailure; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

*/ + @Nonnull public final List processors() { return this.processors; } @@ -108,6 +144,7 @@ public final Long version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -115,121 +152,225 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.description != null) { generator.writeKey("description"); generator.write(this.description); + } + 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(); } + if (ApiTypeHelper.isDefined(this.onFailure)) { generator.writeKey("on_failure"); generator.writeStartArray(); for (Processor item0 : this.onFailure) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.processors)) { generator.writeKey("processors"); generator.writeStartArray(); for (Processor item0 : this.processors) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Pipeline}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String description; - + @Nullable + private Map meta; @Nullable private List onFailure; - @Nullable private List processors; - @Nullable private Long version; + public Builder() {} + + private Builder(Pipeline o) { + this.description = o.description; + this.meta = _mapCopy(o.meta); + this.onFailure = _listCopy(o.onFailure); + this.processors = _listCopy(o.processors); + this.version = o.version; + } + + private Builder(Builder o) { + this.description = o.description; + this.meta = _mapCopy(o.meta); + this.onFailure = _listCopy(o.onFailure); + this.processors = _listCopy(o.processors); + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Description of the ingest pipeline. + *

* API name: {@code description} + *

*/ + @Nonnull public final Builder description(@Nullable String value) { this.description = value; return this; } /** + * API name: {@code _meta} + * + *

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

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

+ * Adds an entry to meta. + *

+ */ + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + + /** + * Processors to run immediately after a processor failure. + *

* API name: {@code on_failure} + *

+ * *

* Adds all elements of list to onFailure. + *

*/ + @Nonnull public final Builder onFailure(List list) { this.onFailure = _listAddAll(this.onFailure, list); return this; } /** + * Processors to run immediately after a processor failure. + *

* API name: {@code on_failure} + *

+ * *

* Adds one or more values to onFailure. + *

*/ + @Nonnull public final Builder onFailure(Processor value, Processor... values) { this.onFailure = _listAdd(this.onFailure, value, values); return this; } /** + * Processors to run immediately after a processor failure. + *

* API name: {@code on_failure} + *

+ * *

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

*/ + @Nonnull public final Builder onFailure(Function> fn) { return onFailure(fn.apply(new Processor.Builder()).build()); } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

* Adds all elements of list to processors. + *

*/ + @Nonnull public final Builder processors(List list) { this.processors = _listAddAll(this.processors, list); return this; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

* Adds one or more values to processors. + *

*/ + @Nonnull public final Builder processors(Processor value, Processor... values) { this.processors = _listAdd(this.processors, value, values); return this; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

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

*/ + @Nonnull public final Builder processors(Function> fn) { return processors(fn.apply(new Processor.Builder()).build()); } @@ -237,6 +378,7 @@ public final Builder processors(Function op) { - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::onFailure, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "on_failure"); op.add(Builder::processors, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "processors"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + Objects.hashCode(this.onFailure); + result = 31 * result + Objects.hashCode(this.processors); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Pipeline other = (Pipeline) o; + return Objects.equals(this.description, other.description) + && Objects.equals(this.meta, other.meta) + && Objects.equals(this.onFailure, other.onFailure) + && Objects.equals(this.processors, other.processors) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java index 64266111d4..f56799ea7a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PipelineProcessor.java @@ -30,88 +30,168 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.PipelineProcessor +// typedef: ingest.PipelineProcessor @JsonpDeserializable -public class PipelineProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PipelineProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nullable + private final Boolean ignoreMissingPipeline; + + @Nonnull private final String name; // --------------------------------------------------------------------------------------------- private PipelineProcessor(Builder builder) { super(builder); - + this.ignoreMissingPipeline = builder.ignoreMissingPipeline; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - } - public static PipelineProcessor of(Function> fn) { + public static PipelineProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { return Processor.Kind.Pipeline; } + /** + * Whether to ignore missing pipelines instead of failing. + *

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

+ */ + @Nullable + public final Boolean ignoreMissingPipeline() { + return this.ignoreMissingPipeline; + } + /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); + if (this.ignoreMissingPipeline != null) { + generator.writeKey("ignore_missing_pipeline"); + generator.write(this.ignoreMissingPipeline); + } + generator.writeKey("name"); generator.write(this.name); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PipelineProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Boolean ignoreMissingPipeline; private String name; + public Builder() {} + + private Builder(PipelineProcessor o) { + super(o); + this.ignoreMissingPipeline = o.ignoreMissingPipeline; + this.name = o.name; + } + + private Builder(Builder o) { + super(o); + this.ignoreMissingPipeline = o.ignoreMissingPipeline; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** - * Required - API name: {@code name} + * Whether to ignore missing pipelines instead of failing. + *

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

*/ - public final Builder name(String value) { - this.name = value; + @Nonnull + public final Builder ignoreMissingPipeline(@Nullable Boolean value) { + this.ignoreMissingPipeline = value; return this; } - @Override - protected Builder self() { + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; return this; } /** * Builds a {@link PipelineProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PipelineProcessor build() { _checkSingleUse(); @@ -131,8 +211,26 @@ public PipelineProcessor build() { protected static void setupPipelineProcessorDeserializer(ObjectDeserializer op) { setupProcessorBaseDeserializer(op); + op.add(Builder::ignoreMissingPipeline, JsonpDeserializer.booleanDeserializer(), "ignore_missing_pipeline"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMissingPipeline); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PipelineProcessor other = (PipelineProcessor) o; + return Objects.equals(this.ignoreMissingPipeline, other.ignoreMissingPipeline) && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/Processor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/Processor.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/Processor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/Processor.java index 3bc8c0afea..f016292223 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/Processor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/Processor.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,6 +48,7 @@ import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -48,88 +56,48 @@ import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -// typedef: ingest._types.ProcessorContainer +// typedef: ingest.ProcessorContainer @JsonpDeserializable -public class Processor implements TaggedUnion, JsonpSerializable { - - /** - * {@link Processor} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Processor implements TaggedUnion, PlainJsonSerializable { /** * {@link Processor} variant kinds. */ - public enum Kind implements JsonEnum { - Attachment("attachment"), - Append("append"), - - Csv("csv"), - + Attachment("attachment"), + Bytes("bytes"), + Circle("circle"), Convert("convert"), - + Csv("csv"), Date("date"), - DateIndexName("date_index_name"), - + Dissect("dissect"), DotExpander("dot_expander"), - + Drop("drop"), Fail("fail"), - Foreach("foreach"), - - Json("json"), - - UserAgent("user_agent"), - - Kv("kv"), - Geoip("geoip"), - Grok("grok"), - Gsub("gsub"), - Join("join"), - + Json("json"), + Kv("kv"), Lowercase("lowercase"), - + Pipeline("pipeline"), Remove("remove"), - Rename("rename"), - Script("script"), - Set("set"), - + SetSecurityUser("set_security_user"), Sort("sort"), - Split("split"), - + TextEmbedding("text_embedding"), Trim("trim"), - Uppercase("uppercase"), - Urldecode("urldecode"), - - Bytes("bytes"), - - Dissect("dissect"), - - SetSecurityUser("set_security_user"), - - Pipeline("pipeline"), - - Drop("drop"), - - Circle("circle"), - - Inference("inference"), - - TextEmbedding("text_embedding"), - - ; + UserAgent("user_agent"); private final String jsonValue; @@ -137,14 +105,14 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; - private final Object _value; + private final ProcessorVariant _value; @Override public final Kind _kind() { @@ -152,28 +120,40 @@ public final Kind _kind() { } @Override - public final Object _get() { + public final ProcessorVariant _get() { return _value; } public Processor(ProcessorVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._processorKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private Processor(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static Processor of(Function> fn) { + public static Processor of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Is this variant instance of kind {@code append}? + */ + public boolean isAppend() { + return _kind == Kind.Append; + } + + /** + * Get the {@code append} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code append} kind. + */ + public AppendProcessor append() { + return TaggedUnionUtils.get(this, Kind.Append); + } + /** * Is this variant instance of kind {@code attachment}? */ @@ -184,45 +164,42 @@ public boolean isAttachment() { /** * Get the {@code attachment} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code attachment} kind. + * @throws IllegalStateException if the current variant is not the {@code attachment} kind. */ public AttachmentProcessor attachment() { return TaggedUnionUtils.get(this, Kind.Attachment); } /** - * Is this variant instance of kind {@code append}? + * Is this variant instance of kind {@code bytes}? */ - public boolean isAppend() { - return _kind == Kind.Append; + public boolean isBytes() { + return _kind == Kind.Bytes; } /** - * Get the {@code append} variant value. + * Get the {@code bytes} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code append} kind. + * @throws IllegalStateException if the current variant is not the {@code bytes} kind. */ - public AppendProcessor append() { - return TaggedUnionUtils.get(this, Kind.Append); + public BytesProcessor bytes() { + return TaggedUnionUtils.get(this, Kind.Bytes); } /** - * Is this variant instance of kind {@code csv}? + * Is this variant instance of kind {@code circle}? */ - public boolean isCsv() { - return _kind == Kind.Csv; + public boolean isCircle() { + return _kind == Kind.Circle; } /** - * Get the {@code csv} variant value. + * Get the {@code circle} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code csv} kind. + * @throws IllegalStateException if the current variant is not the {@code circle} kind. */ - public CsvProcessor csv() { - return TaggedUnionUtils.get(this, Kind.Csv); + public CircleProcessor circle() { + return TaggedUnionUtils.get(this, Kind.Circle); } /** @@ -235,13 +212,28 @@ public boolean isConvert() { /** * Get the {@code convert} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code convert} kind. + * @throws IllegalStateException if the current variant is not the {@code convert} kind. */ public ConvertProcessor convert() { return TaggedUnionUtils.get(this, Kind.Convert); } + /** + * Is this variant instance of kind {@code csv}? + */ + public boolean isCsv() { + return _kind == Kind.Csv; + } + + /** + * Get the {@code csv} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code csv} kind. + */ + public CsvProcessor csv() { + return TaggedUnionUtils.get(this, Kind.Csv); + } + /** * Is this variant instance of kind {@code date}? */ @@ -252,8 +244,7 @@ public boolean isDate() { /** * Get the {@code date} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date} kind. + * @throws IllegalStateException if the current variant is not the {@code date} kind. */ public DateProcessor date() { return TaggedUnionUtils.get(this, Kind.Date); @@ -269,114 +260,90 @@ public boolean isDateIndexName() { /** * Get the {@code date_index_name} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date_index_name} - * kind. + * @throws IllegalStateException if the current variant is not the {@code date_index_name} kind. */ public DateIndexNameProcessor dateIndexName() { return TaggedUnionUtils.get(this, Kind.DateIndexName); } /** - * Is this variant instance of kind {@code dot_expander}? - */ - public boolean isDotExpander() { - return _kind == Kind.DotExpander; - } - - /** - * Get the {@code dot_expander} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code dot_expander} kind. - */ - public DotExpanderProcessor dotExpander() { - return TaggedUnionUtils.get(this, Kind.DotExpander); - } - - /** - * Is this variant instance of kind {@code fail}? + * Is this variant instance of kind {@code dissect}? */ - public boolean isFail() { - return _kind == Kind.Fail; + public boolean isDissect() { + return _kind == Kind.Dissect; } /** - * Get the {@code fail} variant value. + * Get the {@code dissect} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code fail} kind. + * @throws IllegalStateException if the current variant is not the {@code dissect} kind. */ - public FailProcessor fail() { - return TaggedUnionUtils.get(this, Kind.Fail); + public DissectProcessor dissect() { + return TaggedUnionUtils.get(this, Kind.Dissect); } /** - * Is this variant instance of kind {@code foreach}? + * Is this variant instance of kind {@code dot_expander}? */ - public boolean isForeach() { - return _kind == Kind.Foreach; + public boolean isDotExpander() { + return _kind == Kind.DotExpander; } /** - * Get the {@code foreach} variant value. + * Get the {@code dot_expander} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code foreach} kind. + * @throws IllegalStateException if the current variant is not the {@code dot_expander} kind. */ - public ForeachProcessor foreach() { - return TaggedUnionUtils.get(this, Kind.Foreach); + public DotExpanderProcessor dotExpander() { + return TaggedUnionUtils.get(this, Kind.DotExpander); } /** - * Is this variant instance of kind {@code json}? + * Is this variant instance of kind {@code drop}? */ - public boolean isJson() { - return _kind == Kind.Json; + public boolean isDrop() { + return _kind == Kind.Drop; } /** - * Get the {@code json} variant value. + * Get the {@code drop} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code json} kind. + * @throws IllegalStateException if the current variant is not the {@code drop} kind. */ - public JsonProcessor json() { - return TaggedUnionUtils.get(this, Kind.Json); + public DropProcessor drop() { + return TaggedUnionUtils.get(this, Kind.Drop); } /** - * Is this variant instance of kind {@code user_agent}? + * Is this variant instance of kind {@code fail}? */ - public boolean isUserAgent() { - return _kind == Kind.UserAgent; + public boolean isFail() { + return _kind == Kind.Fail; } /** - * Get the {@code user_agent} variant value. + * Get the {@code fail} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code user_agent} kind. + * @throws IllegalStateException if the current variant is not the {@code fail} kind. */ - public UserAgentProcessor userAgent() { - return TaggedUnionUtils.get(this, Kind.UserAgent); + public FailProcessor fail() { + return TaggedUnionUtils.get(this, Kind.Fail); } /** - * Is this variant instance of kind {@code kv}? + * Is this variant instance of kind {@code foreach}? */ - public boolean isKv() { - return _kind == Kind.Kv; + public boolean isForeach() { + return _kind == Kind.Foreach; } /** - * Get the {@code kv} variant value. + * Get the {@code foreach} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code kv} kind. + * @throws IllegalStateException if the current variant is not the {@code foreach} kind. */ - public KeyValueProcessor kv() { - return TaggedUnionUtils.get(this, Kind.Kv); + public ForeachProcessor foreach() { + return TaggedUnionUtils.get(this, Kind.Foreach); } /** @@ -389,8 +356,7 @@ public boolean isGeoip() { /** * Get the {@code geoip} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geoip} kind. + * @throws IllegalStateException if the current variant is not the {@code geoip} kind. */ public GeoIpProcessor geoip() { return TaggedUnionUtils.get(this, Kind.Geoip); @@ -406,8 +372,7 @@ public boolean isGrok() { /** * Get the {@code grok} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code grok} kind. + * @throws IllegalStateException if the current variant is not the {@code grok} kind. */ public GrokProcessor grok() { return TaggedUnionUtils.get(this, Kind.Grok); @@ -423,8 +388,7 @@ public boolean isGsub() { /** * Get the {@code gsub} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code gsub} kind. + * @throws IllegalStateException if the current variant is not the {@code gsub} kind. */ public GsubProcessor gsub() { return TaggedUnionUtils.get(this, Kind.Gsub); @@ -440,13 +404,44 @@ public boolean isJoin() { /** * Get the {@code join} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code join} kind. + * @throws IllegalStateException if the current variant is not the {@code join} kind. */ public JoinProcessor join() { return TaggedUnionUtils.get(this, Kind.Join); } + /** + * Is this variant instance of kind {@code json}? + */ + public boolean isJson() { + return _kind == Kind.Json; + } + + /** + * Get the {@code json} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code json} kind. + */ + public JsonProcessor json() { + return TaggedUnionUtils.get(this, Kind.Json); + } + + /** + * Is this variant instance of kind {@code kv}? + */ + public boolean isKv() { + return _kind == Kind.Kv; + } + + /** + * Get the {@code kv} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code kv} kind. + */ + public KeyValueProcessor kv() { + return TaggedUnionUtils.get(this, Kind.Kv); + } + /** * Is this variant instance of kind {@code lowercase}? */ @@ -457,13 +452,28 @@ public boolean isLowercase() { /** * Get the {@code lowercase} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code lowercase} kind. + * @throws IllegalStateException if the current variant is not the {@code lowercase} kind. */ public LowercaseProcessor lowercase() { return TaggedUnionUtils.get(this, Kind.Lowercase); } + /** + * Is this variant instance of kind {@code pipeline}? + */ + public boolean isPipeline() { + return _kind == Kind.Pipeline; + } + + /** + * Get the {@code pipeline} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code pipeline} kind. + */ + public PipelineProcessor pipeline() { + return TaggedUnionUtils.get(this, Kind.Pipeline); + } + /** * Is this variant instance of kind {@code remove}? */ @@ -474,8 +484,7 @@ public boolean isRemove() { /** * Get the {@code remove} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code remove} kind. + * @throws IllegalStateException if the current variant is not the {@code remove} kind. */ public RemoveProcessor remove() { return TaggedUnionUtils.get(this, Kind.Remove); @@ -491,8 +500,7 @@ public boolean isRename() { /** * Get the {@code rename} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code rename} kind. + * @throws IllegalStateException if the current variant is not the {@code rename} kind. */ public RenameProcessor rename() { return TaggedUnionUtils.get(this, Kind.Rename); @@ -508,8 +516,7 @@ public boolean isScript() { /** * Get the {@code script} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code script} kind. + * @throws IllegalStateException if the current variant is not the {@code script} kind. */ public Script script() { return TaggedUnionUtils.get(this, Kind.Script); @@ -525,13 +532,28 @@ public boolean isSet() { /** * Get the {@code set} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code set} kind. + * @throws IllegalStateException if the current variant is not the {@code set} kind. */ public SetProcessor set() { return TaggedUnionUtils.get(this, Kind.Set); } + /** + * Is this variant instance of kind {@code set_security_user}? + */ + public boolean isSetSecurityUser() { + return _kind == Kind.SetSecurityUser; + } + + /** + * Get the {@code set_security_user} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code set_security_user} kind. + */ + public SetSecurityUserProcessor setSecurityUser() { + return TaggedUnionUtils.get(this, Kind.SetSecurityUser); + } + /** * Is this variant instance of kind {@code sort}? */ @@ -542,8 +564,7 @@ public boolean isSort() { /** * Get the {@code sort} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code sort} kind. + * @throws IllegalStateException if the current variant is not the {@code sort} kind. */ public SortProcessor sort() { return TaggedUnionUtils.get(this, Kind.Sort); @@ -559,13 +580,28 @@ public boolean isSplit() { /** * Get the {@code split} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code split} kind. + * @throws IllegalStateException if the current variant is not the {@code split} kind. */ public SplitProcessor split() { return TaggedUnionUtils.get(this, Kind.Split); } + /** + * Is this variant instance of kind {@code text_embedding}? + */ + public boolean isTextEmbedding() { + return _kind == Kind.TextEmbedding; + } + + /** + * Get the {@code text_embedding} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code text_embedding} kind. + */ + public TextEmbeddingProcessor textEmbedding() { + return TaggedUnionUtils.get(this, Kind.TextEmbedding); + } + /** * Is this variant instance of kind {@code trim}? */ @@ -576,8 +612,7 @@ public boolean isTrim() { /** * Get the {@code trim} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code trim} kind. + * @throws IllegalStateException if the current variant is not the {@code trim} kind. */ public TrimProcessor trim() { return TaggedUnionUtils.get(this, Kind.Trim); @@ -593,8 +628,7 @@ public boolean isUppercase() { /** * Get the {@code uppercase} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code uppercase} kind. + * @throws IllegalStateException if the current variant is not the {@code uppercase} kind. */ public UppercaseProcessor uppercase() { return TaggedUnionUtils.get(this, Kind.Uppercase); @@ -610,168 +644,68 @@ public boolean isUrldecode() { /** * Get the {@code urldecode} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code urldecode} kind. + * @throws IllegalStateException if the current variant is not the {@code urldecode} kind. */ public UrlDecodeProcessor urldecode() { return TaggedUnionUtils.get(this, Kind.Urldecode); } /** - * Is this variant instance of kind {@code bytes}? - */ - public boolean isBytes() { - return _kind == Kind.Bytes; - } - - /** - * Get the {@code bytes} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code bytes} kind. - */ - public BytesProcessor bytes() { - return TaggedUnionUtils.get(this, Kind.Bytes); - } - - /** - * Is this variant instance of kind {@code dissect}? - */ - public boolean isDissect() { - return _kind == Kind.Dissect; - } - - /** - * Get the {@code dissect} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code dissect} kind. - */ - public DissectProcessor dissect() { - return TaggedUnionUtils.get(this, Kind.Dissect); - } - - /** - * Is this variant instance of kind {@code set_security_user}? - */ - public boolean isSetSecurityUser() { - return _kind == Kind.SetSecurityUser; - } - - /** - * Get the {@code set_security_user} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code set_security_user} - * kind. - */ - public SetSecurityUserProcessor setSecurityUser() { - return TaggedUnionUtils.get(this, Kind.SetSecurityUser); - } - - /** - * Is this variant instance of kind {@code pipeline}? - */ - public boolean isPipeline() { - return _kind == Kind.Pipeline; - } - - /** - * Get the {@code pipeline} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code pipeline} kind. - */ - public PipelineProcessor pipeline() { - return TaggedUnionUtils.get(this, Kind.Pipeline); - } - - /** - * Is this variant instance of kind {@code drop}? - */ - public boolean isDrop() { - return _kind == Kind.Drop; - } - - /** - * Get the {@code drop} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code drop} kind. - */ - public DropProcessor drop() { - return TaggedUnionUtils.get(this, Kind.Drop); - } - - /** - * Is this variant instance of kind {@code circle}? - */ - public boolean isCircle() { - return _kind == Kind.Circle; - } - - /** - * Get the {@code circle} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code circle} kind. - */ - public CircleProcessor circle() { - return TaggedUnionUtils.get(this, Kind.Circle); - } - - /** - * Is this variant instance of kind {@code inference}? - */ - public boolean isInference() { - return _kind == Kind.Inference; - } - - /** - * Get the {@code inference} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code inference} kind. - */ - public InferenceProcessor inference() { - return TaggedUnionUtils.get(this, Kind.Inference); - } - - /** - * Is this variant instance of kind {@code text_embedding}? + * Is this variant instance of kind {@code user_agent}? */ - public boolean isTextEmbedding() { - return _kind == Kind.TextEmbedding; + public boolean isUserAgent() { + return _kind == Kind.UserAgent; } /** - * Get the {@code text_embedding} variant value. + * Get the {@code user_agent} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code text_embedding} kind. + * @throws IllegalStateException if the current variant is not the {@code user_agent} kind. */ - public TextEmbeddingProcessor textEmbedding() { - return TaggedUnionUtils.get(this, Kind.TextEmbedding); + public UserAgentProcessor userAgent() { + return TaggedUnionUtils.get(this, Kind.UserAgent); } @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(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; - private Object _value; + private ProcessorVariant _value; + + public Builder() {} + + private Builder(Processor o) { + this._kind = o._kind; + this._value = o._value; + } + + public ObjectBuilder append(AppendProcessor v) { + this._kind = Kind.Append; + this._value = v; + return this; + } + + public ObjectBuilder append(Function> fn) { + return this.append(fn.apply(new AppendProcessor.Builder()).build()); + } public ObjectBuilder attachment(AttachmentProcessor v) { this._kind = Kind.Attachment; @@ -783,24 +717,24 @@ public ObjectBuilder attachment(Function append(AppendProcessor v) { - this._kind = Kind.Append; + public ObjectBuilder bytes(BytesProcessor v) { + this._kind = Kind.Bytes; this._value = v; return this; } - public ObjectBuilder append(Function> fn) { - return this.append(fn.apply(new AppendProcessor.Builder()).build()); + public ObjectBuilder bytes(Function> fn) { + return this.bytes(fn.apply(new BytesProcessor.Builder()).build()); } - public ObjectBuilder csv(CsvProcessor v) { - this._kind = Kind.Csv; + public ObjectBuilder circle(CircleProcessor v) { + this._kind = Kind.Circle; this._value = v; return this; } - public ObjectBuilder csv(Function> fn) { - return this.csv(fn.apply(new CsvProcessor.Builder()).build()); + public ObjectBuilder circle(Function> fn) { + return this.circle(fn.apply(new CircleProcessor.Builder()).build()); } public ObjectBuilder convert(ConvertProcessor v) { @@ -813,6 +747,16 @@ public ObjectBuilder convert(Function csv(CsvProcessor v) { + this._kind = Kind.Csv; + this._value = v; + return this; + } + + public ObjectBuilder csv(Function> fn) { + return this.csv(fn.apply(new CsvProcessor.Builder()).build()); + } + public ObjectBuilder date(DateProcessor v) { this._kind = Kind.Date; this._value = v; @@ -833,64 +777,54 @@ public ObjectBuilder dateIndexName(Function dotExpander(DotExpanderProcessor v) { - this._kind = Kind.DotExpander; - this._value = v; - return this; - } - - public ObjectBuilder dotExpander(Function> fn) { - return this.dotExpander(fn.apply(new DotExpanderProcessor.Builder()).build()); - } - - public ObjectBuilder fail(FailProcessor v) { - this._kind = Kind.Fail; + public ObjectBuilder dissect(DissectProcessor v) { + this._kind = Kind.Dissect; this._value = v; return this; } - public ObjectBuilder fail(Function> fn) { - return this.fail(fn.apply(new FailProcessor.Builder()).build()); + public ObjectBuilder dissect(Function> fn) { + return this.dissect(fn.apply(new DissectProcessor.Builder()).build()); } - public ObjectBuilder foreach(ForeachProcessor v) { - this._kind = Kind.Foreach; + public ObjectBuilder dotExpander(DotExpanderProcessor v) { + this._kind = Kind.DotExpander; this._value = v; return this; } - public ObjectBuilder foreach(Function> fn) { - return this.foreach(fn.apply(new ForeachProcessor.Builder()).build()); + public ObjectBuilder dotExpander(Function> fn) { + return this.dotExpander(fn.apply(new DotExpanderProcessor.Builder()).build()); } - public ObjectBuilder json(JsonProcessor v) { - this._kind = Kind.Json; + public ObjectBuilder drop(DropProcessor v) { + this._kind = Kind.Drop; this._value = v; return this; } - public ObjectBuilder json(Function> fn) { - return this.json(fn.apply(new JsonProcessor.Builder()).build()); + public ObjectBuilder drop(Function> fn) { + return this.drop(fn.apply(new DropProcessor.Builder()).build()); } - public ObjectBuilder userAgent(UserAgentProcessor v) { - this._kind = Kind.UserAgent; + public ObjectBuilder fail(FailProcessor v) { + this._kind = Kind.Fail; this._value = v; return this; } - public ObjectBuilder userAgent(Function> fn) { - return this.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); + public ObjectBuilder fail(Function> fn) { + return this.fail(fn.apply(new FailProcessor.Builder()).build()); } - public ObjectBuilder kv(KeyValueProcessor v) { - this._kind = Kind.Kv; + public ObjectBuilder foreach(ForeachProcessor v) { + this._kind = Kind.Foreach; this._value = v; return this; } - public ObjectBuilder kv(Function> fn) { - return this.kv(fn.apply(new KeyValueProcessor.Builder()).build()); + public ObjectBuilder foreach(Function> fn) { + return this.foreach(fn.apply(new ForeachProcessor.Builder()).build()); } public ObjectBuilder geoip(GeoIpProcessor v) { @@ -933,6 +867,26 @@ public ObjectBuilder join(Function json(JsonProcessor v) { + this._kind = Kind.Json; + this._value = v; + return this; + } + + public ObjectBuilder json(Function> fn) { + return this.json(fn.apply(new JsonProcessor.Builder()).build()); + } + + public ObjectBuilder kv(KeyValueProcessor v) { + this._kind = Kind.Kv; + this._value = v; + return this; + } + + public ObjectBuilder kv(Function> fn) { + return this.kv(fn.apply(new KeyValueProcessor.Builder()).build()); + } + public ObjectBuilder lowercase(LowercaseProcessor v) { this._kind = Kind.Lowercase; this._value = v; @@ -943,6 +897,16 @@ public ObjectBuilder lowercase(Function pipeline(PipelineProcessor v) { + this._kind = Kind.Pipeline; + this._value = v; + return this; + } + + public ObjectBuilder pipeline(Function> fn) { + return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); + } + public ObjectBuilder remove(RemoveProcessor v) { this._kind = Kind.Remove; this._value = v; @@ -983,6 +947,18 @@ public ObjectBuilder set(Function setSecurityUser(SetSecurityUserProcessor v) { + this._kind = Kind.SetSecurityUser; + this._value = v; + return this; + } + + public ObjectBuilder setSecurityUser( + Function> fn + ) { + return this.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); + } + public ObjectBuilder sort(SortProcessor v) { this._kind = Kind.Sort; this._value = v; @@ -1003,6 +979,16 @@ public ObjectBuilder split(Function textEmbedding(TextEmbeddingProcessor v) { + this._kind = Kind.TextEmbedding; + this._value = v; + return this; + } + + public ObjectBuilder textEmbedding(Function> fn) { + return this.textEmbedding(fn.apply(new TextEmbeddingProcessor.Builder()).build()); + } + public ObjectBuilder trim(TrimProcessor v) { this._kind = Kind.Trim; this._value = v; @@ -1033,132 +1019,57 @@ public ObjectBuilder urldecode(Function bytes(BytesProcessor v) { - this._kind = Kind.Bytes; - this._value = v; - return this; - } - - public ObjectBuilder bytes(Function> fn) { - return this.bytes(fn.apply(new BytesProcessor.Builder()).build()); - } - - public ObjectBuilder dissect(DissectProcessor v) { - this._kind = Kind.Dissect; - this._value = v; - return this; - } - - public ObjectBuilder dissect(Function> fn) { - return this.dissect(fn.apply(new DissectProcessor.Builder()).build()); - } - - public ObjectBuilder setSecurityUser(SetSecurityUserProcessor v) { - this._kind = Kind.SetSecurityUser; - this._value = v; - return this; - } - - public ObjectBuilder setSecurityUser( - Function> fn - ) { - return this.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); - } - - public ObjectBuilder pipeline(PipelineProcessor v) { - this._kind = Kind.Pipeline; - this._value = v; - return this; - } - - public ObjectBuilder pipeline(Function> fn) { - return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); - } - - public ObjectBuilder drop(DropProcessor v) { - this._kind = Kind.Drop; - this._value = v; - return this; - } - - public ObjectBuilder drop(Function> fn) { - return this.drop(fn.apply(new DropProcessor.Builder()).build()); - } - - public ObjectBuilder circle(CircleProcessor v) { - this._kind = Kind.Circle; - this._value = v; - return this; - } - - public ObjectBuilder circle(Function> fn) { - return this.circle(fn.apply(new CircleProcessor.Builder()).build()); - } - - public ObjectBuilder inference(InferenceProcessor v) { - this._kind = Kind.Inference; - this._value = v; - return this; - } - - public ObjectBuilder inference(Function> fn) { - return this.inference(fn.apply(new InferenceProcessor.Builder()).build()); - } - - public ObjectBuilder textEmbedding(TextEmbeddingProcessor v) { - this._kind = Kind.TextEmbedding; + public ObjectBuilder userAgent(UserAgentProcessor v) { + this._kind = Kind.UserAgent; this._value = v; return this; } - public ObjectBuilder textEmbedding(Function> fn) { - return this.textEmbedding(fn.apply(new TextEmbeddingProcessor.Builder()).build()); + public ObjectBuilder userAgent(Function> fn) { + return this.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); } + @Override public Processor build() { _checkSingleUse(); return new Processor(this); } - } protected static void setupProcessorDeserializer(ObjectDeserializer op) { - - op.add(Builder::attachment, AttachmentProcessor._DESERIALIZER, "attachment"); op.add(Builder::append, AppendProcessor._DESERIALIZER, "append"); - op.add(Builder::csv, CsvProcessor._DESERIALIZER, "csv"); + op.add(Builder::attachment, AttachmentProcessor._DESERIALIZER, "attachment"); + op.add(Builder::bytes, BytesProcessor._DESERIALIZER, "bytes"); + op.add(Builder::circle, CircleProcessor._DESERIALIZER, "circle"); op.add(Builder::convert, ConvertProcessor._DESERIALIZER, "convert"); + op.add(Builder::csv, CsvProcessor._DESERIALIZER, "csv"); op.add(Builder::date, DateProcessor._DESERIALIZER, "date"); op.add(Builder::dateIndexName, DateIndexNameProcessor._DESERIALIZER, "date_index_name"); + op.add(Builder::dissect, DissectProcessor._DESERIALIZER, "dissect"); op.add(Builder::dotExpander, DotExpanderProcessor._DESERIALIZER, "dot_expander"); + op.add(Builder::drop, DropProcessor._DESERIALIZER, "drop"); op.add(Builder::fail, FailProcessor._DESERIALIZER, "fail"); op.add(Builder::foreach, ForeachProcessor._DESERIALIZER, "foreach"); - op.add(Builder::json, JsonProcessor._DESERIALIZER, "json"); - op.add(Builder::userAgent, UserAgentProcessor._DESERIALIZER, "user_agent"); - op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::geoip, GeoIpProcessor._DESERIALIZER, "geoip"); op.add(Builder::grok, GrokProcessor._DESERIALIZER, "grok"); op.add(Builder::gsub, GsubProcessor._DESERIALIZER, "gsub"); op.add(Builder::join, JoinProcessor._DESERIALIZER, "join"); + op.add(Builder::json, JsonProcessor._DESERIALIZER, "json"); + op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::lowercase, LowercaseProcessor._DESERIALIZER, "lowercase"); + op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); op.add(Builder::remove, RemoveProcessor._DESERIALIZER, "remove"); op.add(Builder::rename, RenameProcessor._DESERIALIZER, "rename"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::set, SetProcessor._DESERIALIZER, "set"); + op.add(Builder::setSecurityUser, SetSecurityUserProcessor._DESERIALIZER, "set_security_user"); op.add(Builder::sort, SortProcessor._DESERIALIZER, "sort"); op.add(Builder::split, SplitProcessor._DESERIALIZER, "split"); + op.add(Builder::textEmbedding, TextEmbeddingProcessor._DESERIALIZER, "text_embedding"); op.add(Builder::trim, TrimProcessor._DESERIALIZER, "trim"); op.add(Builder::uppercase, UppercaseProcessor._DESERIALIZER, "uppercase"); op.add(Builder::urldecode, UrlDecodeProcessor._DESERIALIZER, "urldecode"); - op.add(Builder::bytes, BytesProcessor._DESERIALIZER, "bytes"); - op.add(Builder::dissect, DissectProcessor._DESERIALIZER, "dissect"); - op.add(Builder::setSecurityUser, SetSecurityUserProcessor._DESERIALIZER, "set_security_user"); - op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); - op.add(Builder::drop, DropProcessor._DESERIALIZER, "drop"); - op.add(Builder::circle, CircleProcessor._DESERIALIZER, "circle"); - op.add(Builder::inference, InferenceProcessor._DESERIALIZER, "inference"); - op.add(Builder::textEmbedding, TextEmbeddingProcessor._DESERIALIZER, "text_embedding"); - + op.add(Builder::userAgent, UserAgentProcessor._DESERIALIZER, "user_agent"); } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -1166,4 +1077,20 @@ protected static void setupProcessorDeserializer(ObjectDeserializer op) Processor::setupProcessorDeserializer, Builder::build ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Processor other = (Processor) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java index 2a8ff8dc0d..f9581d9d27 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBase.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,15 +51,21 @@ import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: ingest._types.ProcessorBase +// typedef: ingest.ProcessorBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class ProcessorBase implements PlainJsonSerializable { + + @Nullable + private final String description; + @Nullable private final String if_; @Nullable private final Boolean ignoreFailure; + @Nonnull private final List onFailure; @Nullable @@ -61,16 +74,29 @@ public abstract class ProcessorBase implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- protected ProcessorBase(AbstractBuilder builder) { - + this.description = builder.description; this.if_ = builder.if_; this.ignoreFailure = builder.ignoreFailure; this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.tag = builder.tag; + } + /** + * Description of the processor. Useful for describing the purpose of the processor or its configuration. + *

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

+ */ + @Nullable + public final String description() { + return this.description; } /** + * Conditionally execute the processor. + *

* API name: {@code if} + *

*/ @Nullable public final String if_() { @@ -78,7 +104,10 @@ public final String if_() { } /** + * Ignore failures for the processor. + *

* API name: {@code ignore_failure} + *

*/ @Nullable public final Boolean ignoreFailure() { @@ -86,14 +115,21 @@ public final Boolean ignoreFailure() { } /** + * Handle failures for the processor. + *

* API name: {@code on_failure} + *

*/ + @Nonnull public final List onFailure() { return this.onFailure; } /** + * Identifier for the processor. Useful for debugging and metrics. + *

* API name: {@code tag} + *

*/ @Nullable public final String tag() { @@ -103,6 +139,7 @@ public final String tag() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,113 +147,197 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } if (this.if_ != null) { generator.writeKey("if"); generator.write(this.if_); - } + if (this.ignoreFailure != null) { generator.writeKey("ignore_failure"); generator.write(this.ignoreFailure); - } + if (ApiTypeHelper.isDefined(this.onFailure)) { generator.writeKey("on_failure"); generator.writeStartArray(); for (Processor item0 : this.onFailure) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.tag != null) { generator.writeKey("tag"); generator.write(this.tag); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable + private String description; @Nullable private String if_; - @Nullable private Boolean ignoreFailure; - @Nullable private List onFailure; - @Nullable private String tag; + protected AbstractBuilder() {} + + protected AbstractBuilder(ProcessorBase o) { + this.description = o.description; + this.if_ = o.if_; + this.ignoreFailure = o.ignoreFailure; + this.onFailure = _listCopy(o.onFailure); + this.tag = o.tag; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.description = o.description; + this.if_ = o.if_; + this.ignoreFailure = o.ignoreFailure; + this.onFailure = _listCopy(o.onFailure); + this.tag = o.tag; + } + + @Nonnull + protected abstract BuilderT self(); + /** + * Description of the processor. Useful for describing the purpose of the processor or its configuration. + *

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

+ */ + @Nonnull + public final BuilderT description(@Nullable String value) { + this.description = value; + return self(); + } + + /** + * Conditionally execute the processor. + *

* API name: {@code if} + *

*/ + @Nonnull public final BuilderT if_(@Nullable String value) { this.if_ = value; return self(); } /** + * Ignore failures for the processor. + *

* API name: {@code ignore_failure} + *

*/ + @Nonnull public final BuilderT ignoreFailure(@Nullable Boolean value) { this.ignoreFailure = value; return self(); } /** + * Handle failures for the processor. + *

* API name: {@code on_failure} + *

+ * *

* Adds all elements of list to onFailure. + *

*/ + @Nonnull public final BuilderT onFailure(List list) { this.onFailure = _listAddAll(this.onFailure, list); return self(); } /** + * Handle failures for the processor. + *

* API name: {@code on_failure} + *

+ * *

* Adds one or more values to onFailure. + *

*/ + @Nonnull public final BuilderT onFailure(Processor value, Processor... values) { this.onFailure = _listAdd(this.onFailure, value, values); return self(); } /** + * Handle failures for the processor. + *

* API name: {@code on_failure} + *

+ * *

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

*/ + @Nonnull public final BuilderT onFailure(Function> fn) { return onFailure(fn.apply(new Processor.Builder()).build()); } /** + * Identifier for the processor. Useful for debugging and metrics. + *

* API name: {@code tag} + *

*/ + @Nonnull public final BuilderT tag(@Nullable String value) { this.tag = value; return self(); } - - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- - protected static > void setupProcessorBaseDeserializer(ObjectDeserializer op) { + protected static > void setupProcessorBaseDeserializer(ObjectDeserializer op) { + op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); op.add(AbstractBuilder::if_, JsonpDeserializer.stringDeserializer(), "if"); op.add(AbstractBuilder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); op.add(AbstractBuilder::onFailure, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "on_failure"); op.add(AbstractBuilder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.if_); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.onFailure); + result = 31 * result + Objects.hashCode(this.tag); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ProcessorBase other = (ProcessorBase) o; + return Objects.equals(this.description, other.description) + && Objects.equals(this.if_, other.if_) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.onFailure, other.onFailure) + && Objects.equals(this.tag, other.tag); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java index 921ce75f6a..a84a50c409 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorBuilders.java @@ -30,162 +30,178 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; +import javax.annotation.Generated; import org.opensearch.client.opensearch._types.Script; /** * Builders for {@link Processor} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ProcessorBuilders { private ProcessorBuilders() {} /** - * Creates a builder for the {@link AttachmentProcessor attachment} - * {@code Processor} variant. + * Creates a builder for the {@link AppendProcessor append} {@code Processor} variant. + */ + public static AppendProcessor.Builder append() { + return new AppendProcessor.Builder(); + } + + /** + * Creates a builder for the {@link AttachmentProcessor attachment} {@code Processor} variant. */ public static AttachmentProcessor.Builder attachment() { return new AttachmentProcessor.Builder(); } /** - * Creates a builder for the {@link AppendProcessor append} {@code Processor} - * variant. + * Creates a builder for the {@link BytesProcessor bytes} {@code Processor} variant. */ - public static AppendProcessor.Builder append() { - return new AppendProcessor.Builder(); + public static BytesProcessor.Builder bytes() { + return new BytesProcessor.Builder(); } /** - * Creates a builder for the {@link CsvProcessor csv} {@code Processor} variant. + * Creates a builder for the {@link CircleProcessor circle} {@code Processor} variant. */ - public static CsvProcessor.Builder csv() { - return new CsvProcessor.Builder(); + public static CircleProcessor.Builder circle() { + return new CircleProcessor.Builder(); } /** - * Creates a builder for the {@link ConvertProcessor convert} {@code Processor} - * variant. + * Creates a builder for the {@link ConvertProcessor convert} {@code Processor} variant. */ public static ConvertProcessor.Builder convert() { return new ConvertProcessor.Builder(); } /** - * Creates a builder for the {@link DateProcessor date} {@code Processor} - * variant. + * Creates a builder for the {@link CsvProcessor csv} {@code Processor} variant. */ - public static DateProcessor.Builder date() { - return new DateProcessor.Builder(); + public static CsvProcessor.Builder csv() { + return new CsvProcessor.Builder(); } /** - * Creates a builder for the {@link DateIndexNameProcessor date_index_name} - * {@code Processor} variant. + * Creates a builder for the {@link DateProcessor date} {@code Processor} variant. */ - public static DateIndexNameProcessor.Builder dateIndexName() { - return new DateIndexNameProcessor.Builder(); + public static DateProcessor.Builder date() { + return new DateProcessor.Builder(); } /** - * Creates a builder for the {@link DotExpanderProcessor dot_expander} - * {@code Processor} variant. + * Creates a builder for the {@link DateIndexNameProcessor date_index_name} {@code Processor} variant. */ - public static DotExpanderProcessor.Builder dotExpander() { - return new DotExpanderProcessor.Builder(); + public static DateIndexNameProcessor.Builder dateIndexName() { + return new DateIndexNameProcessor.Builder(); } /** - * Creates a builder for the {@link FailProcessor fail} {@code Processor} - * variant. + * Creates a builder for the {@link DissectProcessor dissect} {@code Processor} variant. */ - public static FailProcessor.Builder fail() { - return new FailProcessor.Builder(); + public static DissectProcessor.Builder dissect() { + return new DissectProcessor.Builder(); } /** - * Creates a builder for the {@link ForeachProcessor foreach} {@code Processor} - * variant. + * Creates a builder for the {@link DotExpanderProcessor dot_expander} {@code Processor} variant. */ - public static ForeachProcessor.Builder foreach() { - return new ForeachProcessor.Builder(); + public static DotExpanderProcessor.Builder dotExpander() { + return new DotExpanderProcessor.Builder(); } /** - * Creates a builder for the {@link JsonProcessor json} {@code Processor} - * variant. + * Creates a builder for the {@link DropProcessor drop} {@code Processor} variant. */ - public static JsonProcessor.Builder json() { - return new JsonProcessor.Builder(); + public static DropProcessor.Builder drop() { + return new DropProcessor.Builder(); } /** - * Creates a builder for the {@link UserAgentProcessor user_agent} - * {@code Processor} variant. + * Creates a builder for the {@link FailProcessor fail} {@code Processor} variant. */ - public static UserAgentProcessor.Builder userAgent() { - return new UserAgentProcessor.Builder(); + public static FailProcessor.Builder fail() { + return new FailProcessor.Builder(); } /** - * Creates a builder for the {@link KeyValueProcessor kv} {@code Processor} - * variant. + * Creates a builder for the {@link ForeachProcessor foreach} {@code Processor} variant. */ - public static KeyValueProcessor.Builder kv() { - return new KeyValueProcessor.Builder(); + public static ForeachProcessor.Builder foreach() { + return new ForeachProcessor.Builder(); } /** - * Creates a builder for the {@link GeoIpProcessor geoip} {@code Processor} - * variant. + * Creates a builder for the {@link GeoIpProcessor geoip} {@code Processor} variant. */ public static GeoIpProcessor.Builder geoip() { return new GeoIpProcessor.Builder(); } /** - * Creates a builder for the {@link GrokProcessor grok} {@code Processor} - * variant. + * Creates a builder for the {@link GrokProcessor grok} {@code Processor} variant. */ public static GrokProcessor.Builder grok() { return new GrokProcessor.Builder(); } /** - * Creates a builder for the {@link GsubProcessor gsub} {@code Processor} - * variant. + * Creates a builder for the {@link GsubProcessor gsub} {@code Processor} variant. */ public static GsubProcessor.Builder gsub() { return new GsubProcessor.Builder(); } /** - * Creates a builder for the {@link JoinProcessor join} {@code Processor} - * variant. + * Creates a builder for the {@link JoinProcessor join} {@code Processor} variant. */ public static JoinProcessor.Builder join() { return new JoinProcessor.Builder(); } /** - * Creates a builder for the {@link LowercaseProcessor lowercase} - * {@code Processor} variant. + * Creates a builder for the {@link JsonProcessor json} {@code Processor} variant. + */ + public static JsonProcessor.Builder json() { + return new JsonProcessor.Builder(); + } + + /** + * Creates a builder for the {@link KeyValueProcessor kv} {@code Processor} variant. + */ + public static KeyValueProcessor.Builder kv() { + return new KeyValueProcessor.Builder(); + } + + /** + * Creates a builder for the {@link LowercaseProcessor lowercase} {@code Processor} variant. */ public static LowercaseProcessor.Builder lowercase() { return new LowercaseProcessor.Builder(); } /** - * Creates a builder for the {@link RemoveProcessor remove} {@code Processor} - * variant. + * Creates a builder for the {@link PipelineProcessor pipeline} {@code Processor} variant. + */ + public static PipelineProcessor.Builder pipeline() { + return new PipelineProcessor.Builder(); + } + + /** + * Creates a builder for the {@link RemoveProcessor remove} {@code Processor} variant. */ public static RemoveProcessor.Builder remove() { return new RemoveProcessor.Builder(); } /** - * Creates a builder for the {@link RenameProcessor rename} {@code Processor} - * variant. + * Creates a builder for the {@link RenameProcessor rename} {@code Processor} variant. */ public static RenameProcessor.Builder rename() { return new RenameProcessor.Builder(); @@ -206,107 +222,58 @@ public static SetProcessor.Builder set() { } /** - * Creates a builder for the {@link SortProcessor sort} {@code Processor} - * variant. + * Creates a builder for the {@link SetSecurityUserProcessor set_security_user} {@code Processor} variant. + */ + public static SetSecurityUserProcessor.Builder setSecurityUser() { + return new SetSecurityUserProcessor.Builder(); + } + + /** + * Creates a builder for the {@link SortProcessor sort} {@code Processor} variant. */ public static SortProcessor.Builder sort() { return new SortProcessor.Builder(); } /** - * Creates a builder for the {@link SplitProcessor split} {@code Processor} - * variant. + * Creates a builder for the {@link SplitProcessor split} {@code Processor} variant. */ public static SplitProcessor.Builder split() { return new SplitProcessor.Builder(); } /** - * Creates a builder for the {@link TrimProcessor trim} {@code Processor} - * variant. + * Creates a builder for the {@link TextEmbeddingProcessor text_embedding} {@code Processor} variant. + */ + public static TextEmbeddingProcessor.Builder textEmbedding() { + return new TextEmbeddingProcessor.Builder(); + } + + /** + * Creates a builder for the {@link TrimProcessor trim} {@code Processor} variant. */ public static TrimProcessor.Builder trim() { return new TrimProcessor.Builder(); } /** - * Creates a builder for the {@link UppercaseProcessor uppercase} - * {@code Processor} variant. + * Creates a builder for the {@link UppercaseProcessor uppercase} {@code Processor} variant. */ public static UppercaseProcessor.Builder uppercase() { return new UppercaseProcessor.Builder(); } /** - * Creates a builder for the {@link UrlDecodeProcessor urldecode} - * {@code Processor} variant. + * Creates a builder for the {@link UrlDecodeProcessor urldecode} {@code Processor} variant. */ public static UrlDecodeProcessor.Builder urldecode() { return new UrlDecodeProcessor.Builder(); } /** - * Creates a builder for the {@link BytesProcessor bytes} {@code Processor} - * variant. - */ - public static BytesProcessor.Builder bytes() { - return new BytesProcessor.Builder(); - } - - /** - * Creates a builder for the {@link DissectProcessor dissect} {@code Processor} - * variant. - */ - public static DissectProcessor.Builder dissect() { - return new DissectProcessor.Builder(); - } - - /** - * Creates a builder for the {@link SetSecurityUserProcessor set_security_user} - * {@code Processor} variant. - */ - public static SetSecurityUserProcessor.Builder setSecurityUser() { - return new SetSecurityUserProcessor.Builder(); - } - - /** - * Creates a builder for the {@link PipelineProcessor pipeline} - * {@code Processor} variant. - */ - public static PipelineProcessor.Builder pipeline() { - return new PipelineProcessor.Builder(); - } - - /** - * Creates a builder for the {@link DropProcessor drop} {@code Processor} - * variant. - */ - public static DropProcessor.Builder drop() { - return new DropProcessor.Builder(); - } - - /** - * Creates a builder for the {@link CircleProcessor circle} {@code Processor} - * variant. + * Creates a builder for the {@link UserAgentProcessor user_agent} {@code Processor} variant. */ - public static CircleProcessor.Builder circle() { - return new CircleProcessor.Builder(); - } - - /** - * Creates a builder for the {@link InferenceProcessor inference} - * {@code Processor} variant. - */ - public static InferenceProcessor.Builder inference() { - return new InferenceProcessor.Builder(); - } - - /** - * Creates a builder for the {@link TextEmbeddingProcessor text_embedding} - * {@code Processor} variant. - */ - public static TextEmbeddingProcessor.Builder textEmbedding() { - return new TextEmbeddingProcessor.Builder(); + public static UserAgentProcessor.Builder userAgent() { + return new UserAgentProcessor.Builder(); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java new file mode 100644 index 0000000000..e9ec4957ff --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java @@ -0,0 +1,186 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ingest; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ingest.processor_grok.Request + +/** + * Returns a list of the built-in patterns. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ProcessorGrokRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Boolean s; + + // --------------------------------------------------------------------------------------------- + + private ProcessorGrokRequest(Builder builder) { + this.s = builder.s; + } + + public static ProcessorGrokRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Sort returned patterns by key name. + *

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

+ */ + @Nullable + public final Boolean s() { + return this.s; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ProcessorGrokRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean s; + + public Builder() {} + + private Builder(ProcessorGrokRequest o) { + this.s = o.s; + } + + private Builder(Builder o) { + this.s = o.s; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Sort returned patterns by key name. + *

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

+ */ + @Nonnull + public final Builder s(@Nullable Boolean value) { + this.s = value; + return this; + } + + /** + * Builds a {@link ProcessorGrokRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ProcessorGrokRequest build() { + _checkSingleUse(); + + return new ProcessorGrokRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ingest.processor_grok}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> "/_ingest/processor/grok", + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.s != null) { + params.put("s", String.valueOf(request.s)); + } + return params; + }, + SimpleEndpoint.emptyMap(), + false, + ProcessorGrokResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.s); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ProcessorGrokRequest other = (ProcessorGrokRequest) o; + return Objects.equals(this.s, other.s); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java index 8b3d72b622..1dd5c208b7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorGrokResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,37 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.processor_grok.Response @JsonpDeserializable -public class ProcessorGrokResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ProcessorGrokResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final Map patterns; // --------------------------------------------------------------------------------------------- private ProcessorGrokResponse(Builder builder) { - this.patterns = ApiTypeHelper.unmodifiableRequired(builder.patterns, this, "patterns"); - } - public static ProcessorGrokResponse of(Function> fn) { + public static ProcessorGrokResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code patterns} */ + @Nonnull public final Map patterns() { return this.patterns; } @@ -73,6 +86,7 @@ public final Map patterns() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,35 +94,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.patterns)) { - generator.writeKey("patterns"); - generator.writeStartObject(); - for (Map.Entry item0 : this.patterns.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("patterns"); + generator.writeStartObject(); + for (Map.Entry item0 : this.patterns.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ProcessorGrokResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map patterns; + public Builder() {} + + private Builder(ProcessorGrokResponse o) { + this.patterns = _mapCopy(o.patterns); + } + + private Builder(Builder o) { + this.patterns = _mapCopy(o.patterns); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code patterns} + * *

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

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

* Adds an entry to patterns. + *

*/ + @Nonnull public final Builder patterns(String key, String value) { this.patterns = _mapPut(this.patterns, key, value); return this; @@ -127,9 +167,10 @@ public final Builder patterns(String key, String value) { /** * Builds a {@link ProcessorGrokResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ProcessorGrokResponse build() { _checkSingleUse(); @@ -148,9 +189,21 @@ public ProcessorGrokResponse build() { ); protected static void setupProcessorGrokResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::patterns, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "patterns"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.patterns.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ProcessorGrokResponse other = (ProcessorGrokResponse) o; + return this.patterns.equals(other.patterns); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java index b5be715b4a..dd969f83fd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ProcessorVariant.java @@ -30,17 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; +import javax.annotation.Generated; + /** * Base interface for {@link Processor} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface ProcessorVariant { - Processor.Kind _processorKind(); - default Processor _toProcessor() { + default Processor toProcessor() { return new Processor(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java index 2c500140ac..031e8352d4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -51,33 +58,43 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.put_pipeline.Request /** * Creates or updates a pipeline. - * */ @JsonpDeserializable -public class PutPipelineRequest extends RequestBase implements PlainJsonSerializable { - private final Map meta; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutPipelineRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; @Nullable private final String description; + @Nonnull private final String id; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; + @Nonnull + private final Map meta; + @Nonnull private final List onFailure; + @Nonnull private final List processors; @Nullable @@ -89,37 +106,37 @@ public class PutPipelineRequest extends RequestBase implements PlainJsonSerializ // --------------------------------------------------------------------------------------------- private PutPipelineRequest(Builder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.description = builder.description; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); this.timeout = builder.timeout; this.version = builder.version; - } - public static PutPipelineRequest of(Function> fn) { + public static PutPipelineRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Optional metadata about the ingest pipeline. May have any contents. This map - * is not automatically generated by OpenSearch. + * Operation timeout for connection to cluster-manager node. *

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

*/ - public final Map meta() { - return this.meta; + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** * Description of the ingest pipeline. *

* API name: {@code description} + *

*/ @Nullable public final String description() { @@ -127,19 +144,22 @@ public final String description() { } /** - * Required - Pipeline ID + * Required - ID of the ingest pipeline to create or update. *

* API name: {@code id} + *

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

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -148,34 +168,43 @@ public final Time masterTimeout() { } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} + * API name: {@code _meta} */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + @Nonnull + public final Map meta() { + return this.meta; } /** + * Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If + * a processor without an on_failure value fails, OpenSearch uses this pipeline-level parameter as a fallback. The + * processors in this parameter run sequentially in the order specified. OpenSearch will not attempt to run the pipeline's remaining + * processors. + *

* API name: {@code on_failure} + *

*/ + @Nonnull public final List onFailure() { return this.onFailure; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

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

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -193,6 +222,7 @@ public final Long version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -200,6 +230,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("_meta"); @@ -207,248 +241,330 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - } if (ApiTypeHelper.isDefined(this.onFailure)) { generator.writeKey("on_failure"); generator.writeStartArray(); for (Processor item0 : this.onFailure) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.processors)) { generator.writeKey("processors"); generator.writeStartArray(); for (Processor item0 : this.processors) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PutPipelineRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable - private Map meta; - + private Time clusterManagerTimeout; @Nullable private String description; - private String id; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; - + private Map meta; @Nullable private List onFailure; - @Nullable private List processors; - @Nullable private Time timeout; - @Nullable private Long version; + public Builder() {} + + private Builder(PutPipelineRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.description = o.description; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.onFailure = _listCopy(o.onFailure); + this.processors = _listCopy(o.processors); + this.timeout = o.timeout; + this.version = o.version; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.description = o.description; + this.id = o.id; + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.onFailure = _listCopy(o.onFailure); + this.processors = _listCopy(o.processors); + this.timeout = o.timeout; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Optional metadata about the ingest pipeline. May have any contents. This map - * is not automatically generated by OpenSearch. + * Operation timeout for connection to cluster-manager node. *

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

- * Adds all entries of map to meta. + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Optional metadata about the ingest pipeline. May have any contents. This map - * is not automatically generated by OpenSearch. + * Operation timeout for connection to cluster-manager node. *

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

- * Adds an entry to meta. + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** * Description of the ingest pipeline. *

* API name: {@code description} + *

*/ + @Nonnull public final Builder description(@Nullable String value) { this.description = value; return this; } /** - * Required - Pipeline ID + * Required - ID of the ingest pipeline to create or update. *

* API name: {@code id} + *

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

* API name: {@code master_timeout} + *

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

* API name: {@code master_timeout} + *

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

- * API name: {@code cluster_manager_timeout} + * Adds all elements of map to meta. + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Nonnull + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); return this; } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. + * API name: {@code _meta} + * *

- * API name: {@code cluster_manager_timeout} + * Adds an entry to meta. + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; } /** + * Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. + * If a processor without an on_failure value fails, OpenSearch uses this pipeline-level parameter as a fallback. The + * processors in this parameter run sequentially in the order specified. OpenSearch will not attempt to run the pipeline's remaining + * processors. + *

* API name: {@code on_failure} + *

+ * *

* Adds all elements of list to onFailure. + *

*/ + @Nonnull public final Builder onFailure(List list) { this.onFailure = _listAddAll(this.onFailure, list); return this; } /** + * Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. + * If a processor without an on_failure value fails, OpenSearch uses this pipeline-level parameter as a fallback. The + * processors in this parameter run sequentially in the order specified. OpenSearch will not attempt to run the pipeline's remaining + * processors. + *

* API name: {@code on_failure} + *

+ * *

* Adds one or more values to onFailure. + *

*/ + @Nonnull public final Builder onFailure(Processor value, Processor... values) { this.onFailure = _listAdd(this.onFailure, value, values); return this; } /** + * Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. + * If a processor without an on_failure value fails, OpenSearch uses this pipeline-level parameter as a fallback. The + * processors in this parameter run sequentially in the order specified. OpenSearch will not attempt to run the pipeline's remaining + * processors. + *

* API name: {@code on_failure} + *

+ * *

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

*/ + @Nonnull public final Builder onFailure(Function> fn) { return onFailure(fn.apply(new Processor.Builder()).build()); } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

* Adds all elements of list to processors. + *

*/ + @Nonnull public final Builder processors(List list) { this.processors = _listAddAll(this.processors, list); return this; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

* Adds one or more values to processors. + *

*/ + @Nonnull public final Builder processors(Processor value, Processor... values) { this.processors = _listAdd(this.processors, value, values); return this; } /** + * Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified. + *

* API name: {@code processors} + *

+ * *

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

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

* API name: {@code timeout} + *

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

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * API name: {@code version} */ + @Nonnull public final Builder version(@Nullable Long value) { this.version = value; return this; @@ -457,9 +573,10 @@ public final Builder version(@Nullable Long value) { /** * Builds a {@link PutPipelineRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutPipelineRequest build() { _checkSingleUse(); @@ -478,13 +595,11 @@ public PutPipelineRequest build() { ); protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::onFailure, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "on_failure"); op.add(Builder::processors, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "processors"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - } // --------------------------------------------------------------------------------------------- @@ -493,50 +608,62 @@ protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_ingest"); - buf.append("/pipeline"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.id, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_ingest/pipeline/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, PutPipelineResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.id.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + Objects.hashCode(this.onFailure); + result = 31 * result + Objects.hashCode(this.processors); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutPipelineRequest other = (PutPipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.description, other.description) + && this.id.equals(other.id) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.meta, other.meta) + && Objects.equals(this.onFailure, other.onFailure) + && Objects.equals(this.processors, other.processors) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java index da8a66dae7..c5483dc839 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/PutPipelineResponse.java @@ -30,39 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.put_pipeline.Response @JsonpDeserializable -public class PutPipelineResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutPipelineResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private PutPipelineResponse(Builder builder) { super(builder); - } - public static PutPipelineResponse of(Function> fn) { + public static PutPipelineResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutPipelineResponse}. */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(PutPipelineResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +111,10 @@ protected Builder self() { /** * Builds a {@link PutPipelineResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutPipelineResponse build() { _checkSingleUse(); @@ -91,8 +133,22 @@ public PutPipelineResponse build() { ); protected static void setupPutPipelineResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java index 8fe8d57565..d644593b22 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/RemoveProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,12 +49,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.RemoveProcessor +// typedef: ingest.RemoveProcessor @JsonpDeserializable -public class RemoveProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RemoveProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final List field; @Nullable @@ -57,18 +72,16 @@ public class RemoveProcessor extends ProcessorBase implements ProcessorVariant { private RemoveProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.unmodifiableRequired(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; - } - public static RemoveProcessor of(Function> fn) { + public static RemoveProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -78,12 +91,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final List field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -91,43 +109,75 @@ public final Boolean ignoreMissing() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.field)) { - generator.writeKey("field"); - generator.writeStartArray(); - for (String item0 : this.field) { - generator.write(item0); - - } - generator.writeEnd(); - + generator.writeKey("field"); + generator.writeStartArray(); + for (String item0 : this.field) { + generator.write(item0); } + generator.writeEnd(); + if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RemoveProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private List field; - @Nullable private Boolean ignoreMissing; + public Builder() {} + + private Builder(RemoveProcessor o) { + super(o); + this.field = _listCopy(o.field); + this.ignoreMissing = o.ignoreMissing; + } + + private Builder(Builder o) { + super(o); + this.field = _listCopy(o.field); + this.ignoreMissing = o.ignoreMissing; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} + * *

* Adds all elements of list to field. + *

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

* Adds one or more values to field. + *

*/ + @Nonnull public final Builder field(String value, String... values) { this.field = _listAdd(this.field, value, values); return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link RemoveProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RemoveProcessor build() { _checkSingleUse(); @@ -183,7 +237,24 @@ protected static void setupRemoveProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable private final Boolean ignoreMissing; + @Nonnull private final String targetField; // --------------------------------------------------------------------------------------------- private RenameProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - } - public static RenameProcessor of(Function> fn) { + public static RenameProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -80,12 +94,16 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -95,12 +113,12 @@ public final Boolean ignoreMissing() { /** * Required - API name: {@code target_field} */ + @Nonnull public final String targetField() { return this.targetField; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -108,38 +126,78 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + generator.writeKey("target_field"); generator.write(this.targetField); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RenameProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - private String targetField; + public Builder() {} + + private Builder(RenameProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -148,22 +206,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * Required - API name: {@code target_field} */ + @Nonnull public final Builder targetField(String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link RenameProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RenameProcessor build() { _checkSingleUse(); @@ -186,7 +241,27 @@ protected static void setupRenameProcessorDeserializer(ObjectDeserializer { + + @Nullable + private final String copyFrom; + + @Nonnull + private final String field; + + @Nullable + private final Boolean ignoreEmptyValue; + + @Nullable + private final String mediaType; + + @Nullable + private final Boolean override; + + @Nullable + private final JsonData value; + + // --------------------------------------------------------------------------------------------- + + private SetProcessor(Builder builder) { + super(builder); + this.copyFrom = builder.copyFrom; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreEmptyValue = builder.ignoreEmptyValue; + this.mediaType = builder.mediaType; + this.override = builder.override; + this.value = builder.value; + } + + public static SetProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Processor} variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Set; + } + + /** + * API name: {@code copy_from} + */ + @Nullable + public final String copyFrom() { + return this.copyFrom; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * If true and value is a template snippet that evaluates to null or the empty string, the + * processor quietly exits without modifying the document. + *

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

+ */ + @Nullable + public final Boolean ignoreEmptyValue() { + return this.ignoreEmptyValue; + } + + /** + * The media type for encoding value. Applies only when value is a template snippet. Must be one of + * application/json, text/plain, or application/x-www-form-urlencoded. + *

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

+ */ + @Nullable + public final String mediaType() { + return this.mediaType; + } + + /** + * If true processor will update fields with pre-existing non-null-valued field. When set to false, such + * fields will not be touched. + *

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

+ */ + @Nullable + public final Boolean override() { + return this.override; + } + + /** + * The value to be set for the field. Supports template snippets. May specify only one of value or copy_from. + *

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

+ */ + @Nullable + public final JsonData value() { + return this.value; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.copyFrom != null) { + generator.writeKey("copy_from"); + generator.write(this.copyFrom); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreEmptyValue != null) { + generator.writeKey("ignore_empty_value"); + generator.write(this.ignoreEmptyValue); + } + + if (this.mediaType != null) { + generator.writeKey("media_type"); + generator.write(this.mediaType); + } + + if (this.override != null) { + generator.writeKey("override"); + generator.write(this.override); + } + + if (this.value != null) { + generator.writeKey("value"); + this.value.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SetProcessor}. + */ + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String copyFrom; + private String field; + @Nullable + private Boolean ignoreEmptyValue; + @Nullable + private String mediaType; + @Nullable + private Boolean override; + @Nullable + private JsonData value; + + public Builder() {} + + private Builder(SetProcessor o) { + super(o); + this.copyFrom = o.copyFrom; + this.field = o.field; + this.ignoreEmptyValue = o.ignoreEmptyValue; + this.mediaType = o.mediaType; + this.override = o.override; + this.value = o.value; + } + + private Builder(Builder o) { + super(o); + this.copyFrom = o.copyFrom; + this.field = o.field; + this.ignoreEmptyValue = o.ignoreEmptyValue; + this.mediaType = o.mediaType; + this.override = o.override; + this.value = o.value; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code copy_from} + */ + @Nonnull + public final Builder copyFrom(@Nullable String value) { + this.copyFrom = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * If true and value is a template snippet that evaluates to null or the empty string, the + * processor quietly exits without modifying the document. + *

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

+ */ + @Nonnull + public final Builder ignoreEmptyValue(@Nullable Boolean value) { + this.ignoreEmptyValue = value; + return this; + } + + /** + * The media type for encoding value. Applies only when value is a template snippet. Must be one of + * application/json, text/plain, or application/x-www-form-urlencoded. + *

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

+ */ + @Nonnull + public final Builder mediaType(@Nullable String value) { + this.mediaType = value; + return this; + } + + /** + * If true processor will update fields with pre-existing non-null-valued field. When set to false, such + * fields will not be touched. + *

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

+ */ + @Nonnull + public final Builder override(@Nullable Boolean value) { + this.override = value; + return this; + } + + /** + * The value to be set for the field. Supports template snippets. May specify only one of value or + * copy_from. + *

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

+ */ + @Nonnull + public final Builder value(@Nullable JsonData value) { + this.value = value; + return this; + } + + /** + * Builds a {@link SetProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SetProcessor build() { + _checkSingleUse(); + + return new SetProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SetProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SetProcessor::setupSetProcessorDeserializer + ); + + protected static void setupSetProcessorDeserializer(ObjectDeserializer op) { + setupProcessorBaseDeserializer(op); + op.add(Builder::copyFrom, JsonpDeserializer.stringDeserializer(), "copy_from"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreEmptyValue, JsonpDeserializer.booleanDeserializer(), "ignore_empty_value"); + op.add(Builder::mediaType, JsonpDeserializer.stringDeserializer(), "media_type"); + op.add(Builder::override, JsonpDeserializer.booleanDeserializer(), "override"); + op.add(Builder::value, JsonData._DESERIALIZER, "value"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.copyFrom); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreEmptyValue); + result = 31 * result + Objects.hashCode(this.mediaType); + result = 31 * result + Objects.hashCode(this.override); + result = 31 * result + Objects.hashCode(this.value); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SetProcessor other = (SetProcessor) o; + return Objects.equals(this.copyFrom, other.copyFrom) + && this.field.equals(other.field) + && Objects.equals(this.ignoreEmptyValue, other.ignoreEmptyValue) + && Objects.equals(this.mediaType, other.mediaType) + && Objects.equals(this.override, other.override) + && Objects.equals(this.value, other.value); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java index e53446771e..228849a782 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SetSecurityUserProcessor.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,32 +49,39 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.SetSecurityUserProcessor +// typedef: ingest.SetSecurityUserProcessor @JsonpDeserializable -public class SetSecurityUserProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SetSecurityUserProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { + + @Nonnull private final String field; + @Nonnull private final List properties; // --------------------------------------------------------------------------------------------- private SetSecurityUserProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.properties = ApiTypeHelper.unmodifiable(builder.properties); - } - public static SetSecurityUserProcessor of(Function> fn) { + public static SetSecurityUserProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -77,19 +91,23 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * Controls what user related properties are added to the field. + *

* API name: {@code properties} + *

*/ + @Nonnull public final List properties() { return this.properties; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -99,65 +117,108 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (String item0 : this.properties) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SetSecurityUserProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder + implements + CopyableBuilder { private String field; - @Nullable private List properties; + public Builder() {} + + private Builder(SetSecurityUserProcessor o) { + super(o); + this.field = o.field; + this.properties = _listCopy(o.properties); + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.properties = _listCopy(o.properties); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * Controls what user related properties are added to the field. + *

* API name: {@code properties} + *

+ * *

* Adds all elements of list to properties. + *

*/ + @Nonnull public final Builder properties(List list) { this.properties = _listAddAll(this.properties, list); return this; } /** + * Controls what user related properties are added to the field. + *

* API name: {@code properties} + *

+ * *

* Adds one or more values to properties. + *

*/ + @Nonnull public final Builder properties(String value, String... values) { this.properties = _listAdd(this.properties, value, values); return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SetSecurityUserProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SetSecurityUserProcessor build() { _checkSingleUse(); @@ -179,7 +240,24 @@ protected static void setupSetSecurityUserProcessorDeserializer(ObjectDeserializ setupProcessorBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::properties, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "properties"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.properties); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SetSecurityUserProcessor other = (SetSecurityUserProcessor) o; + return this.field.equals(other.field) && Objects.equals(this.properties, other.properties); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ShapeType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ShapeType.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/ShapeType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ShapeType.java index 5e6b30fd68..aa1fa4f6b8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ShapeType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/ShapeType.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: ingest.ShapeType + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ShapeType implements JsonEnum { GeoShape("geo_shape"), - XyShape("xy_shape"), - - ; + XyShape("xy_shape"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java index e5316702d0..9933a84243 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SimulateRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -50,17 +57,24 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.simulate.Request /** * Allows to simulate a pipeline with example documents. - * */ @JsonpDeserializable -public class SimulateRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SimulateRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final List docs; @Nullable @@ -75,29 +89,32 @@ public class SimulateRequest extends RequestBase implements PlainJsonSerializabl // --------------------------------------------------------------------------------------------- private SimulateRequest(Builder builder) { - this.docs = ApiTypeHelper.unmodifiable(builder.docs); this.id = builder.id; this.pipeline = builder.pipeline; this.verbose = builder.verbose; - } - public static SimulateRequest of(Function> fn) { + public static SimulateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Sample documents to test in the pipeline. + *

* API name: {@code docs} + *

*/ + @Nonnull public final List docs() { return this.docs; } /** - * Pipeline ID + * Pipeline to test. If you don't specify a pipeline in the request body, this parameter is required. *

* API name: {@code id} + *

*/ @Nullable public final String id() { @@ -113,9 +130,10 @@ public final Pipeline pipeline() { } /** - * Verbose mode. Display data output for each processor in executed pipeline + * If true, the response includes output data for each processor in the executed pipeline. *

* API name: {@code verbose} + *

*/ @Nullable public final Boolean verbose() { @@ -125,6 +143,7 @@ public final Boolean verbose() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -132,78 +151,122 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.docs)) { generator.writeKey("docs"); generator.writeStartArray(); for (Document item0 : this.docs) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.pipeline != null) { generator.writeKey("pipeline"); this.pipeline.serialize(generator, mapper); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link SimulateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List docs; - @Nullable private String id; - @Nullable private Pipeline pipeline; - @Nullable private Boolean verbose; + public Builder() {} + + private Builder(SimulateRequest o) { + this.docs = _listCopy(o.docs); + this.id = o.id; + this.pipeline = o.pipeline; + this.verbose = o.verbose; + } + + private Builder(Builder o) { + this.docs = _listCopy(o.docs); + this.id = o.id; + this.pipeline = o.pipeline; + this.verbose = o.verbose; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Sample documents to test in the pipeline. + *

* API name: {@code docs} + *

+ * *

* Adds all elements of list to docs. + *

*/ + @Nonnull public final Builder docs(List list) { this.docs = _listAddAll(this.docs, list); return this; } /** + * Sample documents to test in the pipeline. + *

* API name: {@code docs} + *

+ * *

* Adds one or more values to docs. + *

*/ + @Nonnull public final Builder docs(Document value, Document... values) { this.docs = _listAdd(this.docs, value, values); return this; } /** + * Sample documents to test in the pipeline. + *

* API name: {@code docs} + *

+ * *

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

*/ + @Nonnull public final Builder docs(Function> fn) { return docs(fn.apply(new Document.Builder()).build()); } /** - * Pipeline ID + * Pipeline to test. If you don't specify a pipeline in the request body, this parameter is required. *

* API name: {@code id} + *

*/ + @Nonnull public final Builder id(@Nullable String value) { this.id = value; return this; @@ -212,6 +275,7 @@ public final Builder id(@Nullable String value) { /** * API name: {@code pipeline} */ + @Nonnull public final Builder pipeline(@Nullable Pipeline value) { this.pipeline = value; return this; @@ -220,15 +284,18 @@ public final Builder pipeline(@Nullable Pipeline value) { /** * API name: {@code pipeline} */ + @Nonnull public final Builder pipeline(Function> fn) { - return this.pipeline(fn.apply(new Pipeline.Builder()).build()); + return pipeline(fn.apply(new Pipeline.Builder()).build()); } /** - * Verbose mode. Display data output for each processor in executed pipeline + * If true, the response includes output data for each processor in the executed pipeline. *

* API name: {@code verbose} + *

*/ + @Nonnull public final Builder verbose(@Nullable Boolean value) { this.verbose = value; return this; @@ -237,9 +304,10 @@ public final Builder verbose(@Nullable Boolean value) { /** * Builds a {@link SimulateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SimulateRequest build() { _checkSingleUse(); @@ -258,10 +326,8 @@ public SimulateRequest build() { ); protected static void setupSimulateRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::docs, JsonpDeserializer.arrayDeserializer(Document._DESERIALIZER), "docs"); op.add(Builder::pipeline, Pipeline._DESERIALIZER, "pipeline"); - } // --------------------------------------------------------------------------------------------- @@ -270,13 +336,8 @@ protected static void setupSimulateRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _id = 1 << 0; @@ -286,25 +347,18 @@ protected static void setupSimulateRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); @@ -312,10 +366,30 @@ protected static void setupSimulateRequestDeserializer(ObjectDeserializer { + + @Nonnull private final List docs; // --------------------------------------------------------------------------------------------- private SimulateResponse(Builder builder) { - this.docs = ApiTypeHelper.unmodifiableRequired(builder.docs, this, "docs"); - } - public static SimulateResponse of(Function> fn) { + public static SimulateResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code docs} */ + @Nonnull public final List docs() { return this.docs; } @@ -74,6 +84,7 @@ public final List docs() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,34 +92,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.docs)) { - generator.writeKey("docs"); - generator.writeStartArray(); - for (PipelineSimulation item0 : this.docs) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("docs"); + generator.writeStartArray(); + for (PipelineSimulation item0 : this.docs) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SimulateResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List docs; + public Builder() {} + + private Builder(SimulateResponse o) { + this.docs = _listCopy(o.docs); + } + + private Builder(Builder o) { + this.docs = _listCopy(o.docs); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code docs} + * *

* Adds all elements of list to docs. + *

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

* Adds one or more values to docs. + *

*/ + @Nonnull public final Builder docs(PipelineSimulation value, PipelineSimulation... values) { this.docs = _listAdd(this.docs, value, values); return this; @@ -126,9 +163,12 @@ public final Builder docs(PipelineSimulation value, PipelineSimulation... values /** * Required - API name: {@code docs} + * *

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

*/ + @Nonnull public final Builder docs(Function> fn) { return docs(fn.apply(new PipelineSimulation.Builder()).build()); } @@ -136,9 +176,10 @@ public final Builder docs(Function op) { - op.add(Builder::docs, JsonpDeserializer.arrayDeserializer(PipelineSimulation._DESERIALIZER), "docs"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.docs.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SimulateResponse other = (SimulateResponse) o; + return this.docs.equals(other.docs); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SortProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SortProcessor.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/SortProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SortProcessor.java index 4e556cfb8e..05c4820594 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SortProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/SortProcessor.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,35 +49,40 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.SortOrder; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.SortProcessor +// typedef: ingest.SortProcessor @JsonpDeserializable -public class SortProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SortProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nonnull private final String field; + @Nullable private final SortOrder order; + @Nullable private final String targetField; // --------------------------------------------------------------------------------------------- private SortProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.order = ApiTypeHelper.requireNonNull(builder.order, this, "order"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - + this.order = builder.order; + this.targetField = builder.targetField; } - public static SortProcessor of(Function> fn) { + public static SortProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -79,85 +92,128 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code order} + * API name: {@code order} */ + @Nullable public final SortOrder order() { return this.order; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ + @Nullable public final String targetField() { return this.targetField; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); - generator.writeKey("order"); - this.order.serialize(generator, mapper); - generator.writeKey("target_field"); - generator.write(this.targetField); + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SortProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - + @Nullable private SortOrder order; - + @Nullable private String targetField; + public Builder() {} + + private Builder(SortProcessor o) { + super(o); + this.field = o.field; + this.order = o.order; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.order = o.order; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code order} + * API name: {@code order} */ - public final Builder order(SortOrder value) { + @Nonnull + public final Builder order(@Nullable SortOrder value) { this.order = value; return this; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ - public final Builder targetField(String value) { + @Nonnull + public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SortProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SortProcessor build() { _checkSingleUse(); @@ -180,7 +236,27 @@ protected static void setupSortProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable @@ -55,6 +67,7 @@ public class SplitProcessor extends ProcessorBase implements ProcessorVariant { @Nullable private final Boolean preserveTrailing; + @Nonnull private final String separator; @Nullable @@ -64,21 +77,19 @@ public class SplitProcessor extends ProcessorBase implements ProcessorVariant { private SplitProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.preserveTrailing = builder.preserveTrailing; this.separator = ApiTypeHelper.requireNonNull(builder.separator, this, "separator"); this.targetField = builder.targetField; - } - public static SplitProcessor of(Function> fn) { + public static SplitProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -88,12 +99,16 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -101,7 +116,10 @@ public final Boolean ignoreMissing() { } /** + * Preserves empty trailing fields, if any. + *

* API name: {@code preserve_trailing} + *

*/ @Nullable public final Boolean preserveTrailing() { @@ -109,8 +127,12 @@ public final Boolean preserveTrailing() { } /** - * Required - API name: {@code separator} + * Required - A regex which matches the separator, for example, , or \s+. + *

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

*/ + @Nonnull public final String separator() { return this.separator; } @@ -124,7 +146,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -132,71 +153,120 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.preserveTrailing != null) { generator.writeKey("preserve_trailing"); generator.write(this.preserveTrailing); - } + generator.writeKey("separator"); generator.write(this.separator); if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SplitProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private Boolean preserveTrailing; - private String separator; - @Nullable private String targetField; + public Builder() {} + + private Builder(SplitProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.preserveTrailing = o.preserveTrailing; + this.separator = o.separator; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.preserveTrailing = o.preserveTrailing; + this.separator = o.separator; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** + * Preserves empty trailing fields, if any. + *

* API name: {@code preserve_trailing} + *

*/ + @Nonnull public final Builder preserveTrailing(@Nullable Boolean value) { this.preserveTrailing = value; return this; } /** - * Required - API name: {@code separator} + * Required - A regex which matches the separator, for example, , or \s+. + *

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

*/ + @Nonnull public final Builder separator(String value) { this.separator = value; return this; @@ -205,22 +275,19 @@ public final Builder separator(String value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SplitProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SplitProcessor build() { _checkSingleUse(); @@ -245,7 +312,31 @@ protected static void setupSplitProcessorDeserializer(ObjectDeserializer fieldMap; - - @Nullable - private final String description; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TextEmbeddingProcessor extends ProcessorBase + implements + ProcessorVariant, + ToCopyableBuilder { @Nullable private final Integer batchSize; + @Nonnull + private final Map fieldMap; + + @Nonnull + private final String modelId; + // --------------------------------------------------------------------------------------------- private TextEmbeddingProcessor(Builder builder) { super(builder); - - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.fieldMap = ApiTypeHelper.unmodifiableRequired(builder.fieldMap, this, "fieldMap"); - this.description = builder.description; this.batchSize = builder.batchSize; + this.fieldMap = ApiTypeHelper.unmodifiableRequired(builder.fieldMap, this, "fieldMap"); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); } - public static TextEmbeddingProcessor of(Function> fn) { + public static TextEmbeddingProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -58,137 +93,158 @@ public Processor.Kind _processorKind() { } /** - * Required - API name: {@code model_id} + * API name: {@code batch_size} */ - public final String modelId() { - return this.modelId; + @Nullable + public final Integer batchSize() { + return this.batchSize; } /** + * Required - Contains key-value pairs that specify the mapping of a text field to a vector field. + *

* API name: {@code field_map} + *

*/ + @Nonnull public final Map fieldMap() { return this.fieldMap; } /** - * API name: {@code description} - */ - @Nullable - public final String description() { - return this.description; - } - - /** - * API name: {@code batch_size} + * Required - API name: {@code model_id} */ - @Nullable - public final Integer batchSize() { - return this.batchSize; + @Nonnull + public final String modelId() { + return this.modelId; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("model_id"); - generator.write(this.modelId); - - if (ApiTypeHelper.isDefined(this.fieldMap)) { - generator.writeKey("field_map"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fieldMap.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - } - generator.writeEnd(); - - } - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - } if (this.batchSize != null) { generator.writeKey("batch_size"); generator.write(this.batchSize); } + + generator.writeKey("field_map"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fieldMap.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + } + generator.writeEnd(); + + generator.writeKey("model_id"); + generator.write(this.modelId); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TextEmbeddingProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private String modelId; - + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { @Nullable + private Integer batchSize; private Map fieldMap; + private String modelId; - @Nullable - private String description; + public Builder() {} - @Nullable - private Integer batchSize; + private Builder(TextEmbeddingProcessor o) { + super(o); + this.batchSize = o.batchSize; + this.fieldMap = _mapCopy(o.fieldMap); + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.batchSize = o.batchSize; + this.fieldMap = _mapCopy(o.fieldMap); + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** - * Required - API name: {@code model_id} + * API name: {@code batch_size} */ - public final Builder modelId(String value) { - this.modelId = value; + @Nonnull + public final Builder batchSize(@Nullable Integer value) { + this.batchSize = value; return this; } /** + * Required - Contains key-value pairs that specify the mapping of a text field to a vector field. + *

* API name: {@code field_map} + *

+ * *

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

*/ + @Nonnull public final Builder fieldMap(Map map) { this.fieldMap = _mapPutAll(this.fieldMap, map); return this; } /** + * Required - Contains key-value pairs that specify the mapping of a text field to a vector field. + *

* API name: {@code field_map} + *

+ * *

* Adds an entry to fieldMap. + *

*/ + @Nonnull public final Builder fieldMap(String key, String value) { this.fieldMap = _mapPut(this.fieldMap, key, value); return this; } /** - * API name: {@code description} - */ - public final Builder description(@Nullable String value) { - this.description = value; - return this; - } - - /** - * API name: {@code batch_size} + * Required - API name: {@code model_id} */ - public final Builder batchSize(@Nullable Integer value) { - if (value != null && value <= 0) { - throw new IllegalArgumentException("batchSize must be a positive integer"); - } - this.batchSize = value; - return this; - } - - @Override - protected Builder self() { + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; return this; } /** * Builds a {@link TextEmbeddingProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TextEmbeddingProcessor build() { _checkSingleUse(); @@ -207,11 +263,31 @@ public TextEmbeddingProcessor build() { ); protected static void setupTextEmbeddingProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); - op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); - op.add(Builder::fieldMap, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "field_map"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + setupProcessorBaseDeserializer(op); op.add(Builder::batchSize, JsonpDeserializer.integerDeserializer(), "batch_size"); + op.add(Builder::fieldMap, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "field_map"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.batchSize); + result = 31 * result + this.fieldMap.hashCode(); + result = 31 * result + this.modelId.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TextEmbeddingProcessor other = (TextEmbeddingProcessor) o; + return Objects.equals(this.batchSize, other.batchSize) + && this.fieldMap.equals(other.fieldMap) + && this.modelId.equals(other.modelId); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java index ad826e8dbd..8d27272670 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/TrimProcessor.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,17 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: ingest._types.TrimProcessor +// typedef: ingest.TrimProcessor @JsonpDeserializable -public class TrimProcessor extends ProcessorBase implements ProcessorVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TrimProcessor extends ProcessorBase implements ProcessorVariant, ToCopyableBuilder { + + @Nonnull private final String field; @Nullable @@ -59,19 +71,17 @@ public class TrimProcessor extends ProcessorBase implements ProcessorVariant { private TrimProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = builder.targetField; - } - public static TrimProcessor of(Function> fn) { + public static TrimProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -81,12 +91,16 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,7 +116,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -110,42 +123,81 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TrimProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String targetField; + public Builder() {} + + private Builder(TrimProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist, the processor quietly exits without modifying the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -154,22 +206,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link TrimProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TrimProcessor build() { _checkSingleUse(); @@ -192,7 +241,27 @@ protected static void setupTrimProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable @@ -59,19 +74,17 @@ public class UppercaseProcessor extends ProcessorBase implements ProcessorVarian private UppercaseProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = builder.targetField; - } - public static UppercaseProcessor of(Function> fn) { + public static UppercaseProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -81,12 +94,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,7 +120,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -110,42 +127,82 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link UppercaseProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String targetField; + public Builder() {} + + private Builder(UppercaseProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -154,22 +211,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link UppercaseProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public UppercaseProcessor build() { _checkSingleUse(); @@ -192,7 +246,27 @@ protected static void setupUppercaseProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; @Nullable @@ -59,19 +74,17 @@ public class UrlDecodeProcessor extends ProcessorBase implements ProcessorVarian private UrlDecodeProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; this.targetField = builder.targetField; - } - public static UrlDecodeProcessor of(Function> fn) { + public static UrlDecodeProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -81,12 +94,17 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying the + * document. + *

* API name: {@code ignore_missing} + *

*/ @Nullable public final Boolean ignoreMissing() { @@ -102,7 +120,6 @@ public final String targetField() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -110,42 +127,82 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.ignoreMissing != null) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } + if (this.targetField != null) { generator.writeKey("target_field"); generator.write(this.targetField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link UrlDecodeProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - @Nullable private Boolean ignoreMissing; - @Nullable private String targetField; + public Builder() {} + + private Builder(UrlDecodeProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** + * If true and field does not exist or is null, the processor quietly exits without modifying + * the document. + *

* API name: {@code ignore_missing} + *

*/ + @Nonnull public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; @@ -154,22 +211,19 @@ public final Builder ignoreMissing(@Nullable Boolean value) { /** * API name: {@code target_field} */ + @Nonnull public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link UrlDecodeProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public UrlDecodeProcessor build() { _checkSingleUse(); @@ -192,7 +246,27 @@ protected static void setupUrlDecodeProcessorDeserializer(ObjectDeserializer { + + @Nonnull private final String field; - private final boolean ignoreMissing; + @Nullable + private final Boolean ignoreMissing; + @Nonnull private final List options; + @Nullable private final String regexFile; + @Nullable private final String targetField; // --------------------------------------------------------------------------------------------- private UserAgentProcessor(Builder builder) { super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.ignoreMissing = ApiTypeHelper.requireNonNull(builder.ignoreMissing, this, "ignoreMissing"); - this.options = ApiTypeHelper.unmodifiableRequired(builder.options, this, "options"); - this.regexFile = ApiTypeHelper.requireNonNull(builder.regexFile, this, "regexFile"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - + this.ignoreMissing = builder.ignoreMissing; + this.options = ApiTypeHelper.unmodifiable(builder.options); + this.regexFile = builder.regexFile; + this.targetField = builder.targetField; } - public static UserAgentProcessor of(Function> fn) { + public static UserAgentProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Processor variant kind. + * {@link Processor} variant kind. */ @Override public Processor.Kind _processorKind() { @@ -85,46 +103,60 @@ public Processor.Kind _processorKind() { /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

*/ - public final boolean ignoreMissing() { + @Nullable + public final Boolean ignoreMissing() { return this.ignoreMissing; } /** - * Required - API name: {@code options} + * API name: {@code options} */ + @Nonnull public final List options() { return this.options; } /** - * Required - API name: {@code regex_file} + * The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the user + * agent string. Both the directory and the file have to be created before starting OpenSearch. If not specified, ingest-user-agent will + * use the regexes.yaml from uap-core it ships with. + *

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

*/ + @Nullable public final String regexFile() { return this.regexFile; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ + @Nullable public final String targetField() { return this.targetField; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); - generator.writeKey("ignore_missing"); - generator.write(this.ignoreMissing); + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + } if (ApiTypeHelper.isDefined(this.options)) { generator.writeKey("options"); @@ -133,96 +165,155 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { item0.serialize(generator, mapper); } generator.writeEnd(); - } - generator.writeKey("regex_file"); - generator.write(this.regexFile); - generator.writeKey("target_field"); - generator.write(this.targetField); + if (this.regexFile != null) { + generator.writeKey("regex_file"); + generator.write(this.regexFile); + } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link UserAgentProcessor}. */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends ProcessorBase.AbstractBuilder implements CopyableBuilder { private String field; - + @Nullable private Boolean ignoreMissing; - + @Nullable private List options; - + @Nullable private String regexFile; - + @Nullable private String targetField; + public Builder() {} + + private Builder(UserAgentProcessor o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.options = _listCopy(o.options); + this.regexFile = o.regexFile; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ignoreMissing = o.ignoreMissing; + this.options = _listCopy(o.options); + this.regexFile = o.regexFile; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * Required - API name: {@code ignore_missing} + * If true and field does not exist, the processor quietly exits without modifying the document. + *

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

*/ - public final Builder ignoreMissing(boolean value) { + @Nonnull + public final Builder ignoreMissing(@Nullable Boolean value) { this.ignoreMissing = value; return this; } /** - * Required - API name: {@code options} + * API name: {@code options} + * *

* Adds all elements of list to options. + *

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

* Adds one or more values to options. + *

*/ + @Nonnull public final Builder options(UserAgentProperty value, UserAgentProperty... values) { this.options = _listAdd(this.options, value, values); return this; } /** - * Required - API name: {@code regex_file} + * The name of the file in the config/ingest-user-agent directory containing the regular expressions for parsing the + * user agent string. Both the directory and the file have to be created before starting OpenSearch. If not specified, + * ingest-user-agent will use the regexes.yaml from uap-core it ships with. + *

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

*/ - public final Builder regexFile(String value) { + @Nonnull + public final Builder regexFile(@Nullable String value) { this.regexFile = value; return this; } /** - * Required - API name: {@code target_field} + * API name: {@code target_field} */ - public final Builder targetField(String value) { + @Nonnull + public final Builder targetField(@Nullable String value) { this.targetField = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link UserAgentProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public UserAgentProcessor build() { _checkSingleUse(); @@ -247,7 +338,31 @@ protected static void setupUserAgentProcessorDeserializer(ObjectDeserializer { + @Nullable private final String id; @Nullable private final String index; + @Nonnull private final JsonData source; // --------------------------------------------------------------------------------------------- private Document(Builder builder) { - this.id = builder.id; this.index = builder.index; this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - } - public static Document of(Function> fn) { + public static Document of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -89,8 +99,12 @@ public final String index() { } /** - * Required - API name: {@code _source} + * Required - JSON body for the document. + *

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

*/ + @Nonnull public final JsonData source() { return this.source; } @@ -98,6 +112,7 @@ public final JsonData source() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -105,40 +120,67 @@ 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.index != null) { generator.writeKey("_index"); generator.write(this.index); - } + generator.writeKey("_source"); this.source.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Document}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String id; - @Nullable private String index; - private JsonData source; + public Builder() {} + + private Builder(Document o) { + this.id = o.id; + this.index = o.index; + this.source = o.source; + } + + private Builder(Builder o) { + this.id = o.id; + this.index = o.index; + this.source = o.source; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code _id} */ + @Nonnull public final Builder id(@Nullable String value) { this.id = value; return this; @@ -147,14 +189,19 @@ public final Builder id(@Nullable String value) { /** * API name: {@code _index} */ + @Nonnull public final Builder index(@Nullable String value) { this.index = value; return this; } /** - * Required - API name: {@code _source} + * Required - JSON body for the document. + *

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

*/ + @Nonnull public final Builder source(JsonData value) { this.source = value; return this; @@ -163,9 +210,10 @@ public final Builder source(JsonData value) { /** * Builds a {@link Document}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Document build() { _checkSingleUse(); @@ -184,11 +232,25 @@ public Document build() { ); protected static void setupDocumentDeserializer(ObjectDeserializer op) { - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index"); op.add(Builder::source, JsonData._DESERIALIZER, "_source"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.id); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + this.source.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Document other = (Document) o; + return Objects.equals(this.id, other.id) && Objects.equals(this.index, other.index) && this.source.equals(other.source); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java index 56a11db7e9..314b991065 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/DocumentSimulation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest.simulate; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -43,52 +50,60 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.VersionType; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.simulate.DocumentSimulation @JsonpDeserializable -public class DocumentSimulation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DocumentSimulation implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String id; + @Nonnull private final String index; + @Nonnull private final Ingest ingest; - @Nullable - private final String parent; - @Nullable private final String routing; + @Nonnull private final Map source; @Nullable - private final String type; + private final String version; + + @Nullable + private final VersionType versionType; // --------------------------------------------------------------------------------------------- private DocumentSimulation(Builder builder) { - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest"); - this.parent = builder.parent; this.routing = builder.routing; this.source = ApiTypeHelper.unmodifiableRequired(builder.source, this, "source"); - this.type = builder.type; - + this.version = builder.version; + this.versionType = builder.versionType; } - public static DocumentSimulation of(Function> fn) { + public static DocumentSimulation of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code _id} */ + @Nonnull public final String id() { return this.id; } @@ -96,6 +111,7 @@ public final String id() { /** * Required - API name: {@code _index} */ + @Nonnull public final String index() { return this.index; } @@ -103,20 +119,16 @@ public final String index() { /** * Required - API name: {@code _ingest} */ + @Nonnull public final Ingest ingest() { return this.ingest; } /** - * API name: {@code _parent} - */ - @Nullable - public final String parent() { - return this.parent; - } - - /** + * Value used to send the document to a specific primary shard. + *

* API name: {@code _routing} + *

*/ @Nullable public final String routing() { @@ -124,23 +136,36 @@ public final String routing() { } /** - * Required - API name: {@code _source} + * Required - JSON body for the document. + *

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

*/ + @Nonnull public final Map source() { return this.source; } /** - * API name: {@code _type} + * API name: {@code _version} */ @Nullable - public final String type() { - return this.type; + public final String version() { + return this.version; + } + + /** + * API name: {@code _version_type} + */ + @Nullable + public final VersionType versionType() { + return this.versionType; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -148,7 +173,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("_id"); generator.write(this.id); @@ -158,62 +182,90 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("_ingest"); this.ingest.serialize(generator, mapper); - if (this.parent != null) { - generator.writeKey("_parent"); - generator.write(this.parent); - - } if (this.routing != null) { generator.writeKey("_routing"); generator.write(this.routing); - } - if (ApiTypeHelper.isDefined(this.source)) { - generator.writeKey("_source"); - generator.writeStartObject(); - for (Map.Entry item0 : this.source.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeKey("_source"); + generator.writeStartObject(); + for (Map.Entry item0 : this.source.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - if (this.type != null) { - generator.writeKey("_type"); - generator.write(this.type); + generator.writeEnd(); + if (this.version != null) { + generator.writeKey("_version"); + generator.write(this.version); } + if (this.versionType != null) { + generator.writeKey("_version_type"); + this.versionType.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DocumentSimulation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String id; - private String index; - private Ingest ingest; - - @Nullable - private String parent; - @Nullable private String routing; - private Map source; - @Nullable - private String type; + private String version; + @Nullable + private VersionType versionType; + + public Builder() {} + + private Builder(DocumentSimulation o) { + this.id = o.id; + this.index = o.index; + this.ingest = o.ingest; + this.routing = o.routing; + this.source = _mapCopy(o.source); + this.version = o.version; + this.versionType = o.versionType; + } + + private Builder(Builder o) { + this.id = o.id; + this.index = o.index; + this.ingest = o.ingest; + this.routing = o.routing; + this.source = _mapCopy(o.source); + this.version = o.version; + this.versionType = o.versionType; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code _id} */ + @Nonnull public final Builder id(String value) { this.id = value; return this; @@ -222,6 +274,7 @@ public final Builder id(String value) { /** * Required - API name: {@code _index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -230,6 +283,7 @@ public final Builder index(String value) { /** * Required - API name: {@code _ingest} */ + @Nonnull public final Builder ingest(Ingest value) { this.ingest = value; return this; @@ -238,60 +292,80 @@ public final Builder ingest(Ingest value) { /** * Required - API name: {@code _ingest} */ + @Nonnull public final Builder ingest(Function> fn) { - return this.ingest(fn.apply(new Ingest.Builder()).build()); - } - - /** - * API name: {@code _parent} - */ - public final Builder parent(@Nullable String value) { - this.parent = value; - return this; + return ingest(fn.apply(new Ingest.Builder()).build()); } /** + * Value used to send the document to a specific primary shard. + *

* API name: {@code _routing} + *

*/ + @Nonnull public final Builder routing(@Nullable String value) { this.routing = value; return this; } /** - * Required - API name: {@code _source} + * Required - JSON body for the document. + *

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

+ * *

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

*/ + @Nonnull public final Builder source(Map map) { this.source = _mapPutAll(this.source, map); return this; } /** - * Required - API name: {@code _source} + * Required - JSON body for the document. + *

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

+ * *

* Adds an entry to source. + *

*/ + @Nonnull public final Builder source(String key, JsonData value) { this.source = _mapPut(this.source, key, value); return this; } /** - * API name: {@code _type} + * API name: {@code _version} */ - public final Builder type(@Nullable String value) { - this.type = value; + @Nonnull + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + + /** + * API name: {@code _version_type} + */ + @Nonnull + public final Builder versionType(@Nullable VersionType value) { + this.versionType = value; return this; } /** * Builds a {@link DocumentSimulation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DocumentSimulation build() { _checkSingleUse(); @@ -310,15 +384,39 @@ public DocumentSimulation build() { ); protected static void setupDocumentSimulationDeserializer(ObjectDeserializer op) { - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index"); op.add(Builder::ingest, Ingest._DESERIALIZER, "_ingest"); - op.add(Builder::parent, JsonpDeserializer.stringDeserializer(), "_parent"); op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); op.add(Builder::source, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_source"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "_type"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "_version"); + op.add(Builder::versionType, VersionType._DESERIALIZER, "_version_type"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.id.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + this.ingest.hashCode(); + result = 31 * result + Objects.hashCode(this.routing); + result = 31 * result + this.source.hashCode(); + result = 31 * result + Objects.hashCode(this.version); + result = 31 * result + Objects.hashCode(this.versionType); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DocumentSimulation other = (DocumentSimulation) o; + return this.id.equals(other.id) + && this.index.equals(other.index) + && this.ingest.equals(other.ingest) + && Objects.equals(this.routing, other.routing) + && this.source.equals(other.source) + && Objects.equals(this.version, other.version) + && Objects.equals(this.versionType, other.versionType); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java index e91915f8ce..40ca3b97f0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/Ingest.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest.simulate; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,38 +49,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.simulate.Ingest @JsonpDeserializable -public class Ingest implements PlainJsonSerializable { - private final String timestamp; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Ingest implements PlainJsonSerializable, ToCopyableBuilder { @Nullable private final String pipeline; + @Nonnull + private final String timestamp; + // --------------------------------------------------------------------------------------------- private Ingest(Builder builder) { - - this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); this.pipeline = builder.pipeline; - + this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); } - public static Ingest of(Function> fn) { + public static Ingest of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code timestamp} - */ - public final String timestamp() { - return this.timestamp; - } - /** * API name: {@code pipeline} */ @@ -82,9 +85,18 @@ public final String pipeline() { return this.pipeline; } + /** + * Required - API name: {@code timestamp} + */ + @Nonnull + public final String timestamp() { + return this.timestamp; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -92,52 +104,79 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("timestamp"); - generator.write(this.timestamp); - if (this.pipeline != null) { generator.writeKey("pipeline"); generator.write(this.pipeline); - } + generator.writeKey("timestamp"); + generator.write(this.timestamp); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Ingest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String timestamp; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String pipeline; + private String timestamp; - /** - * Required - API name: {@code timestamp} - */ - public final Builder timestamp(String value) { - this.timestamp = value; - return this; + public Builder() {} + + private Builder(Ingest o) { + this.pipeline = o.pipeline; + this.timestamp = o.timestamp; + } + + private Builder(Builder o) { + this.pipeline = o.pipeline; + this.timestamp = o.timestamp; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code pipeline} */ + @Nonnull public final Builder pipeline(@Nullable String value) { this.pipeline = value; return this; } + /** + * Required - API name: {@code timestamp} + */ + @Nonnull + public final Builder timestamp(String value) { + this.timestamp = value; + return this; + } + /** * Builds a {@link Ingest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Ingest build() { _checkSingleUse(); @@ -156,10 +195,23 @@ public Ingest build() { ); protected static void setupIngestDeserializer(ObjectDeserializer op) { - - op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); op.add(Builder::pipeline, JsonpDeserializer.stringDeserializer(), "pipeline"); + op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.pipeline); + result = 31 * result + this.timestamp.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Ingest other = (Ingest) o; + return Objects.equals(this.pipeline, other.pipeline) && this.timestamp.equals(other.timestamp); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java index e68719c7e3..9bd480b3a0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ingest/simulate/PipelineSimulation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.ingest.simulate; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,42 +49,45 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ActionStatusOptions; +import org.opensearch.client.opensearch._types.ActionStatusOptions; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: ingest.simulate.PipelineSimulation @JsonpDeserializable -public class PipelineSimulation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PipelineSimulation implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final DocumentSimulation doc; + @Nonnull private final List processorResults; - @Nullable - private final String tag; - @Nullable private final String processorType; @Nullable private final ActionStatusOptions status; + @Nullable + private final String tag; + // --------------------------------------------------------------------------------------------- private PipelineSimulation(Builder builder) { - this.doc = builder.doc; this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); - this.tag = builder.tag; this.processorType = builder.processorType; this.status = builder.status; - + this.tag = builder.tag; } - public static PipelineSimulation of(Function> fn) { + public static PipelineSimulation of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -92,18 +102,11 @@ public final DocumentSimulation doc() { /** * API name: {@code processor_results} */ + @Nonnull public final List processorResults() { return this.processorResults; } - /** - * API name: {@code tag} - */ - @Nullable - public final String tag() { - return this.tag; - } - /** * API name: {@code processor_type} */ @@ -120,9 +123,18 @@ public final ActionStatusOptions status() { return this.status; } + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -130,64 +142,92 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.doc != null) { generator.writeKey("doc"); this.doc.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.processorResults)) { generator.writeKey("processor_results"); generator.writeStartArray(); for (PipelineSimulation item0 : this.processorResults) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - if (this.tag != null) { - generator.writeKey("tag"); - generator.write(this.tag); - } if (this.processorType != null) { generator.writeKey("processor_type"); generator.write(this.processorType); - } + if (this.status != null) { generator.writeKey("status"); this.status.serialize(generator, mapper); } + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PipelineSimulation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private DocumentSimulation doc; - @Nullable private List processorResults; - - @Nullable - private String tag; - @Nullable private String processorType; - @Nullable private ActionStatusOptions status; + @Nullable + private String tag; + + public Builder() {} + + private Builder(PipelineSimulation o) { + this.doc = o.doc; + this.processorResults = _listCopy(o.processorResults); + this.processorType = o.processorType; + this.status = o.status; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.doc = o.doc; + this.processorResults = _listCopy(o.processorResults); + this.processorType = o.processorType; + this.status = o.status; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * API name: {@code doc} */ + @Nonnull public final Builder doc(@Nullable DocumentSimulation value) { this.doc = value; return this; @@ -196,15 +236,19 @@ public final Builder doc(@Nullable DocumentSimulation value) { /** * API name: {@code doc} */ + @Nonnull public final Builder doc(Function> fn) { - return this.doc(fn.apply(new DocumentSimulation.Builder()).build()); + return doc(fn.apply(new DocumentSimulation.Builder()).build()); } /** * API name: {@code processor_results} + * *

* Adds all elements of list to processorResults. + *

*/ + @Nonnull public final Builder processorResults(List list) { this.processorResults = _listAddAll(this.processorResults, list); return this; @@ -212,9 +256,12 @@ public final Builder processorResults(List list) { /** * API name: {@code processor_results} + * *

* Adds one or more values to processorResults. + *

*/ + @Nonnull public final Builder processorResults(PipelineSimulation value, PipelineSimulation... values) { this.processorResults = _listAdd(this.processorResults, value, values); return this; @@ -222,24 +269,20 @@ public final Builder processorResults(PipelineSimulation value, PipelineSimulati /** * API name: {@code processor_results} + * *

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

*/ + @Nonnull public final Builder processorResults(Function> fn) { return processorResults(fn.apply(new PipelineSimulation.Builder()).build()); } - /** - * API name: {@code tag} - */ - public final Builder tag(@Nullable String value) { - this.tag = value; - return this; - } - /** * API name: {@code processor_type} */ + @Nonnull public final Builder processorType(@Nullable String value) { this.processorType = value; return this; @@ -248,17 +291,28 @@ public final Builder processorType(@Nullable String value) { /** * API name: {@code status} */ + @Nonnull public final Builder status(@Nullable ActionStatusOptions value) { this.status = value; return this; } + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + /** * Builds a {@link PipelineSimulation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PipelineSimulation build() { _checkSingleUse(); @@ -277,13 +331,33 @@ public PipelineSimulation build() { ); protected static void setupPipelineSimulationDeserializer(ObjectDeserializer op) { - op.add(Builder::doc, DocumentSimulation._DESERIALIZER, "doc"); op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(PipelineSimulation._DESERIALIZER), "processor_results"); - op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); op.add(Builder::processorType, JsonpDeserializer.stringDeserializer(), "processor_type"); op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.doc); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.processorType); + result = 31 * result + Objects.hashCode(this.status); + result = 31 * result + Objects.hashCode(this.tag); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PipelineSimulation other = (PipelineSimulation) o; + return Objects.equals(this.doc, other.doc) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.processorType, other.processorType) + && Objects.equals(this.status, other.status) + && Objects.equals(this.tag, other.tag); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 75d860c402..6cb98b6e70 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -118,7 +118,6 @@ import org.opensearch.client.opensearch.core.pit.DeletePitResponse; import org.opensearch.client.opensearch.core.pit.ListAllPitRequest; import org.opensearch.client.opensearch.core.pit.ListAllPitResponse; -import org.opensearch.client.opensearch.ingest.OpenSearchIngestAsyncClient; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -149,10 +148,6 @@ public OpenSearchCatAsyncClient cat() { return new OpenSearchCatAsyncClient(this.transport, this.transportOptions); } - public OpenSearchIngestAsyncClient ingest() { - return new OpenSearchIngestAsyncClient(this.transport, this.transportOptions); - } - // ----- Endpoint: bulk /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java index d2e73df1c1..9a8f90bb42 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -118,7 +118,6 @@ import org.opensearch.client.opensearch.core.pit.ListAllPitRequest; import org.opensearch.client.opensearch.core.pit.ListAllPitResponse; import org.opensearch.client.opensearch.generic.OpenSearchGenericClient; -import org.opensearch.client.opensearch.ingest.OpenSearchIngestClient; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -152,10 +151,6 @@ public OpenSearchCatClient cat() { return new OpenSearchCatClient(this.transport, this.transportOptions); } - public OpenSearchIngestClient ingest() { - return new OpenSearchIngestClient(this.transport, this.transportOptions); - } - // ----- Endpoint: bulk /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java deleted file mode 100644 index b87d0e3a9d..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/DateIndexNameProcessor.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: ingest._types.DateIndexNameProcessor - -@JsonpDeserializable -public class DateIndexNameProcessor extends ProcessorBase implements ProcessorVariant { - private final List dateFormats; - - private final String dateRounding; - - private final String field; - - private final String indexNameFormat; - - private final String indexNamePrefix; - - private final String locale; - - private final String timezone; - - // --------------------------------------------------------------------------------------------- - - private DateIndexNameProcessor(Builder builder) { - super(builder); - - this.dateFormats = ApiTypeHelper.unmodifiableRequired(builder.dateFormats, this, "dateFormats"); - this.dateRounding = ApiTypeHelper.requireNonNull(builder.dateRounding, this, "dateRounding"); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.indexNameFormat = ApiTypeHelper.requireNonNull(builder.indexNameFormat, this, "indexNameFormat"); - this.indexNamePrefix = ApiTypeHelper.requireNonNull(builder.indexNamePrefix, this, "indexNamePrefix"); - this.locale = ApiTypeHelper.requireNonNull(builder.locale, this, "locale"); - this.timezone = ApiTypeHelper.requireNonNull(builder.timezone, this, "timezone"); - - } - - public static DateIndexNameProcessor of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Processor variant kind. - */ - @Override - public Processor.Kind _processorKind() { - return Processor.Kind.DateIndexName; - } - - /** - * Required - API name: {@code date_formats} - */ - public final List dateFormats() { - return this.dateFormats; - } - - /** - * Required - How to round the date when formatting the date into the index - * name. Valid values are: y (year), M (month), - * w (week), d (day), h (hour), - * m (minute) and s (second). Supports template - * snippets. - *

- * API name: {@code date_rounding} - */ - public final String dateRounding() { - return this.dateRounding; - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Required - API name: {@code index_name_format} - */ - public final String indexNameFormat() { - return this.indexNameFormat; - } - - /** - * Required - API name: {@code index_name_prefix} - */ - public final String indexNamePrefix() { - return this.indexNamePrefix; - } - - /** - * Required - API name: {@code locale} - */ - public final String locale() { - return this.locale; - } - - /** - * Required - API name: {@code timezone} - */ - public final String timezone() { - return this.timezone; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.dateFormats)) { - generator.writeKey("date_formats"); - generator.writeStartArray(); - for (String item0 : this.dateFormats) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("date_rounding"); - generator.write(this.dateRounding); - - generator.writeKey("field"); - generator.write(this.field); - - generator.writeKey("index_name_format"); - generator.write(this.indexNameFormat); - - generator.writeKey("index_name_prefix"); - generator.write(this.indexNamePrefix); - - generator.writeKey("locale"); - generator.write(this.locale); - - generator.writeKey("timezone"); - generator.write(this.timezone); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DateIndexNameProcessor}. - */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private List dateFormats; - - private String dateRounding; - - private String field; - - private String indexNameFormat; - - private String indexNamePrefix; - - private String locale; - - private String timezone; - - /** - * Required - API name: {@code date_formats} - *

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

- * Adds one or more values to dateFormats. - */ - public final Builder dateFormats(String value, String... values) { - this.dateFormats = _listAdd(this.dateFormats, value, values); - return this; - } - - /** - * Required - How to round the date when formatting the date into the index - * name. Valid values are: y (year), M (month), - * w (week), d (day), h (hour), - * m (minute) and s (second). Supports template - * snippets. - *

- * API name: {@code date_rounding} - */ - public final Builder dateRounding(String value) { - this.dateRounding = value; - return this; - } - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - API name: {@code index_name_format} - */ - public final Builder indexNameFormat(String value) { - this.indexNameFormat = value; - return this; - } - - /** - * Required - API name: {@code index_name_prefix} - */ - public final Builder indexNamePrefix(String value) { - this.indexNamePrefix = value; - return this; - } - - /** - * Required - API name: {@code locale} - */ - public final Builder locale(String value) { - this.locale = value; - return this; - } - - /** - * Required - API name: {@code timezone} - */ - public final Builder timezone(String value) { - this.timezone = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DateIndexNameProcessor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DateIndexNameProcessor build() { - _checkSingleUse(); - - return new DateIndexNameProcessor(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DateIndexNameProcessor} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - DateIndexNameProcessor::setupDateIndexNameProcessorDeserializer - ); - - protected static void setupDateIndexNameProcessorDeserializer(ObjectDeserializer op) { - setupProcessorBaseDeserializer(op); - op.add(Builder::dateFormats, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "date_formats"); - op.add(Builder::dateRounding, JsonpDeserializer.stringDeserializer(), "date_rounding"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::indexNameFormat, JsonpDeserializer.stringDeserializer(), "index_name_format"); - op.add(Builder::indexNamePrefix, JsonpDeserializer.stringDeserializer(), "index_name_prefix"); - op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); - op.add(Builder::timezone, JsonpDeserializer.stringDeserializer(), "timezone"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpProcessor.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpProcessor.java deleted file mode 100644 index 67493f36ff..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpProcessor.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: ingest._types.GeoIpProcessor - -@JsonpDeserializable -public class GeoIpProcessor extends ProcessorBase implements ProcessorVariant { - private final String databaseFile; - - private final String field; - - private final boolean firstOnly; - - private final boolean ignoreMissing; - - private final List properties; - - private final String targetField; - - // --------------------------------------------------------------------------------------------- - - private GeoIpProcessor(Builder builder) { - super(builder); - - this.databaseFile = ApiTypeHelper.requireNonNull(builder.databaseFile, this, "databaseFile"); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.firstOnly = ApiTypeHelper.requireNonNull(builder.firstOnly, this, "firstOnly"); - this.ignoreMissing = ApiTypeHelper.requireNonNull(builder.ignoreMissing, this, "ignoreMissing"); - this.properties = ApiTypeHelper.unmodifiableRequired(builder.properties, this, "properties"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - - } - - public static GeoIpProcessor of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Processor variant kind. - */ - @Override - public Processor.Kind _processorKind() { - return Processor.Kind.Geoip; - } - - /** - * Required - API name: {@code database_file} - */ - public final String databaseFile() { - return this.databaseFile; - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Required - API name: {@code first_only} - */ - public final boolean firstOnly() { - return this.firstOnly; - } - - /** - * Required - API name: {@code ignore_missing} - */ - public final boolean ignoreMissing() { - return this.ignoreMissing; - } - - /** - * Required - API name: {@code properties} - */ - public final List properties() { - return this.properties; - } - - /** - * Required - API name: {@code target_field} - */ - public final String targetField() { - return this.targetField; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("database_file"); - generator.write(this.databaseFile); - - generator.writeKey("field"); - generator.write(this.field); - - generator.writeKey("first_only"); - generator.write(this.firstOnly); - - generator.writeKey("ignore_missing"); - generator.write(this.ignoreMissing); - - if (ApiTypeHelper.isDefined(this.properties)) { - generator.writeKey("properties"); - generator.writeStartArray(); - for (String item0 : this.properties) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("target_field"); - generator.write(this.targetField); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoIpProcessor}. - */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private String databaseFile; - - private String field; - - private Boolean firstOnly; - - private Boolean ignoreMissing; - - private List properties; - - private String targetField; - - /** - * Required - API name: {@code database_file} - */ - public final Builder databaseFile(String value) { - this.databaseFile = value; - return this; - } - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - API name: {@code first_only} - */ - public final Builder firstOnly(boolean value) { - this.firstOnly = value; - return this; - } - - /** - * Required - API name: {@code ignore_missing} - */ - public final Builder ignoreMissing(boolean value) { - this.ignoreMissing = value; - return this; - } - - /** - * Required - API name: {@code properties} - *

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

- * Adds one or more values to properties. - */ - public final Builder properties(String value, String... values) { - this.properties = _listAdd(this.properties, value, values); - return this; - } - - /** - * Required - API name: {@code target_field} - */ - public final Builder targetField(String value) { - this.targetField = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GeoIpProcessor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoIpProcessor build() { - _checkSingleUse(); - - return new GeoIpProcessor(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoIpProcessor} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GeoIpProcessor::setupGeoIpProcessorDeserializer - ); - - protected static void setupGeoIpProcessorDeserializer(ObjectDeserializer op) { - setupProcessorBaseDeserializer(op); - op.add(Builder::databaseFile, JsonpDeserializer.stringDeserializer(), "database_file"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::firstOnly, JsonpDeserializer.booleanDeserializer(), "first_only"); - op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); - op.add(Builder::properties, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "properties"); - op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsRequest.java deleted file mode 100644 index 6ee7add9ef..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import java.util.Collections; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; - -// typedef: ingest.geo_ip_stats.Request - -/** - * Returns statistical information about geoip databases - * - */ - -public class GeoIpStatsRequest extends RequestBase { - public GeoIpStatsRequest() {} - - /** - * Singleton instance for {@link GeoIpStatsRequest}. - */ - public static final GeoIpStatsRequest _INSTANCE = new GeoIpStatsRequest(); - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code ingest.geo_ip_stats}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - return "/_ingest/geoip/stats"; - - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, - SimpleEndpoint.emptyMap(), - false, - GeoIpStatsResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsResponse.java deleted file mode 100644 index fddf72f81e..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GeoIpStatsResponse.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch.ingest.geo_ip_stats.GeoIpDownloadStatistics; -import org.opensearch.client.opensearch.ingest.geo_ip_stats.GeoIpNodeDatabases; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest.geo_ip_stats.Response - -@JsonpDeserializable -public class GeoIpStatsResponse implements PlainJsonSerializable { - private final GeoIpDownloadStatistics stats; - - private final Map nodes; - - // --------------------------------------------------------------------------------------------- - - private GeoIpStatsResponse(Builder builder) { - - this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats"); - this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); - - } - - public static GeoIpStatsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Download statistics for all GeoIP2 databases. - *

- * API name: {@code stats} - */ - public final GeoIpDownloadStatistics stats() { - return this.stats; - } - - /** - * Required - Downloaded GeoIP2 databases for each node. - *

- * API name: {@code nodes} - */ - public final Map nodes() { - return this.nodes; - } - - /** - * 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("stats"); - this.stats.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(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoIpStatsResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private GeoIpDownloadStatistics stats; - - private Map nodes; - - /** - * Required - Download statistics for all GeoIP2 databases. - *

- * API name: {@code stats} - */ - public final Builder stats(GeoIpDownloadStatistics value) { - this.stats = value; - return this; - } - - /** - * Required - Download statistics for all GeoIP2 databases. - *

- * API name: {@code stats} - */ - public final Builder stats(Function> fn) { - return this.stats(fn.apply(new GeoIpDownloadStatistics.Builder()).build()); - } - - /** - * Required - Downloaded GeoIP2 databases for each node. - *

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

- * Adds all entries of map to nodes. - */ - public final Builder nodes(Map map) { - this.nodes = _mapPutAll(this.nodes, map); - return this; - } - - /** - * Required - Downloaded GeoIP2 databases for each node. - *

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

- * Adds an entry to nodes. - */ - public final Builder nodes(String key, GeoIpNodeDatabases value) { - this.nodes = _mapPut(this.nodes, key, value); - return this; - } - - /** - * Required - Downloaded GeoIP2 databases for each node. - *

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

- * Adds an entry to nodes using a builder lambda. - */ - public final Builder nodes(String key, Function> fn) { - return nodes(key, fn.apply(new GeoIpNodeDatabases.Builder()).build()); - } - - /** - * Builds a {@link GeoIpStatsResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoIpStatsResponse build() { - _checkSingleUse(); - - return new GeoIpStatsResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoIpStatsResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GeoIpStatsResponse::setupGeoIpStatsResponseDeserializer - ); - - protected static void setupGeoIpStatsResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::stats, GeoIpDownloadStatistics._DESERIALIZER, "stats"); - op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(GeoIpNodeDatabases._DESERIALIZER), "nodes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfig.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfig.java deleted file mode 100644 index 4d2bb4e319..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfig.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest._types.InferenceConfig - -@JsonpDeserializable -public class InferenceConfig implements PlainJsonSerializable { - @Nullable - private final InferenceConfigRegression regression; - - // --------------------------------------------------------------------------------------------- - - private InferenceConfig(Builder builder) { - - this.regression = builder.regression; - - } - - public static InferenceConfig of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code regression} - */ - @Nullable - public final InferenceConfigRegression regression() { - return this.regression; - } - - /** - * 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.regression != null) { - generator.writeKey("regression"); - this.regression.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InferenceConfig}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private InferenceConfigRegression regression; - - /** - * API name: {@code regression} - */ - public final Builder regression(@Nullable InferenceConfigRegression value) { - this.regression = value; - return this; - } - - /** - * API name: {@code regression} - */ - public final Builder regression(Function> fn) { - return this.regression(fn.apply(new InferenceConfigRegression.Builder()).build()); - } - - /** - * Builds a {@link InferenceConfig}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InferenceConfig build() { - _checkSingleUse(); - - return new InferenceConfig(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InferenceConfig} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - InferenceConfig::setupInferenceConfigDeserializer - ); - - protected static void setupInferenceConfigDeserializer(ObjectDeserializer op) { - - op.add(Builder::regression, InferenceConfigRegression._DESERIALIZER, "regression"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfigRegression.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfigRegression.java deleted file mode 100644 index c3c80989ee..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceConfigRegression.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest._types.InferenceConfigRegression - -@JsonpDeserializable -public class InferenceConfigRegression implements PlainJsonSerializable { - private final String resultsField; - - // --------------------------------------------------------------------------------------------- - - private InferenceConfigRegression(Builder builder) { - - this.resultsField = ApiTypeHelper.requireNonNull(builder.resultsField, this, "resultsField"); - - } - - public static InferenceConfigRegression of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code results_field} - */ - public final String resultsField() { - return this.resultsField; - } - - /** - * 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("results_field"); - generator.write(this.resultsField); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InferenceConfigRegression}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String resultsField; - - /** - * Required - API name: {@code results_field} - */ - public final Builder resultsField(String value) { - this.resultsField = value; - return this; - } - - /** - * Builds a {@link InferenceConfigRegression}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InferenceConfigRegression build() { - _checkSingleUse(); - - return new InferenceConfigRegression(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InferenceConfigRegression} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - InferenceConfigRegression::setupInferenceConfigRegressionDeserializer - ); - - protected static void setupInferenceConfigRegressionDeserializer(ObjectDeserializer op) { - - op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceProcessor.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceProcessor.java deleted file mode 100644 index 18a9cf0fd8..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/InferenceProcessor.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonData; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: ingest._types.InferenceProcessor - -@JsonpDeserializable -public class InferenceProcessor extends ProcessorBase implements ProcessorVariant { - private final String modelId; - - private final String targetField; - - private final Map fieldMap; - - @Nullable - private final InferenceConfig inferenceConfig; - - // --------------------------------------------------------------------------------------------- - - private InferenceProcessor(Builder builder) { - super(builder); - - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - this.fieldMap = ApiTypeHelper.unmodifiable(builder.fieldMap); - this.inferenceConfig = builder.inferenceConfig; - - } - - public static InferenceProcessor of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Processor variant kind. - */ - @Override - public Processor.Kind _processorKind() { - return Processor.Kind.Inference; - } - - /** - * Required - API name: {@code model_id} - */ - public final String modelId() { - return this.modelId; - } - - /** - * Required - API name: {@code target_field} - */ - public final String targetField() { - return this.targetField; - } - - /** - * API name: {@code field_map} - */ - public final Map fieldMap() { - return this.fieldMap; - } - - /** - * API name: {@code inference_config} - */ - @Nullable - public final InferenceConfig inferenceConfig() { - return this.inferenceConfig; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("model_id"); - generator.write(this.modelId); - - generator.writeKey("target_field"); - generator.write(this.targetField); - - if (ApiTypeHelper.isDefined(this.fieldMap)) { - generator.writeKey("field_map"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fieldMap.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.inferenceConfig != null) { - generator.writeKey("inference_config"); - this.inferenceConfig.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InferenceProcessor}. - */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private String modelId; - - private String targetField; - - @Nullable - private Map fieldMap; - - @Nullable - private InferenceConfig inferenceConfig; - - /** - * Required - API name: {@code model_id} - */ - public final Builder modelId(String value) { - this.modelId = value; - return this; - } - - /** - * Required - API name: {@code target_field} - */ - public final Builder targetField(String value) { - this.targetField = value; - return this; - } - - /** - * API name: {@code field_map} - *

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

- * Adds an entry to fieldMap. - */ - public final Builder fieldMap(String key, JsonData value) { - this.fieldMap = _mapPut(this.fieldMap, key, value); - return this; - } - - /** - * API name: {@code inference_config} - */ - public final Builder inferenceConfig(@Nullable InferenceConfig value) { - this.inferenceConfig = value; - return this; - } - - /** - * API name: {@code inference_config} - */ - public final Builder inferenceConfig(Function> fn) { - return this.inferenceConfig(fn.apply(new InferenceConfig.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link InferenceProcessor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InferenceProcessor build() { - _checkSingleUse(); - - return new InferenceProcessor(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InferenceProcessor} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - InferenceProcessor::setupInferenceProcessorDeserializer - ); - - protected static void setupInferenceProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); - op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); - op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); - op.add(Builder::fieldMap, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "field_map"); - op.add(Builder::inferenceConfig, InferenceConfig._DESERIALIZER, "inference_config"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java deleted file mode 100644 index 4bd395f727..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/JsonProcessor.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: ingest._types.JsonProcessor - -@JsonpDeserializable -public class JsonProcessor extends ProcessorBase implements ProcessorVariant { - private final boolean addToRoot; - - private final String field; - - private final String targetField; - - // --------------------------------------------------------------------------------------------- - - private JsonProcessor(Builder builder) { - super(builder); - - this.addToRoot = ApiTypeHelper.requireNonNull(builder.addToRoot, this, "addToRoot"); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); - - } - - public static JsonProcessor of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Processor variant kind. - */ - @Override - public Processor.Kind _processorKind() { - return Processor.Kind.Json; - } - - /** - * Required - API name: {@code add_to_root} - */ - public final boolean addToRoot() { - return this.addToRoot; - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Required - API name: {@code target_field} - */ - public final String targetField() { - return this.targetField; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("add_to_root"); - generator.write(this.addToRoot); - - generator.writeKey("field"); - generator.write(this.field); - - generator.writeKey("target_field"); - generator.write(this.targetField); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link JsonProcessor}. - */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private Boolean addToRoot; - - private String field; - - private String targetField; - - /** - * Required - API name: {@code add_to_root} - */ - public final Builder addToRoot(boolean value) { - this.addToRoot = value; - return this; - } - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - API name: {@code target_field} - */ - public final Builder targetField(String value) { - this.targetField = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link JsonProcessor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public JsonProcessor build() { - _checkSingleUse(); - - return new JsonProcessor(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link JsonProcessor} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - JsonProcessor::setupJsonProcessorDeserializer - ); - - protected static void setupJsonProcessorDeserializer(ObjectDeserializer op) { - ProcessorBase.setupProcessorBaseDeserializer(op); - op.add(Builder::addToRoot, JsonpDeserializer.booleanDeserializer(), "add_to_root"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java deleted file mode 100644 index b87e3e46d8..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import java.util.Collections; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; - -// typedef: ingest.processor_grok.Request - -/** - * Returns a list of the built-in patterns. - * - */ - -public class ProcessorGrokRequest extends RequestBase { - public ProcessorGrokRequest() {} - - /** - * Singleton instance for {@link ProcessorGrokRequest}. - */ - public static final ProcessorGrokRequest _INSTANCE = new ProcessorGrokRequest(); - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code ingest.processor_grok}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - return "/_ingest/processor/grok"; - - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, - SimpleEndpoint.emptyMap(), - false, - ProcessorGrokResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetProcessor.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetProcessor.java deleted file mode 100644 index 9c120f31f6..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/SetProcessor.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonData; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: ingest._types.SetProcessor - -@JsonpDeserializable -public class SetProcessor extends ProcessorBase implements ProcessorVariant { - private final String field; - - @Nullable - private final Boolean override; - - private final JsonData value; - - // --------------------------------------------------------------------------------------------- - - private SetProcessor(Builder builder) { - super(builder); - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.override = builder.override; - this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value"); - - } - - public static SetProcessor of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Processor variant kind. - */ - @Override - public Processor.Kind _processorKind() { - return Processor.Kind.Set; - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * API name: {@code override} - */ - @Nullable - public final Boolean override() { - return this.override; - } - - /** - * Required - API name: {@code value} - */ - public final JsonData value() { - return this.value; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("field"); - generator.write(this.field); - - if (this.override != null) { - generator.writeKey("override"); - generator.write(this.override); - - } - generator.writeKey("value"); - this.value.serialize(generator, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SetProcessor}. - */ - - public static class Builder extends ProcessorBase.AbstractBuilder implements ObjectBuilder { - private String field; - - @Nullable - private Boolean override; - - private JsonData value; - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * API name: {@code override} - */ - public final Builder override(@Nullable Boolean value) { - this.override = value; - return this; - } - - /** - * Required - API name: {@code value} - */ - public final Builder value(JsonData value) { - this.value = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SetProcessor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SetProcessor build() { - _checkSingleUse(); - - return new SetProcessor(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SetProcessor} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - SetProcessor::setupSetProcessorDeserializer - ); - - protected static void setupSetProcessorDeserializer(ObjectDeserializer op) { - setupProcessorBaseDeserializer(op); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::override, JsonpDeserializer.booleanDeserializer(), "override"); - op.add(Builder::value, JsonData._DESERIALIZER, "value"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java deleted file mode 100644 index ddbc03f616..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest.geo_ip_stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest.geo_ip_stats.GeoIpDownloadStatistics - -@JsonpDeserializable -public class GeoIpDownloadStatistics implements PlainJsonSerializable { - private final int successfulDownloads; - - private final int failedDownloads; - - private final int totalDownloadTime; - - private final int databaseCount; - - private final int skippedUpdates; - - // --------------------------------------------------------------------------------------------- - - private GeoIpDownloadStatistics(Builder builder) { - - this.successfulDownloads = ApiTypeHelper.requireNonNull(builder.successfulDownloads, this, "successfulDownloads"); - this.failedDownloads = ApiTypeHelper.requireNonNull(builder.failedDownloads, this, "failedDownloads"); - this.totalDownloadTime = ApiTypeHelper.requireNonNull(builder.totalDownloadTime, this, "totalDownloadTime"); - this.databaseCount = ApiTypeHelper.requireNonNull(builder.databaseCount, this, "databaseCount"); - this.skippedUpdates = ApiTypeHelper.requireNonNull(builder.skippedUpdates, this, "skippedUpdates"); - - } - - public static GeoIpDownloadStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Total number of successful database downloads. - *

- * API name: {@code successful_downloads} - */ - public final int successfulDownloads() { - return this.successfulDownloads; - } - - /** - * Required - Total number of failed database downloads. - *

- * API name: {@code failed_downloads} - */ - public final int failedDownloads() { - return this.failedDownloads; - } - - /** - * Required - Total milliseconds spent downloading databases. - *

- * API name: {@code total_download_time} - */ - public final int totalDownloadTime() { - return this.totalDownloadTime; - } - - /** - * Required - Current number of databases available for use. - *

- * API name: {@code database_count} - */ - public final int databaseCount() { - return this.databaseCount; - } - - /** - * Required - Total number of database updates skipped. - *

- * API name: {@code skipped_updates} - */ - public final int skippedUpdates() { - return this.skippedUpdates; - } - - /** - * 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("successful_downloads"); - generator.write(this.successfulDownloads); - - generator.writeKey("failed_downloads"); - generator.write(this.failedDownloads); - - generator.writeKey("total_download_time"); - generator.write(this.totalDownloadTime); - - generator.writeKey("database_count"); - generator.write(this.databaseCount); - - generator.writeKey("skipped_updates"); - generator.write(this.skippedUpdates); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoIpDownloadStatistics}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer successfulDownloads; - - private Integer failedDownloads; - - private Integer totalDownloadTime; - - private Integer databaseCount; - - private Integer skippedUpdates; - - /** - * Required - Total number of successful database downloads. - *

- * API name: {@code successful_downloads} - */ - public final Builder successfulDownloads(int value) { - this.successfulDownloads = value; - return this; - } - - /** - * Required - Total number of failed database downloads. - *

- * API name: {@code failed_downloads} - */ - public final Builder failedDownloads(int value) { - this.failedDownloads = value; - return this; - } - - /** - * Required - Total milliseconds spent downloading databases. - *

- * API name: {@code total_download_time} - */ - public final Builder totalDownloadTime(int value) { - this.totalDownloadTime = value; - return this; - } - - /** - * Required - Current number of databases available for use. - *

- * API name: {@code database_count} - */ - public final Builder databaseCount(int value) { - this.databaseCount = value; - return this; - } - - /** - * Required - Total number of database updates skipped. - *

- * API name: {@code skipped_updates} - */ - public final Builder skippedUpdates(int value) { - this.skippedUpdates = value; - return this; - } - - /** - * Builds a {@link GeoIpDownloadStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoIpDownloadStatistics build() { - _checkSingleUse(); - - return new GeoIpDownloadStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoIpDownloadStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GeoIpDownloadStatistics::setupGeoIpDownloadStatisticsDeserializer - ); - - protected static void setupGeoIpDownloadStatisticsDeserializer(ObjectDeserializer op) { - - op.add(Builder::successfulDownloads, JsonpDeserializer.integerDeserializer(), "successful_downloads"); - op.add(Builder::failedDownloads, JsonpDeserializer.integerDeserializer(), "failed_downloads"); - op.add(Builder::totalDownloadTime, JsonpDeserializer.integerDeserializer(), "total_download_time"); - op.add(Builder::databaseCount, JsonpDeserializer.integerDeserializer(), "database_count"); - op.add(Builder::skippedUpdates, JsonpDeserializer.integerDeserializer(), "skipped_updates"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabaseName.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabaseName.java deleted file mode 100644 index 3ad63fca6f..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabaseName.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest.geo_ip_stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest.geo_ip_stats.GeoIpNodeDatabaseName - -@JsonpDeserializable -public class GeoIpNodeDatabaseName implements PlainJsonSerializable { - private final String name; - - // --------------------------------------------------------------------------------------------- - - private GeoIpNodeDatabaseName(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static GeoIpNodeDatabaseName of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Name of the database. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * 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); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoIpNodeDatabaseName}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - /** - * Required - Name of the database. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Builds a {@link GeoIpNodeDatabaseName}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoIpNodeDatabaseName build() { - _checkSingleUse(); - - return new GeoIpNodeDatabaseName(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoIpNodeDatabaseName} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GeoIpNodeDatabaseName::setupGeoIpNodeDatabaseNameDeserializer - ); - - protected static void setupGeoIpNodeDatabaseNameDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabases.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabases.java deleted file mode 100644 index fb09d31957..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/geo_ip_stats/GeoIpNodeDatabases.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.ingest.geo_ip_stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: ingest.geo_ip_stats.GeoIpNodeDatabases - -/** - * Downloaded databases for the node. The field key is the node ID. - * - */ -@JsonpDeserializable -public class GeoIpNodeDatabases implements PlainJsonSerializable { - private final List databases; - - private final List filesInTemp; - - // --------------------------------------------------------------------------------------------- - - private GeoIpNodeDatabases(Builder builder) { - - this.databases = ApiTypeHelper.unmodifiableRequired(builder.databases, this, "databases"); - this.filesInTemp = ApiTypeHelper.unmodifiableRequired(builder.filesInTemp, this, "filesInTemp"); - - } - - public static GeoIpNodeDatabases of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Downloaded databases for the node. - *

- * API name: {@code databases} - */ - public final List databases() { - return this.databases; - } - - /** - * Required - Downloaded database files, including related license files. - * OpenSearch stores these files in the node's temporary directory: - * $ES_TMPDIR/geoip-databases/<node_id>. - *

- * API name: {@code files_in_temp} - */ - public final List filesInTemp() { - return this.filesInTemp; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.databases)) { - generator.writeKey("databases"); - generator.writeStartArray(); - for (GeoIpNodeDatabaseName item0 : this.databases) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.filesInTemp)) { - generator.writeKey("files_in_temp"); - generator.writeStartArray(); - for (String item0 : this.filesInTemp) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoIpNodeDatabases}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private List databases; - - private List filesInTemp; - - /** - * Required - Downloaded databases for the node. - *

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

- * Adds all elements of list to databases. - */ - public final Builder databases(List list) { - this.databases = _listAddAll(this.databases, list); - return this; - } - - /** - * Required - Downloaded databases for the node. - *

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

- * Adds one or more values to databases. - */ - public final Builder databases(GeoIpNodeDatabaseName value, GeoIpNodeDatabaseName... values) { - this.databases = _listAdd(this.databases, value, values); - return this; - } - - /** - * Required - Downloaded databases for the node. - *

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

- * Adds a value to databases using a builder lambda. - */ - public final Builder databases(Function> fn) { - return databases(fn.apply(new GeoIpNodeDatabaseName.Builder()).build()); - } - - /** - * Required - Downloaded database files, including related license files. - * OpenSearch stores these files in the node's temporary directory: - * $ES_TMPDIR/geoip-databases/<node_id>. - *

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

- * Adds all elements of list to filesInTemp. - */ - public final Builder filesInTemp(List list) { - this.filesInTemp = _listAddAll(this.filesInTemp, list); - return this; - } - - /** - * Required - Downloaded database files, including related license files. - * OpenSearch stores these files in the node's temporary directory: - * $ES_TMPDIR/geoip-databases/<node_id>. - *

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

- * Adds one or more values to filesInTemp. - */ - public final Builder filesInTemp(String value, String... values) { - this.filesInTemp = _listAdd(this.filesInTemp, value, values); - return this; - } - - /** - * Builds a {@link GeoIpNodeDatabases}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoIpNodeDatabases build() { - _checkSingleUse(); - - return new GeoIpNodeDatabases(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoIpNodeDatabases} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GeoIpNodeDatabases::setupGeoIpNodeDatabasesDeserializer - ); - - protected static void setupGeoIpNodeDatabasesDeserializer(ObjectDeserializer op) { - - op.add(Builder::databases, JsonpDeserializer.arrayDeserializer(GeoIpNodeDatabaseName._DESERIALIZER), "databases"); - op.add(Builder::filesInTemp, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "files_in_temp"); - - } - -} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java index fb6bd73e0e..e60b151d4d 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/ingest/TextEmbeddingProcessorTest.java @@ -30,7 +30,7 @@ public void testJsonRoundtripWithDescriptionAndBatchSize() { baseTextEmbeddingProcessor().description("processor-description").batchSize(1).build() ).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"description\":\"processor-description\",\"batch_size\":1}}"; + "{\"text_embedding\":{\"description\":\"processor-description\",\"tag\":\"some-tag\",\"batch_size\":1,\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -45,7 +45,7 @@ public void testJsonRoundtripWithDescriptionAndBatchSize() { public void testJsonRoundtripWithoutDescription() { Processor processor = new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(1).build()).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"batch_size\":1}}"; + "{\"text_embedding\":{\"tag\":\"some-tag\",\"batch_size\":1,\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -62,7 +62,7 @@ public void testJsonRoundtripWithoutBatchSize() { baseTextEmbeddingProcessor().description("processor-description").build() ).build(); String json = - "{\"text_embedding\":{\"tag\":\"some-tag\",\"model_id\":\"modelId\",\"field_map\":{\"input_field\":\"vector_field\"},\"description\":\"processor-description\"}}"; + "{\"text_embedding\":{\"description\":\"processor-description\",\"tag\":\"some-tag\",\"field_map\":{\"input_field\":\"vector_field\"},\"model_id\":\"modelId\"}}"; TextEmbeddingProcessor deserialized = checkJsonRoundtrip(processor, json).textEmbedding(); assertEquals("modelId", deserialized.modelId()); @@ -71,17 +71,4 @@ public void testJsonRoundtripWithoutBatchSize() { assertEquals("some-tag", deserialized.tag()); assertNull(deserialized.batchSize()); } - - @Test - public void testInvalidBatchSizeThrowsException() { - IllegalArgumentException exceptionWhenBatchSizeIsZero = assertThrows(IllegalArgumentException.class, () -> { - new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(0).build()).build(); - }); - assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsZero.getMessage()); - - IllegalArgumentException exceptionWhenBatchSizeIsNegative = assertThrows(IllegalArgumentException.class, () -> { - new Processor.Builder().textEmbedding(baseTextEmbeddingProcessor().batchSize(-1).build()).build(); - }); - assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsNegative.getMessage()); - } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 5ec1e1455f..a1f8e01bc2 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -61,6 +61,7 @@ public class CodeGenerator { ), namespace(is("dangling_indices")), and(namespace(is("indices")), name(isNot("get_field_mapping"))), + and(namespace(is("ingest"))), and( namespace(is("ml")), name( diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 0f289991e2..46fb33c999 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -130,6 +130,8 @@ private static JsonPointer schema(String namespace, String name) { .with(schema("indices.stats", "Metric"), so -> so.withClassName("IndicesStatsMetric")) + .with(schema("ingest._common", "ProcessorContainer"), so -> so.withClassName("Processor")) + .with( schema("nodes._common", "NodesResponseBase"), so -> so.withProperties(p -> p.with("_nodes", po -> po.withName("nodeStats"))) diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java index 467a0b5f49..216ddc6081 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java @@ -14,6 +14,7 @@ public class NameSanitizer { private static final Set reservedWords = Set.of( "default", + "if", "native", "transient", "boolean",