Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-generated client code using latest OpenSearch API specification #1236

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public enum ExpandWildcard implements JsonEnum {
All("all"),

/**
* Match closed, non-hidden indices.
* Match closed, non-hidden indexes.
*/
Closed("closed"),

/**
* Match hidden indices. Must be combined with open, closed, or both.
* Match hidden indexes. Must be combined with open, closed, or both.
*/
Hidden("hidden"),

Expand All @@ -66,7 +66,7 @@ public enum ExpandWildcard implements JsonEnum {
None("none"),

/**
* Match open, non-hidden indices.
* Match open, non-hidden indexes.
*/
Open("open");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public enum Kind implements JsonEnum {
Language("language"),
Nori("nori"),
Pattern("pattern"),
Phone("phone"),
Simple("simple"),
Smartcn("smartcn"),
Snowball("snowball"),
Expand Down Expand Up @@ -278,6 +279,22 @@ public PatternAnalyzer pattern() {
return TaggedUnionUtils.get(this, Kind.Pattern);
}

/**
* Is this variant instance of kind {@code phone}?
*/
public boolean isPhone() {
return _kind == Kind.Phone;
}

/**
* Get the {@code phone} variant value.
*
* @throws IllegalStateException if the current variant is not the {@code phone} kind.
*/
public PhoneAnalyzer phone() {
return TaggedUnionUtils.get(this, Kind.Phone);
}

/**
* Is this variant instance of kind {@code simple}?
*/
Expand Down Expand Up @@ -483,6 +500,16 @@ public ObjectBuilder<Analyzer> pattern(Function<PatternAnalyzer.Builder, ObjectB
return this.pattern(fn.apply(new PatternAnalyzer.Builder()).build());
}

public ObjectBuilder<Analyzer> phone(PhoneAnalyzer v) {
this._kind = Kind.Phone;
this._value = v;
return this;
}

public ObjectBuilder<Analyzer> phone(Function<PhoneAnalyzer.Builder, ObjectBuilder<PhoneAnalyzer>> fn) {
return this.phone(fn.apply(new PhoneAnalyzer.Builder()).build());
}

public ObjectBuilder<Analyzer> simple(SimpleAnalyzer v) {
this._kind = Kind.Simple;
this._value = v;
Expand Down Expand Up @@ -561,6 +588,7 @@ protected static void setupAnalyzerDeserializer(ObjectDeserializer<Builder> op)
op.add(Builder::language, LanguageAnalyzer._DESERIALIZER, "language");
op.add(Builder::nori, NoriAnalyzer._DESERIALIZER, "nori");
op.add(Builder::pattern, PatternAnalyzer._DESERIALIZER, "pattern");
op.add(Builder::phone, PhoneAnalyzer._DESERIALIZER, "phone");
op.add(Builder::simple, SimpleAnalyzer._DESERIALIZER, "simple");
op.add(Builder::smartcn, SmartcnAnalyzer._DESERIALIZER, "smartcn");
op.add(Builder::snowball, SnowballAnalyzer._DESERIALIZER, "snowball");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ public static PatternAnalyzer.Builder pattern() {
return new PatternAnalyzer.Builder();
}

/**
* Creates a builder for the {@link PhoneAnalyzer phone} {@code Analyzer} variant.
*/
public static PhoneAnalyzer.Builder phone() {
return new PhoneAnalyzer.Builder();
}

/**
* Creates a builder for the {@link SimpleAnalyzer simple} {@code Analyzer} variant.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* 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.analysis;

import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
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: _types.analysis.PhoneAnalyzer

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class PhoneAnalyzer implements AnalyzerVariant, PlainJsonSerializable {

@Nullable
private final String phoneRegion;

// ---------------------------------------------------------------------------------------------

private PhoneAnalyzer(Builder builder) {
this.phoneRegion = builder.phoneRegion;
}

public static PhoneAnalyzer of(Function<PhoneAnalyzer.Builder, ObjectBuilder<PhoneAnalyzer>> fn) {
return fn.apply(new Builder()).build();
}

/**
* {@link Analyzer} variant kind.
*/
@Override
public Analyzer.Kind _analyzerKind() {
return Analyzer.Kind.Phone;
}

/**
* Optional ISO 3166 country code, defaults to &quot;ZZ&quot; (unknown region).
* <p>
* API name: {@code phone-region}
* </p>
*/
@Nullable
public final String phoneRegion() {
return this.phoneRegion;
}

/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write("type", "phone");
if (this.phoneRegion != null) {
generator.writeKey("phone-region");
generator.write(this.phoneRegion);
}
}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link PhoneAnalyzer}.
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<PhoneAnalyzer> {
@Nullable
private String phoneRegion;

/**
* Optional ISO 3166 country code, defaults to &quot;ZZ&quot; (unknown region).
* <p>
* API name: {@code phone-region}
* </p>
*/
public final Builder phoneRegion(@Nullable String value) {
this.phoneRegion = value;
return this;
}

/**
* Builds a {@link PhoneAnalyzer}.
*
* @throws NullPointerException if some of the required fields are null.
*/
public PhoneAnalyzer build() {
_checkSingleUse();

return new PhoneAnalyzer(this);
}
}

// ---------------------------------------------------------------------------------------------

/**
* Json deserializer for {@link PhoneAnalyzer}
*/
public static final JsonpDeserializer<PhoneAnalyzer> _DESERIALIZER = ObjectBuilderDeserializer.lazy(
Builder::new,
PhoneAnalyzer::setupPhoneAnalyzerDeserializer
);

protected static void setupPhoneAnalyzerDeserializer(ObjectDeserializer<PhoneAnalyzer.Builder> op) {
op.add(Builder::phoneRegion, JsonpDeserializer.stringDeserializer(), "phone-region");

op.ignore("type");
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + Objects.hashCode(this.phoneRegion);
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
PhoneAnalyzer other = (PhoneAnalyzer) o;
return Objects.equals(this.phoneRegion, other.phoneRegion);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// typedef: dangling_indices.list_dangling_indices.Request

/**
* Returns all dangling indices.
* Returns all dangling indexes.
*/
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ListDanglingIndicesRequest extends RequestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public final CompletableFuture<ImportDanglingIndexResponse> importDanglingIndex(
// ----- Endpoint: dangling_indices.list_dangling_indices

/**
* Returns all dangling indices.
* Returns all dangling indexes.
*/
public CompletableFuture<ListDanglingIndicesResponse> listDanglingIndices() throws IOException, OpenSearchException {
return this.transport.performRequestAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public final ImportDanglingIndexResponse importDanglingIndex(
// ----- Endpoint: dangling_indices.list_dangling_indices

/**
* Returns all dangling indices.
* Returns all dangling indexes.
*/
public ListDanglingIndicesResponse listDanglingIndices() throws IOException, OpenSearchException {
return this.transport.performRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public final String indexRouting() {
}

/**
* If <code>true</code>, the alias is hidden. All indices for the alias must have the same <code>is_hidden</code> value.
* If <code>true</code>, the alias is hidden. All indexes for the alias must have the same <code>is_hidden</code> value.
* <p>
* API name: {@code is_hidden}
* </p>
Expand Down Expand Up @@ -229,7 +229,7 @@ public final Builder indexRouting(@Nullable String value) {
}

/**
* If <code>true</code>, the alias is hidden. All indices for the alias must have the same <code>is_hidden</code> value.
* If <code>true</code>, the alias is hidden. All indexes for the alias must have the same <code>is_hidden</code> value.
* <p>
* API name: {@code is_hidden}
* </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static DeleteIndexRequest of(Function<DeleteIndexRequest.Builder, ObjectB

/**
* If <code>false</code>, the request returns an error if any wildcard expression, index alias, or <code>_all</code> value targets only
* missing or closed indices. This behavior applies even if the request targets other open indices.
* missing or closed indexes. This behavior applies even if the request targets other open indexes.
* <p>
* API name: {@code allow_no_indices}
* </p>
Expand Down Expand Up @@ -149,7 +149,7 @@ public final Boolean ignoreUnavailable() {
}

/**
* Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support
* Required - Comma-separated list of indexes to delete. You cannot specify index aliases. By default, this parameter does not support
* wildcards (<code>*</code>) or <code>_all</code>. To use wildcards or <code>_all</code>, set the
* <code>action.destructive_requires_name</code> cluster setting to <code>false</code>.
* <p>
Expand Down Expand Up @@ -207,7 +207,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<D

/**
* If <code>false</code>, the request returns an error if any wildcard expression, index alias, or <code>_all</code> value targets
* only missing or closed indices. This behavior applies even if the request targets other open indices.
* only missing or closed indexes. This behavior applies even if the request targets other open indexes.
* <p>
* API name: {@code allow_no_indices}
* </p>
Expand Down Expand Up @@ -284,7 +284,7 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) {
}

/**
* Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not
* Required - Comma-separated list of indexes to delete. You cannot specify index aliases. By default, this parameter does not
* support wildcards (<code>*</code>) or <code>_all</code>. To use wildcards or <code>_all</code>, set the
* <code>action.destructive_requires_name</code> cluster setting to <code>false</code>.
* <p>
Expand All @@ -301,7 +301,7 @@ public final Builder index(List<String> list) {
}

/**
* Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not
* Required - Comma-separated list of indexes to delete. You cannot specify index aliases. By default, this parameter does not
* support wildcards (<code>*</code>) or <code>_all</code>. To use wildcards or <code>_all</code>, set the
* <code>action.destructive_requires_name</code> cluster setting to <code>false</code>.
* <p>
Expand Down
Loading
Loading