-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CreateDataStream, GetDataStream, DeleteDataStream, DataStreamsStats, and support specified data stream timestamp field in PutIndexTemplate. Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com> * Add change log for data stream changes Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com> * Add data stream into user guide Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com> * add data stream to TOC of user guide Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com> --------- Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com> (cherry picked from commit 876d379) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
402c6b9
commit ce2d7ac
Showing
19 changed files
with
2,265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...lient/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch.indices; | ||
|
||
import org.opensearch.client.opensearch._types.ErrorResponse; | ||
import org.opensearch.client.opensearch._types.RequestBase; | ||
import org.opensearch.client.transport.Endpoint; | ||
import org.opensearch.client.transport.endpoints.SimpleEndpoint; | ||
import org.opensearch.client.util.ApiTypeHelper; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
import org.opensearch.client.util.ObjectBuilderBase; | ||
|
||
import java.util.function.Function; | ||
|
||
// typedef: indices.create_data_stream.Request | ||
|
||
/** | ||
* Creates a data stream | ||
*/ | ||
public class CreateDataStreamRequest extends RequestBase { | ||
|
||
private final String name; | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
private CreateDataStreamRequest(Builder builder) { | ||
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); | ||
} | ||
|
||
public static CreateDataStreamRequest of(Function<Builder, ObjectBuilder<CreateDataStreamRequest>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* Required - The name of the data stream | ||
* <p> | ||
* API name: {@code name} | ||
*/ | ||
public final String name() { | ||
return this.name; | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link CreateDataStreamRequest}. | ||
*/ | ||
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CreateDataStreamRequest> { | ||
|
||
private String name; | ||
|
||
/** | ||
* Required - The name of the data stream | ||
* <p> | ||
* API name: {@code name} | ||
*/ | ||
public final Builder name(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public CreateDataStreamRequest build() { | ||
_checkSingleUse(); | ||
|
||
return new CreateDataStreamRequest(this); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Endpoint "{@code indices.create_data_stream}". | ||
*/ | ||
public static final Endpoint<CreateDataStreamRequest, CreateDataStreamResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>( | ||
// Request method | ||
request -> { | ||
return "PUT"; | ||
}, | ||
|
||
// Request path | ||
request -> { | ||
final int _name = 1 << 0; | ||
int propsSet = 0; | ||
propsSet |= _name; | ||
|
||
if (propsSet == (_name)) { | ||
StringBuilder sbd = new StringBuilder(); | ||
sbd.append("/_data_stream"); | ||
sbd.append("/"); | ||
SimpleEndpoint.pathEncode(request.name, sbd); | ||
return sbd.toString(); | ||
} | ||
throw SimpleEndpoint.noPathTemplateFound("path"); | ||
}, | ||
|
||
// Request parameters | ||
SimpleEndpoint.emptyMap(), | ||
|
||
SimpleEndpoint.emptyMap(), false, CreateDataStreamResponse._DESERIALIZER); | ||
} |
73 changes: 73 additions & 0 deletions
73
...ient/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.opensearch.client.opensearch.indices; | ||
|
||
import org.opensearch.client.json.JsonpDeserializable; | ||
import org.opensearch.client.json.JsonpDeserializer; | ||
import org.opensearch.client.json.ObjectBuilderDeserializer; | ||
import org.opensearch.client.json.ObjectDeserializer; | ||
import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
|
||
import java.util.function.Function; | ||
|
||
// typedef: indices.create_data_stream.Response | ||
|
||
@JsonpDeserializable | ||
public class CreateDataStreamResponse extends AcknowledgedResponseBase { | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
private CreateDataStreamResponse(Builder builder) { | ||
super(builder); | ||
} | ||
|
||
public static CreateDataStreamResponse of(Function<Builder, ObjectBuilder<CreateDataStreamResponse>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link CreateDataStreamResponse} | ||
*/ | ||
public static class Builder extends AcknowledgedResponseBase.AbstractBuilder<Builder> | ||
implements ObjectBuilder<CreateDataStreamResponse> { | ||
|
||
@Override | ||
protected Builder self() { | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds a {@link CreateDataStreamResponse}. | ||
* | ||
* @throws NullPointerException | ||
* if any required field is null. | ||
*/ | ||
public CreateDataStreamResponse build() { | ||
_checkSingleUse(); | ||
|
||
return new CreateDataStreamResponse(this); | ||
} | ||
} | ||
|
||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Json deserializer for {@link CreateDataStreamResponse} | ||
*/ | ||
public static final JsonpDeserializer<CreateDataStreamResponse> _DESERIALIZER = ObjectBuilderDeserializer | ||
.lazy(Builder::new, CreateDataStreamResponse::setupCreateDataStreamResponseDeserializer); | ||
|
||
protected static void setupCreateDataStreamResponseDeserializer(ObjectDeserializer<CreateDataStreamResponse.Builder> op) { | ||
AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.