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

Deprecating master terminology to support inclusive naming #167

Merged
merged 2 commits into from
Jun 27, 2022
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 @@ -41,8 +41,11 @@

@JsonpDeserializable
public enum NodeRole implements JsonEnum {
@Deprecated
Master("master"),

ClusterManager("cluster_manager"),

Data("data"),

DataCold("data_cold"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@
import java.util.HashMap;
import java.util.Map;

// typedef: cat.master.Request
// typedef: cat.cluster_manager.Request

/**
* Returns information about the master node.
* Returns information about the cluster-manager node.
*
*/

public class MasterRequest extends CatRequestBase {
public MasterRequest() {
public class ClusterManagerRequest extends CatRequestBase {
public ClusterManagerRequest() {
}

/**
* Singleton instance for {@link MasterRequest}.
* Singleton instance for {@link ClusterManagerRequest}.
*/
public static final MasterRequest _INSTANCE = new MasterRequest();
public static final ClusterManagerRequest _INSTANCE = new ClusterManagerRequest();

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

/**
* Endpoint "{@code cat.master}".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have changed the API request in this PR
master -> cluster_manager

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean for the comment cat.master? cat.master is for the deprecated endpoint, cat.cluster_manager is for the endpoint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we are supporting the deprecated and the new endpoint to not break things out there. Makes sense. You can ignore my comment.

*/
public static final Endpoint<MasterRequest, MasterResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
@Deprecated
public static final Endpoint<ClusterManagerRequest, ClusterManagerResponse, ErrorResponse> _DEPRECATED_ENDPOINT = new SimpleEndpoint<>(

// Request method
request -> {
Expand All @@ -84,5 +84,30 @@ public MasterRequest() {
params.put("format", "json");
return params;

}, SimpleEndpoint.emptyMap(), false, MasterResponse._DESERIALIZER);
}, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER);

/**
* Endpoint "{@code cat.cluster_manager}".
*/
public static final Endpoint<ClusterManagerRequest, ClusterManagerResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(

// Request method
request -> {
return "GET";

},

// Request path
request -> {
return "/_cat/cluster_manager";

},

// Request parameters
request -> {
Map<String, String> params = new HashMap<>();
params.put("format", "json");
return params;

}, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

package org.opensearch.client.opensearch.cat;

import org.opensearch.client.opensearch.cat.master.MasterRecord;
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.opensearch.cat.cluster_manager.ClusterManagerRecord;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
Expand All @@ -49,21 +49,21 @@
import java.util.List;
import java.util.function.Function;

// typedef: cat.master.Response
// typedef: cat.cluster_manager.Response

@JsonpDeserializable
public class MasterResponse implements JsonpSerializable {
private final List<MasterRecord> valueBody;
public class ClusterManagerResponse implements JsonpSerializable {
private final List<ClusterManagerRecord> valueBody;

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

private MasterResponse(Builder builder) {
private ClusterManagerResponse(Builder builder) {

this.valueBody = ApiTypeHelper.unmodifiableRequired(builder.valueBody, this, "valueBody");

}

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

Expand All @@ -72,7 +72,7 @@ public static MasterResponse of(Function<Builder, ObjectBuilder<MasterResponse>>
* <p>
* API name: {@code _value_body}
*/
public final List<MasterRecord> valueBody() {
public final List<ClusterManagerRecord> valueBody() {
return this.valueBody;
}

Expand All @@ -81,7 +81,7 @@ public final List<MasterRecord> valueBody() {
*/
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartArray();
for (MasterRecord item0 : this.valueBody) {
for (ClusterManagerRecord item0 : this.valueBody) {
item0.serialize(generator, mapper);

}
Expand All @@ -92,11 +92,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link MasterResponse}.
* Builder for {@link ClusterManagerResponse}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<MasterResponse> {
private List<MasterRecord> valueBody;
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ClusterManagerResponse> {
private List<ClusterManagerRecord> valueBody;

/**
* Required - Response value.
Expand All @@ -105,7 +105,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<M
* <p>
* Adds all elements of <code>list</code> to <code>valueBody</code>.
*/
public final Builder valueBody(List<MasterRecord> list) {
public final Builder valueBody(List<ClusterManagerRecord> list) {
this.valueBody = _listAddAll(this.valueBody, list);
return this;
}
Expand All @@ -117,7 +117,7 @@ public final Builder valueBody(List<MasterRecord> list) {
* <p>
* Adds one or more values to <code>valueBody</code>.
*/
public final Builder valueBody(MasterRecord value, MasterRecord... values) {
public final Builder valueBody(ClusterManagerRecord value, ClusterManagerRecord... values) {
this.valueBody = _listAdd(this.valueBody, value, values);
return this;
}
Expand All @@ -129,28 +129,28 @@ public final Builder valueBody(MasterRecord value, MasterRecord... values) {
* <p>
* Adds a value to <code>valueBody</code> using a builder lambda.
*/
public final Builder valueBody(Function<MasterRecord.Builder, ObjectBuilder<MasterRecord>> fn) {
return valueBody(fn.apply(new MasterRecord.Builder()).build());
public final Builder valueBody(Function<ClusterManagerRecord.Builder, ObjectBuilder<ClusterManagerRecord>> fn) {
return valueBody(fn.apply(new ClusterManagerRecord.Builder()).build());
}

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

return new MasterResponse(this);
return new ClusterManagerResponse(this);
}
}

public static final JsonpDeserializer<MasterResponse> _DESERIALIZER = createMasterResponseDeserializer();
protected static JsonpDeserializer<MasterResponse> createMasterResponseDeserializer() {
public static final JsonpDeserializer<ClusterManagerResponse> _DESERIALIZER = createClusterManagerResponseDeserializer();
protected static JsonpDeserializer<ClusterManagerResponse> createClusterManagerResponseDeserializer() {

JsonpDeserializer<List<MasterRecord>> valueDeserializer = JsonpDeserializer
.arrayDeserializer(MasterRecord._DESERIALIZER);
JsonpDeserializer<List<ClusterManagerRecord>> valueDeserializer = JsonpDeserializer
.arrayDeserializer(ClusterManagerRecord._DESERIALIZER);

return JsonpDeserializer.of(valueDeserializer.acceptedEvents(),
(parser, mapper) -> new Builder().valueBody(valueDeserializer.deserialize(parser, mapper)).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,21 @@ public CompletableFuture<IndicesResponse> indices() throws IOException, OpenSear
*
*
*/
public CompletableFuture<MasterResponse> master() throws IOException, OpenSearchException {
return this.transport.performRequestAsync(MasterRequest._INSTANCE, MasterRequest._ENDPOINT,
@Deprecated
public CompletableFuture<ClusterManagerResponse> master() throws IOException, OpenSearchException {
return this.transport.performRequestAsync(ClusterManagerRequest._INSTANCE, ClusterManagerRequest._DEPRECATED_ENDPOINT,
this.transportOptions);
}

// ----- Endpoint: cat.cluster_manager

/**
* Returns information about the cluster-manager node.
*
*
*/
public CompletableFuture<ClusterManagerResponse> clusterManager() throws IOException, OpenSearchException {
return this.transport.performRequestAsync(ClusterManagerRequest._INSTANCE, ClusterManagerRequest._ENDPOINT,
this.transportOptions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,20 @@ public IndicesResponse indices() throws IOException, OpenSearchException {
*
*
*/
public MasterResponse master() throws IOException, OpenSearchException {
return this.transport.performRequest(MasterRequest._INSTANCE, MasterRequest._ENDPOINT, this.transportOptions);
@Deprecated
public ClusterManagerResponse master() throws IOException, OpenSearchException {
return this.transport.performRequest(ClusterManagerRequest._INSTANCE, ClusterManagerRequest._DEPRECATED_ENDPOINT, this.transportOptions);
}

// ----- Endpoint: cat.cluster_manager

/**
* Returns information about the cluster-manager node.
*
*
*/
public ClusterManagerResponse clusterManager() throws IOException, OpenSearchException {
return this.transport.performRequest(ClusterManagerRequest._INSTANCE, ClusterManagerRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: cat.nodeattrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch.cat.master;
package org.opensearch.client.opensearch.cat.cluster_manager;

import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -48,11 +48,11 @@
import java.util.function.Function;
import javax.annotation.Nullable;

// typedef: cat.master.MasterRecord
// typedef: cat.cluster_manager.ClusterManagerRecord


@JsonpDeserializable
public class MasterRecord implements JsonpSerializable {
public class ClusterManagerRecord implements JsonpSerializable {
@Nullable
private final String id;

Expand All @@ -67,7 +67,7 @@ public class MasterRecord implements JsonpSerializable {

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

private MasterRecord(Builder builder) {
private ClusterManagerRecord(Builder builder) {

this.id = builder.id;
this.host = builder.host;
Expand All @@ -76,7 +76,7 @@ private MasterRecord(Builder builder) {

}

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

Expand Down Expand Up @@ -157,10 +157,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link MasterRecord}.
* Builder for {@link ClusterManagerRecord}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<MasterRecord> {
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ClusterManagerRecord> {
@Nullable
private String id;

Expand Down Expand Up @@ -214,27 +214,27 @@ public final Builder node(@Nullable String value) {
}

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

return new MasterRecord(this);
return new ClusterManagerRecord(this);
}
}

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

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

protected static void setupMasterRecordDeserializer(ObjectDeserializer<MasterRecord.Builder> op) {
protected static void setupClusterManagerRecordDeserializer(ObjectDeserializer<ClusterManagerRecord.Builder> op) {

op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id");
op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host", "h");
Expand Down
Loading