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

Regenerate tasks namespace #1187

Merged
merged 11 commits into from
Sep 9, 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
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased 3.0]
### Dependencies
- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0
- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.4
- Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7
- Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0
Expand All @@ -21,6 +20,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
- Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769))
- Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124))
- Changed type of `ShardStatistics`'s `total`, `successful`, `failed` & `skipped` fields from `Number` to `int/Integer` ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158))
- Unified `tasks.Info` and `tasks.State` classes into `tasks.TaskInfo` ([#1187](https://github.com/opensearch-project/opensearch-java/pull/1187))

### Deprecated
- Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536))
Expand All @@ -29,7 +29,7 @@ This section is for maintaining a changelog for all breaking changes for the cli

### Fixed
- Fix version and build ([#254](https://github.com/opensearch-project/opensearch-java/pull/254))
- Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181))
- Fixed deserializing `tasks.ListResponse` when using `GroupBy.None` ([#1187](https://github.com/opensearch-project/opensearch-java/pull/1187))

### Security

Expand All @@ -38,6 +38,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Added

### Dependencies
- Bumps `org.junit:junit-bom` from 5.10.3 to 5.11.0

### Changed

Expand All @@ -46,6 +47,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Removed

### Fixed
- Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181))

### Security

Expand Down
17 changes: 16 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,19 @@ After:

### ShardStatistics properties types
- The type of the `total`, `successful` and `failed` fields has been corrected from `Number` to `int`.
- The type of the `skipped` field has been corrected from `Number` to `Integer`.
- The type of the `skipped` field has been corrected from `Number` to `Integer`.

### Unified tasks.Info & tasks.State classes into tasks.TaskInfo
- The `tasks.Info` and `tasks.State` classes have been unified into `tasks.TaskInfo`, this affects:
- `TaskExecutingNode`'s `tasks` field.
- `GetTasksResponse`'s `task` field.
- `core.update_by_query_rethrottle.UpdateByQueryRethrottleNode`'s `tasks` field.
- The `headers` field is now a `Map<String, String>` instead of a `Map<String, List<String>>`.

### tasks.ListResponse properties lifted to tasks.TaskListResponseBase
- All fields previously defined on `tasks.ListResponse` have been lifted to `tasks.TaskListResponseBase`.
- `DeleteByQueryRethrottleResponse` now extends `tasks.TaskListResponseBase` instead of `tasks.ListResponse`.
- The `tasks` field is now a `TaskInfos` union type instead of a `Map<String, Info>` to correctly handle `groupBy` parents or none.

### GetTasksResponse response type
- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

Expand All @@ -68,6 +69,10 @@ public OpenSearchMlAsyncClient ml() {
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchTasksAsyncClient tasks() {
return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlClient;
import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

Expand All @@ -67,6 +68,10 @@ public OpenSearchMlClient ml() {
return new OpenSearchMlClient(this.transport, this.transportOptions);
}

public OpenSearchTasksClient tasks() {
return new OpenSearchTasksClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public final BuilderT acknowledged(boolean value) {

protected abstract BuilderT self();
}

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

protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupAcknowledgedResponseBaseDeserializer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@
* 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.List;
import java.util.Map;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -43,32 +48,35 @@
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilderBase;

// typedef: _spec_utils.BaseNode
// typedef: _types.BaseNode

@Generated("org.opensearch.client.codegen.CodeGenerator")
public abstract class BaseNode implements PlainJsonSerializable {

private final Map<String, String> attributes;

@Nullable
private final String host;

@Nullable
private final String ip;

private final String name;

private final List<NodeRole> roles;

@Nullable
private final String transportAddress;

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

protected BaseNode(AbstractBuilder<?> builder) {

this.attributes = ApiTypeHelper.unmodifiable(builder.attributes);
this.host = builder.host;
this.ip = builder.ip;
this.name = builder.name;
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.roles = ApiTypeHelper.unmodifiable(builder.roles);
this.transportAddress = builder.transportAddress;

}

/**
Expand All @@ -81,19 +89,21 @@ public final Map<String, String> attributes() {
/**
* API name: {@code host}
*/
@Nullable
public final String host() {
return this.host;
}

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

/**
* API name: {@code name}
* Required - API name: {@code name}
*/
public final String name() {
return this.name;
Expand All @@ -109,37 +119,41 @@ public final List<NodeRole> roles() {
/**
* API name: {@code transport_address}
*/
@Nullable
public final String transportAddress() {
return this.transportAddress;
}

/**
* 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) {

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

}
generator.writeEnd();
}

if (this.host != null) {
generator.writeKey("host");
generator.write(this.host);
}
generator.writeKey("host");
generator.write(this.host);

generator.writeKey("ip");
generator.write(this.ip);
if (this.ip != null) {
generator.writeKey("ip");
generator.write(this.ip);
}

generator.writeKey("name");
generator.write(this.name);
Expand All @@ -151,36 +165,35 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
item0.serialize(generator, mapper);
}
generator.writeEnd();

}
generator.writeKey("transport_address");
generator.write(this.transportAddress);

if (this.transportAddress != null) {
generator.writeKey("transport_address");
generator.write(this.transportAddress);
}
}

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

protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>> extends ObjectBuilderBase {
@Nullable
private Map<String, String> attributes;

@Nullable
private String host;

@Nullable
private String ip;

@Nullable
private String name;

@Nullable
private List<NodeRole> roles;

@Nullable
private String transportAddress;

/**
* API name: {@code attributes}
*
* <p>
* Adds all entries of <code>map</code> to <code>attributes</code>.
* Adds all elements of <code>map</code> to <code>attributes</code>.
* </p>
*/
public final BuilderT attributes(Map<String, String> map) {
this.attributes = _mapPutAll(this.attributes, map);
Expand All @@ -189,8 +202,10 @@ public final BuilderT attributes(Map<String, String> map) {

/**
* API name: {@code attributes}
*
* <p>
* Adds an entry to <code>attributes</code>.
* </p>
*/
public final BuilderT attributes(String key, String value) {
this.attributes = _mapPut(this.attributes, key, value);
Expand All @@ -200,21 +215,21 @@ public final BuilderT attributes(String key, String value) {
/**
* API name: {@code host}
*/
public final BuilderT host(String value) {
public final BuilderT host(@Nullable String value) {
this.host = value;
return self();
}

/**
* API name: {@code ip}
*/
public final BuilderT ip(String value) {
public final BuilderT ip(@Nullable String value) {
this.ip = value;
return self();
}

/**
* API name: {@code name}
* Required - API name: {@code name}
*/
public final BuilderT name(String value) {
this.name = value;
Expand All @@ -223,8 +238,10 @@ public final BuilderT name(String value) {

/**
* API name: {@code roles}
*
* <p>
* Adds all elements of <code>list</code> to <code>roles</code>.
* </p>
*/
public final BuilderT roles(List<NodeRole> list) {
this.roles = _listAddAll(this.roles, list);
Expand All @@ -233,8 +250,10 @@ public final BuilderT roles(List<NodeRole> list) {

/**
* API name: {@code roles}
*
* <p>
* Adds one or more values to <code>roles</code>.
* </p>
*/
public final BuilderT roles(NodeRole value, NodeRole... values) {
this.roles = _listAdd(this.roles, value, values);
Expand All @@ -244,25 +263,22 @@ public final BuilderT roles(NodeRole value, NodeRole... values) {
/**
* API name: {@code transport_address}
*/
public final BuilderT transportAddress(String value) {
public final BuilderT transportAddress(@Nullable String value) {
this.transportAddress = value;
return self();
}

protected abstract BuilderT self();

}

// ---------------------------------------------------------------------------------------------
protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupBaseNodeDeserializer(ObjectDeserializer<BuilderT> op) {

protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupBaseNodeDeserializer(ObjectDeserializer<BuilderT> op) {
op.add(AbstractBuilder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes");
op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host");
op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip");
op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles");
op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address");

}

}
Loading
Loading