Skip to content

Commit

Permalink
Modify existing client classes to be abstract base classes
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 26, 2024
1 parent c2d9004 commit bb5523f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,13 @@
/**
* Client for the namespace.
*/
public class OpenSearchAsyncClient extends ApiClient<OpenSearchTransport, OpenSearchAsyncClient> {
public abstract class OpenSearchAsyncClientBase<Self extends OpenSearchAsyncClientBase<Self>>
extends ApiClient<OpenSearchTransport, Self> {

public OpenSearchAsyncClient(OpenSearchTransport transport) {
super(transport, null);
}

public OpenSearchAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
public OpenSearchAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}

@Override
public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new OpenSearchAsyncClient(this.transport, transportOptions);
}

// ----- Child clients

public OpenSearchCatAsyncClient cat() {
Expand Down Expand Up @@ -897,17 +889,6 @@ public final <TDocument> CompletableFuture<IndexResponse> index(
return index(fn.apply(new IndexRequest.Builder<TDocument>()).build());
}

// ----- Endpoint: info

/**
* Returns basic information about the cluster.
*
*
*/
public CompletableFuture<InfoResponse> info() throws IOException, OpenSearchException {
return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: list_point_in_time

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,13 @@
/**
* Client for the namespace.
*/
public class OpenSearchClient extends ApiClient<OpenSearchTransport, OpenSearchClient> {
public abstract class OpenSearchClientBase<Self extends OpenSearchClientBase<Self>>
extends ApiClient<OpenSearchTransport, Self> {

public OpenSearchClient(OpenSearchTransport transport) {
super(transport, null);
}

public OpenSearchClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
public OpenSearchClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}

@Override
public OpenSearchClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new OpenSearchClient(this.transport, transportOptions);
}

// ----- Child clients
public OpenSearchGenericClient generic() {
return new OpenSearchGenericClient(this.transport, this.transportOptions);
Expand Down Expand Up @@ -883,17 +875,6 @@ public final <TDocument> IndexResponse index(Function<IndexRequest.Builder<TDocu
return index(fn.apply(new IndexRequest.Builder<TDocument>()).build());
}

// ----- Endpoint: info

/**
* Returns basic information about the cluster.
*
*
*/
public InfoResponse info() throws IOException, OpenSearchException {
return this.transport.performRequest(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: list_point_in_time

/**
Expand Down

0 comments on commit bb5523f

Please sign in to comment.