forked from opensearch-project/opensearch-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate DataStream operations (opensearch-project#1351)
* Generate DataStream operations Signed-off-by: Thomas Farr <[email protected]> * Fix tests Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]>
- Loading branch information
Showing
33 changed files
with
4,204 additions
and
1,862 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ java-client/bin | |
samples/bin | ||
|
||
.DS_Store | ||
|
||
.kotlin/ |
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
191 changes: 191 additions & 0 deletions
191
.../src/generated/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,191 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
//---------------------------------------------------- | ||
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. | ||
//---------------------------------------------------- | ||
|
||
package org.opensearch.client.opensearch.indices; | ||
|
||
import java.util.function.Function; | ||
import javax.annotation.Generated; | ||
import javax.annotation.Nonnull; | ||
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.CopyableBuilder; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
import org.opensearch.client.util.ObjectBuilderBase; | ||
import org.opensearch.client.util.ToCopyableBuilder; | ||
|
||
// typedef: indices.create_data_stream.Request | ||
|
||
/** | ||
* Creates or updates a data stream. | ||
*/ | ||
@Generated("org.opensearch.client.codegen.CodeGenerator") | ||
public class CreateDataStreamRequest extends RequestBase | ||
implements | ||
ToCopyableBuilder<CreateDataStreamRequest.Builder, CreateDataStreamRequest> { | ||
|
||
@Nonnull | ||
private final String name; | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
private CreateDataStreamRequest(Builder builder) { | ||
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); | ||
} | ||
|
||
public static CreateDataStreamRequest of(Function<CreateDataStreamRequest.Builder, ObjectBuilder<CreateDataStreamRequest>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* Required - Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include <code>\</code>, | ||
* <code>/</code>, <code>*</code>, <code>?</code>, <code>"</code>, <code><</code>, <code>></code>, <code>|</code>, | ||
* <code>,</code>, <code>#</code>, <code>:</code>, or a space character; Cannot start with <code>-</code>, <code>_</code>, | ||
* <code>+</code>, or <code>.ds-</code>; Cannot be <code>.</code> or <code>..</code>; Cannot be longer than 255 bytes. Multi-byte | ||
* characters count towards this limit faster. | ||
* <p> | ||
* API name: {@code name} | ||
* </p> | ||
*/ | ||
@Nonnull | ||
public final String name() { | ||
return this.name; | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
@Override | ||
@Nonnull | ||
public Builder toBuilder() { | ||
return new Builder(this); | ||
} | ||
|
||
@Nonnull | ||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
/** | ||
* Builder for {@link CreateDataStreamRequest}. | ||
*/ | ||
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, CreateDataStreamRequest> { | ||
private String name; | ||
|
||
public Builder() {} | ||
|
||
private Builder(CreateDataStreamRequest o) { | ||
this.name = o.name; | ||
} | ||
|
||
private Builder(Builder o) { | ||
this.name = o.name; | ||
} | ||
|
||
@Override | ||
@Nonnull | ||
public Builder copy() { | ||
return new Builder(this); | ||
} | ||
|
||
/** | ||
* Required - Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include <code>\</code>, | ||
* <code>/</code>, <code>*</code>, <code>?</code>, <code>"</code>, <code><</code>, <code>></code>, <code>|</code>, | ||
* <code>,</code>, <code>#</code>, <code>:</code>, or a space character; Cannot start with <code>-</code>, <code>_</code>, | ||
* <code>+</code>, or <code>.ds-</code>; Cannot be <code>.</code> or <code>..</code>; Cannot be longer than 255 bytes. Multi-byte | ||
* characters count towards this limit faster. | ||
* <p> | ||
* API name: {@code name} | ||
* </p> | ||
*/ | ||
@Nonnull | ||
public final Builder name(String value) { | ||
this.name = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds a {@link CreateDataStreamRequest}. | ||
* | ||
* @throws NullPointerException if some of the required fields are null. | ||
*/ | ||
@Override | ||
@Nonnull | ||
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 -> "PUT", | ||
// Request path | ||
request -> { | ||
StringBuilder buf = new StringBuilder(); | ||
buf.append("/_data_stream/"); | ||
SimpleEndpoint.pathEncode(request.name, buf); | ||
return buf.toString(); | ||
}, | ||
// Request parameters | ||
SimpleEndpoint.emptyMap(), | ||
SimpleEndpoint.emptyMap(), | ||
false, | ||
CreateDataStreamResponse._DESERIALIZER | ||
); | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = 17; | ||
result = 31 * result + this.name.hashCode(); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || this.getClass() != o.getClass()) return false; | ||
CreateDataStreamRequest other = (CreateDataStreamRequest) o; | ||
return this.name.equals(other.name); | ||
} | ||
} |
Oops, something went wrong.