Skip to content

Commit

Permalink
Begin generating indices.get
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Oct 9, 2024
1 parent d045d86 commit fb5c3ea
Show file tree
Hide file tree
Showing 57 changed files with 3,588 additions and 1,439 deletions.
11 changes: 10 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ After:
- The `name` field, getter and builder method have been renamed to `repository`.

### CloneSnapshotRequest timeout removal
- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch.
- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch.

### indices.Alias
- The `indexRouting`, `routing` and `searchRouting` properties now accept a `List<String>` instead of a `String`.

### InlineScript
- The `lang` property now accepts a `ScriptLanguage` enum instead of a `String`.

### DynamicMapping
- Removed the `Runtime` variant from the `DynamicMapping` enum as it is not supported by OpenSearch.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
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.ml.OpenSearchMlAsyncClient;
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient;
Expand All @@ -66,6 +67,10 @@ public OpenSearchDanglingIndicesAsyncClient danglingIndices() {
return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchIndicesAsyncClient indices() {
return new OpenSearchIndicesAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchMlAsyncClient ml() {
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
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.ml.OpenSearchMlClient;
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient;
Expand All @@ -65,6 +66,10 @@ public OpenSearchDanglingIndicesClient danglingIndices() {
return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions);
}

public OpenSearchIndicesClient indices() {
return new OpenSearchIndicesClient(this.transport, this.transportOptions);
}

public OpenSearchMlClient ml() {
return new OpenSearchMlClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.BuiltinScriptLanguage

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum BuiltinScriptLanguage implements JsonEnum {
Expression("expression"),

Java("java"),

Mustache("mustache"),

Painless("painless");

private final String jsonValue;

BuiltinScriptLanguage(String jsonValue) {
this.jsonValue = jsonValue;
}

public String jsonValue() {
return this.jsonValue;
}

public static final JsonEnum.Deserializer<BuiltinScriptLanguage> _DESERIALIZER = new JsonEnum.Deserializer<>(
BuiltinScriptLanguage.values()
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,33 @@
* 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.ExpandWildcard

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum ExpandWildcard implements JsonEnum {
/**
* Match any data stream or index, including hidden ones.
* Match any index, including hidden ones.
*/
All("all"),

/**
* Match open, non-hidden indices. Also matches any non-hidden data stream.
*/
Open("open"),

/**
* Match closed, non-hidden indices. Also matches any non-hidden data stream.
* Data streams cannot be closed.
* Match closed, non-hidden indices.
*/
Closed("closed"),

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

Expand All @@ -64,7 +65,10 @@ public enum ExpandWildcard implements JsonEnum {
*/
None("none"),

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

private final String jsonValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -47,102 +54,112 @@
// typedef: _types.InlineScript

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class InlineScript extends ScriptBase {

@Nullable
private final String lang;
private final ScriptLanguage lang;

@Nonnull
private final Map<String, String> options;

@Nonnull
private final String source;

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

private InlineScript(Builder builder) {
super(builder);

this.lang = builder.lang;
this.options = ApiTypeHelper.unmodifiable(builder.options);
this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source");

}

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

/**
* API name: {@code lang}
*/
@Nullable
public final String lang() {
public final ScriptLanguage lang() {
return this.lang;
}

/**
* API name: {@code options}
*/
@Nonnull
public final Map<String, String> options() {
return this.options;
}

/**
* Required - API name: {@code source}
* Required - The script source.
* <p>
* API name: {@code source}
* </p>
*/
@Nonnull
public final String source() {
return this.source;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

super.serializeInternal(generator, mapper);
if (this.lang != null) {
generator.writeKey("lang");
generator.write(this.lang);

this.lang.serialize(generator, mapper);
}

if (ApiTypeHelper.isDefined(this.options)) {
generator.writeKey("options");
generator.writeStartObject();
for (Map.Entry<String, String> item0 : this.options.entrySet()) {
generator.writeKey(item0.getKey());
generator.write(item0.getValue());

}
generator.writeEnd();

}

generator.writeKey("source");
generator.write(this.source);

}

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

/**
* Builder for {@link InlineScript}.
*/

public static class Builder extends ScriptBase.AbstractBuilder<Builder> implements ObjectBuilder<InlineScript> {
@Nullable
private String lang;

private ScriptLanguage lang;
@Nullable
private Map<String, String> options;

private String source;

/**
* API name: {@code lang}
*/
public final Builder lang(@Nullable String value) {
public final Builder lang(@Nullable ScriptLanguage value) {
this.lang = value;
return this;
}

/**
* API name: {@code lang}
*/
public final Builder lang(Function<ScriptLanguage.Builder, ObjectBuilder<ScriptLanguage>> fn) {
return lang(fn.apply(new ScriptLanguage.Builder()).build());
}

/**
* API name: {@code options}
*
* <p>
* Adds all entries of <code>map</code> to <code>options</code>.
* Adds all elements of <code>map</code> to <code>options</code>.
* </p>
*/
public final Builder options(Map<String, String> map) {
this.options = _mapPutAll(this.options, map);
Expand All @@ -151,16 +168,21 @@ public final Builder options(Map<String, String> map) {

/**
* API name: {@code options}
*
* <p>
* Adds an entry to <code>options</code>.
* </p>
*/
public final Builder options(String key, String value) {
this.options = _mapPut(this.options, key, value);
return this;
}

/**
* Required - API name: {@code source}
* Required - The script source.
* <p>
* API name: {@code source}
* </p>
*/
public final Builder source(String value) {
this.source = value;
Expand All @@ -175,8 +197,7 @@ protected Builder self() {
/**
* Builds a {@link InlineScript}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public InlineScript build() {
_checkSingleUse();
Expand All @@ -196,13 +217,29 @@ public InlineScript build() {
);

protected static void setupInlineScriptDeserializer(ObjectDeserializer<InlineScript.Builder> op) {
ScriptBase.setupScriptBaseDeserializer(op);
op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang");
setupScriptBaseDeserializer(op);
op.add(Builder::lang, ScriptLanguage._DESERIALIZER, "lang");
op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "options");
op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source");

op.shortcutProperty("source");
}

public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(this.lang);
result = 31 * result + Objects.hashCode(this.options);
result = 31 * result + this.source.hashCode();
return result;
}

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;
InlineScript other = (InlineScript) o;
return Objects.equals(this.lang, other.lang) && Objects.equals(this.options, other.options) && this.source.equals(other.source);
}
}
Loading

0 comments on commit fb5c3ea

Please sign in to comment.