From d82f4b6cfb67a879482d45f25e0ce4c7f31abcfb Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Thu, 31 Mar 2022 18:08:49 -0700 Subject: [PATCH] Updating workflows and removing exists_type Signed-off-by: Vacha Shah --- .github/workflows/build.yml | 2 +- .../workflows/test-integration-unreleased.yml | 4 +- .github/workflows/test-integration.yml | 21 +- java-client/build.gradle.kts | 2 +- .../opensearch/indices/ExistsTypeRequest.java | 364 ------------------ .../indices/ExistsTypeResponse.java | 56 --- .../indices/OpenSearchIndicesAsyncClient.java | 34 -- .../indices/OpenSearchIndicesClient.java | 32 -- 8 files changed, 11 insertions(+), 504 deletions(-) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeResponse.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77c592fcae..c4facbcb50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: with: java-version: ${{ matrix.java }} - - name: Checkout Branch + - name: Checkout Branch uses: actions/checkout@v2 - name: Build with Gradle diff --git a/.github/workflows/test-integration-unreleased.yml b/.github/workflows/test-integration-unreleased.yml index 6fa4d67007..7ed99612ce 100644 --- a/.github/workflows/test-integration-unreleased.yml +++ b/.github/workflows/test-integration-unreleased.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - java: [11, 14] + java: [ 11 ] steps: - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v1 @@ -31,7 +31,7 @@ jobs: ref: ${{ env.OPENSEARCH_VERSION }} path: opensearch - - name: Assemble OpenSearch and Publish to Maven Local + - name: Assemble OpenSearch run: | cd opensearch ./gradlew assemble diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index aa841cc556..8cdb326664 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -15,36 +15,29 @@ jobs: fail-fast: false matrix: entry: - - { opensearch_version: 1.0.0, java: 11 } - - { opensearch_version: 1.0.1, java: 11 } - - { opensearch_version: 1.1.0, java: 11 } - - { opensearch_version: 1.2.0, java: 11 } - - { opensearch_version: 1.2.1, java: 11 } - - { opensearch_version: 1.2.2, java: 11 } - - { opensearch_version: 1.2.3, java: 11 } - - { opensearch_version: 1.2.4, java: 11 } - - { opensearch_version: 1.3.0, java: 11 } + - { opensearch_version: "", java: 11 } steps: - - name: Set up JDK ${{ matrix.entry.java }} + - name: Set up JDK ${{ matrix.java }} + if: ${{ matrix.entry.opensearch_version != ''}} uses: actions/setup-java@v1 with: java-version: ${{ matrix.entry.java }} - name: Checkout Branch - if: ${{ matrix.opensearch_version != ''}} + if: ${{ matrix.entry.opensearch_version != ''}} uses: actions/checkout@v2 - name: Run Docker - if: ${{ matrix.opensearch_version != ''}} + if: ${{ matrix.entry.opensearch_version != ''}} run: | docker-compose --project-directory .ci/opensearch build --build-arg OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }} docker-compose --project-directory .ci/opensearch up -d sleep 60 - name: Run Integration Test - if: ${{ matrix.opensearch_version != ''}} + if: ${{ matrix.entry.opensearch_version != ''}} run: ./gradlew clean integrationTest - name: Stop Docker - if: ${{ matrix.opensearch_version != ''}} + if: ${{ matrix.entry.opensearch_version != ''}} run: | docker-compose --project-directory .ci/opensearch down \ No newline at end of file diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 89dabc3454..ab43ecfbf1 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -123,7 +123,7 @@ val integrationTest = task("integrationTest") { dependencies { - val opensearchVersion = "2.0.0-alpha1-SNAPSHOT" + val opensearchVersion = "2.0.0-SNAPSHOT" val jacksonVersion = "2.12.6" val jacksonDatabindVersion = "2.12.6.1" diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeRequest.java deleted file mode 100644 index 98456836e7..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeRequest.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * 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 org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.ExpandWildcard; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.BooleanEndpoint; -import org.opensearch.client.transport.endpoints.BooleanResponse; -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.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -// typedef: indices.exists_type.Request - -/** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - */ - -public class ExistsTypeRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean local; - - private final List type; - - // --------------------------------------------------------------------------------------------- - - private ExistsTypeRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.local = builder.local; - this.type = ApiTypeHelper.unmodifiableRequired(builder.type, this, "type"); - - } - - public static ExistsTypeRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - A comma-separated list of index names; use _all to - * check the types across all indices - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * Return local information, do not retrieve the state from master node - * (default: false) - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * Required - A comma-separated list of document types to check - *

- * API name: {@code type} - */ - public final List type() { - return this.type; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExistsTypeRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Nullable - private Boolean local; - - private List type; - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - A comma-separated list of index names; use _all to - * check the types across all indices - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - A comma-separated list of index names; use _all to - * check the types across all indices - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * Return local information, do not retrieve the state from master node - * (default: false) - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; - } - - /** - * Required - A comma-separated list of document types to check - *

- * API name: {@code type} - *

- * Adds all elements of list to type. - */ - public final Builder type(List list) { - this.type = _listAddAll(this.type, list); - return this; - } - - /** - * Required - A comma-separated list of document types to check - *

- * API name: {@code type} - *

- * Adds one or more values to type. - */ - public final Builder type(String value, String... values) { - this.type = _listAdd(this.type, value, values); - return this; - } - - /** - * Builds a {@link ExistsTypeRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExistsTypeRequest build() { - _checkSingleUse(); - - return new ExistsTypeRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.exists_type}". - */ - public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "opensearch/indices.exists_type", - - // Request method - request -> { - return "HEAD"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - final int _type = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _type; - - if (propsSet == (_index | _type)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mapping"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.type.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream() - .map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, null); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeResponse.java deleted file mode 100644 index feced36a13..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTypeResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 org.opensearch.client.json.JsonpDeserializer; - -// typedef: indices.exists_type.Response - - -public class ExistsTypeResponse { - public ExistsTypeResponse() { - } - - /** - * Singleton instance for {@link ExistsTypeResponse}. - */ - public static final ExistsTypeResponse _INSTANCE = new ExistsTypeResponse(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .fixedValue(ExistsTypeResponse._INSTANCE); - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java index accdf88a70..87ebde9b49 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java @@ -577,40 +577,6 @@ public final CompletableFuture existsTemplate( return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); } - // ----- Endpoint: indices.exists_type - - /** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - * - */ - - public CompletableFuture existsType(ExistsTypeRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsTypeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsTypeRequest} - * - */ - - public final CompletableFuture existsType( - Function> fn) - throws IOException, OpenSearchException { - return existsType(fn.apply(new ExistsTypeRequest.Builder()).build()); - } - // ----- Endpoint: indices.flush /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java index dd50931537..bd1ee0db85 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java @@ -543,38 +543,6 @@ public final BooleanResponse existsTemplate( return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); } - // ----- Endpoint: indices.exists_type - - /** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - * - */ - - public BooleanResponse existsType(ExistsTypeRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsTypeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a particular document type exists. - * (DEPRECATED) - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsTypeRequest} - * - */ - - public final BooleanResponse existsType(Function> fn) - throws IOException, OpenSearchException { - return existsType(fn.apply(new ExistsTypeRequest.Builder()).build()); - } - // ----- Endpoint: indices.flush /**