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

Generate DataStream operations #1351

Merged
merged 2 commits into from
Dec 11, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ java-client/bin
samples/bin

.DS_Store

.kotlin/
11 changes: 10 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,13 @@ After:

### PutTemplateRequest
- The `flatSettings` property has been removed as it is not supported by OpenSearch.
- The `timeout` property has been removed as it is not supported by OpenSearch.
- The `timeout` property has been removed as it is not supported by OpenSearch.

### DataStreamInfo renamed to DataStream
- The `DataStreamInfo` class has been renamed to `DataStream`, this affects:
- `GetDataStreamResponse`'s `dataStreams` field.
- The `generation` property is now of type `long` instead of `int`.

### DataStreamIndexInfo renamed to DataStreamIndex
- The `DataStreamIndexInfo` class has been renamed to `DataStreamIndex`, this affects:
- `DataStream`'s (previously `DataStreamInfo`) `indices` field.
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,37 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import javax.annotation.Generated;
import org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.HealthStatus

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum HealthStatus implements JsonEnum {
/**
* All shards are assigned.
*/
Green("green", "GREEN"),

/**
* All primary shards are assigned, but one or more replica shards are
* unassigned. If a node in the cluster fails, some data could be unavailable
* until that node is repaired.
* One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary
* shards are assigned.
*/
Yellow("yellow", "YELLOW"),
Red("red", "RED"),

/**
* One or more primary shards are unassigned, so some data is unavailable. This
* can occur briefly during cluster startup as primary shards are assigned.
* All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be
* unavailable until that node is repaired.
*/
Red("red", "RED"),

;
Yellow("yellow", "YELLOW");

private final String jsonValue;
private final String[] aliases;
Expand Down
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>&quot;</code>, <code>&lt;</code>, <code>&gt;</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>&quot;</code>, <code>&lt;</code>, <code>&gt;</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);
}
}
Loading
Loading