Skip to content
Open
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 @@ -108,6 +108,12 @@ public enum NodeRole implements JsonEnum {
*/
RemoteClusterClient("remote_cluster_client"),

/**
* The node can host search replicas (search-only shards). This role must not be combined with any other role on a node. Introduced in
* 3.0; not to be confused with the pre-3.0 <code>search</code> role that was renamed to <code>warm</code>.
*/
Search("search"),

/**
* The node can perform transform operations.
*/
Expand All @@ -116,7 +122,12 @@ public enum NodeRole implements JsonEnum {
/**
* The node can only vote in cluster decisions.
*/
VotingOnly("voting_only");
VotingOnly("voting_only"),

/**
* The node can hold warm indexes for searchable snapshots. Before 3.0 this role was named <code>search</code>.
*/
Warm("warm");

private final String jsonValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

/**
* Specifies the time units, for example, <code>5d</code> or <code>7h</code>. For more information, see
* <a href="https://opensearch.org/docs/latest/api-reference/units/">Supported units</a>.
* <a href="https://docs.opensearch.org/latest/api-reference/units/">Supported units</a>.
*/
@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,47 @@

package org.opensearch.client.opensearch._types.aggregations;

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;
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.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: _types.aggregations.AdjacencyMatrixAggregate

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class AdjacencyMatrixAggregate extends MultiBucketAggregateBase<AdjacencyMatrixBucket>
public class AdjacencyMatrixAggregate
implements
AggregateVariant,
PlainJsonSerializable,
ToCopyableBuilder<AdjacencyMatrixAggregate.Builder, AdjacencyMatrixAggregate> {

@Nonnull
private final Buckets<AdjacencyMatrixBucket> buckets;

@Nonnull
private final Map<String, JsonData> meta;

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

private AdjacencyMatrixAggregate(Builder builder) {
super(builder);
this.buckets = ApiTypeHelper.requireNonNull(builder.buckets, this, "buckets");
this.meta = ApiTypeHelper.unmodifiable(builder.meta);
}

public static AdjacencyMatrixAggregate of(Function<AdjacencyMatrixAggregate.Builder, ObjectBuilder<AdjacencyMatrixAggregate>> fn) {
Expand All @@ -74,6 +91,47 @@ public Aggregate.Kind _aggregateKind() {
return Aggregate.Kind.AdjacencyMatrix;
}

/**
* Required - API name: {@code buckets}
*/
@Nonnull
public final Buckets<AdjacencyMatrixBucket> buckets() {
return this.buckets;
}

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

/**
* 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.writeKey("buckets");
this.buckets.serialize(generator, mapper);

if (ApiTypeHelper.isDefined(this.meta)) {
generator.writeKey("meta");
generator.writeStartObject();
for (Map.Entry<String, JsonData> item0 : this.meta.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
}

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

@Override
Expand All @@ -90,18 +148,21 @@ public static Builder builder() {
/**
* Builder for {@link AdjacencyMatrixAggregate}.
*/
public static class Builder extends MultiBucketAggregateBase.AbstractBuilder<AdjacencyMatrixBucket, Builder>
implements
CopyableBuilder<Builder, AdjacencyMatrixAggregate> {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, AdjacencyMatrixAggregate> {
private Buckets<AdjacencyMatrixBucket> buckets;
@Nullable
private Map<String, JsonData> meta;

public Builder() {}

private Builder(AdjacencyMatrixAggregate o) {
super(o);
this.buckets = o.buckets;
this.meta = _mapCopy(o.meta);
}

private Builder(Builder o) {
super(o);
this.buckets = o.buckets;
this.meta = _mapCopy(o.meta);
}

@Override
Expand All @@ -110,9 +171,46 @@ public Builder copy() {
return new Builder(this);
}

@Override
/**
* Required - API name: {@code buckets}
*/
@Nonnull
protected Builder self() {
public final Builder buckets(Buckets<AdjacencyMatrixBucket> value) {
this.buckets = value;
return this;
}

/**
* Required - API name: {@code buckets}
*/
@Nonnull
public final Builder buckets(Function<Buckets.Builder<AdjacencyMatrixBucket>, ObjectBuilder<Buckets<AdjacencyMatrixBucket>>> fn) {
return buckets(fn.apply(new Buckets.Builder<AdjacencyMatrixBucket>()).build());
}

/**
* API name: {@code meta}
*
* <p>
* Adds all elements of <code>map</code> to <code>meta</code>.
* </p>
*/
@Nonnull
public final Builder meta(Map<String, JsonData> map) {
this.meta = _mapPutAll(this.meta, map);
return this;
}

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

Expand Down Expand Up @@ -141,22 +239,23 @@ public AdjacencyMatrixAggregate build() {
);

protected static void setupAdjacencyMatrixAggregateDeserializer(ObjectDeserializer<AdjacencyMatrixAggregate.Builder> op) {
setupMultiBucketAggregateBaseDeserializer(op, AdjacencyMatrixBucket._DESERIALIZER);
op.add(Builder::buckets, Buckets.createBucketsDeserializer(AdjacencyMatrixBucket._DESERIALIZER), "buckets");
op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "meta");
}

@Override
public int hashCode() {
int result = super.hashCode();
int result = 17;
result = 31 * result + this.buckets.hashCode();
result = 31 * result + Objects.hashCode(this.meta);
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;
AdjacencyMatrixAggregate other = (AdjacencyMatrixAggregate) o;
return this.buckets.equals(other.buckets) && Objects.equals(this.meta, other.meta);
}
}
Loading
Loading