Skip to content

Commit

Permalink
Generate cluster.health types
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Jun 7, 2024
1 parent 4d54e70 commit 4a9898e
Show file tree
Hide file tree
Showing 12 changed files with 49,994 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.ExpandWildcard

@JsonpDeserializable
public enum ExpandWildcard implements JsonEnum {
All("all"),
Open("open"),
Closed("closed"),
Hidden("hidden"),
None("none");

private final String jsonValue;

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

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

public static final JsonEnum.Deserializer<ExpandWildcard> _DESERIALIZER = new JsonEnum.Deserializer<>(ExpandWildcard.values());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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 org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.HealthStatus

@JsonpDeserializable
public enum HealthStatus implements JsonEnum {
Green("green"),
Yellow("yellow"),
Red("red");

private final String jsonValue;

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

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

public static final JsonEnum.Deserializer<HealthStatus> _DESERIALIZER = new JsonEnum.Deserializer<>(HealthStatus.values());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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 org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.WaitForActiveShardOptions

@JsonpDeserializable
public enum WaitForActiveShardOptions implements JsonEnum {
All("all"),
IndexSetting("index-setting");

private final String jsonValue;

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

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

public static final JsonEnum.Deserializer<WaitForActiveShardOptions> _DESERIALIZER = new JsonEnum.Deserializer<>(
WaitForActiveShardOptions.values()
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.JsonpSerializable;
import org.opensearch.client.json.UnionDeserializer;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.TaggedUnion;
import org.opensearch.client.util.TaggedUnionUtils;

// typedef: _types.WaitForActiveShards

@JsonpDeserializable
public class WaitForActiveShards implements TaggedUnion<WaitForActiveShards.Kind, Object>, JsonpSerializable {
public enum Kind {
Count,
Option
}

private final Kind _kind;
private final Object _value;

@Override
public final Kind _kind() {
return _kind;
}

@Override
public final Object _get() {
return _value;
}

private WaitForActiveShards(Kind kind, Object value) {
this._kind = kind;
this._value = value;
}

private WaitForActiveShards(Builder builder) {
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");
this._value = ApiTypeHelper.requireNonNull(builder._value, builder, "<variant value>");
}

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

public String _toJsonString() {
switch (_kind) {
case Count:
return String.valueOf(this.count());
case Option:
return this.option().jsonValue();
default:
throw new IllegalStateException("Unknown kind " + _kind);
}
}

/**
* Is this variant instance of kind {@code count}?
*/
public boolean isCount() {
return _kind == Kind.Count;
}

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

/**
* Is this variant instance of kind {@code option}?
*/
public boolean isOption() {
return _kind == Kind.Option;
}

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

@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
if (_value instanceof JsonpSerializable) {
((JsonpSerializable) _value).serialize(generator, mapper);
} else {
switch (_kind) {
case Count:
generator.write(((Integer) this._value));

break;
}
}
}

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<WaitForActiveShards> {
private Kind _kind;
private Object _value;

public ObjectBuilder<WaitForActiveShards> count(Integer v) {
this._kind = Kind.Count;
this._value = v;
return this;
}

public ObjectBuilder<WaitForActiveShards> option(WaitForActiveShardOptions v) {
this._kind = Kind.Option;
this._value = v;
return this;
}

@Override
public WaitForActiveShards build() {
_checkSingleUse();
return new WaitForActiveShards(this);
}
}

private static JsonpDeserializer<WaitForActiveShards> buildWaitForActiveShardsDeserializer() {
return new UnionDeserializer.Builder<WaitForActiveShards, Kind, Object>(WaitForActiveShards::new, false).addMember(
Kind.Count,
JsonpDeserializer.integerDeserializer()
).addMember(Kind.Option, WaitForActiveShardOptions._DESERIALIZER).build();
}

public static final JsonpDeserializer<WaitForActiveShards> _DESERIALIZER = JsonpDeserializer.lazy(
WaitForActiveShards::buildWaitForActiveShardsDeserializer
);
}
Loading

0 comments on commit 4a9898e

Please sign in to comment.