-
Notifications
You must be signed in to change notification settings - Fork 191
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
Support DataStream APIs #416
Merged
VachaShah
merged 4 commits into
opensearch-project:main
from
tanqiuliu:feature/data-stream
Mar 28, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c890d3a
Add CreateDataStream, GetDataStream, DeleteDataStream, DataStreamsSta…
tanqiuliu 0496495
Add change log for data stream changes
tanqiuliu 6cbb2a8
Add data stream into user guide
tanqiuliu cab07cb
add data stream to TOC of user guide
tanqiuliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry one more comment: can you add the new section to TOC as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added