From 0982d860b866f3ddcf68efd819a67d6aee54a2e2 Mon Sep 17 00:00:00 2001 From: Nicholas Walter Knize Date: Tue, 3 May 2022 14:59:24 -0500 Subject: [PATCH] reset deleted files Signed-off-by: Nicholas Walter Knize --- .../admin/indices/shrink/ShrinkAction.java | 46 +++++++++++++ .../upgrade/post/ShardUpgradeRequest.java | 65 +++++++++++++++++++ .../post/UpgradeSettingsRequestBuilder.java | 62 ++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 server/src/main/java/org/opensearch/action/admin/indices/shrink/ShrinkAction.java create mode 100644 server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/ShardUpgradeRequest.java create mode 100644 server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java diff --git a/server/src/main/java/org/opensearch/action/admin/indices/shrink/ShrinkAction.java b/server/src/main/java/org/opensearch/action/admin/indices/shrink/ShrinkAction.java new file mode 100644 index 0000000000000..1fa894b265573 --- /dev/null +++ b/server/src/main/java/org/opensearch/action/admin/indices/shrink/ShrinkAction.java @@ -0,0 +1,46 @@ +/* + * 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 under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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. + */ + +package org.opensearch.action.admin.indices.shrink; + +import org.opensearch.action.ActionType; + +public class ShrinkAction extends ActionType { + + public static final ShrinkAction INSTANCE = new ShrinkAction(); + public static final String NAME = "indices:admin/shrink"; + + private ShrinkAction() { + super(NAME, ResizeResponse::new); + } + +} diff --git a/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/ShardUpgradeRequest.java b/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/ShardUpgradeRequest.java new file mode 100644 index 0000000000000..fcc85e1a9cb5c --- /dev/null +++ b/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/ShardUpgradeRequest.java @@ -0,0 +1,65 @@ +/* + * 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 under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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. + */ + +package org.opensearch.action.admin.indices.upgrade.post; + +import org.opensearch.action.support.broadcast.BroadcastShardRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.index.shard.ShardId; + +import java.io.IOException; + +public final class ShardUpgradeRequest extends BroadcastShardRequest { + + private UpgradeRequest request; + + public ShardUpgradeRequest(StreamInput in) throws IOException { + super(in); + request = new UpgradeRequest(in); + } + + ShardUpgradeRequest(ShardId shardId, UpgradeRequest request) { + super(shardId, request); + this.request = request; + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + super.writeTo(out); + request.writeTo(out); + } + + public UpgradeRequest upgradeRequest() { + return this.request; + } +} diff --git a/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java b/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java new file mode 100644 index 0000000000000..d3a8cc311bb8a --- /dev/null +++ b/server/src/main/java/org/opensearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java @@ -0,0 +1,62 @@ +/* + * 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 under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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. + */ + +package org.opensearch.action.admin.indices.upgrade.post; + +import org.opensearch.Version; +import org.opensearch.action.support.master.AcknowledgedRequestBuilder; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.client.OpenSearchClient; +import org.opensearch.common.collect.Tuple; + +import java.util.Map; + +/** + * Builder for an update index settings request + */ +public class UpgradeSettingsRequestBuilder extends AcknowledgedRequestBuilder< + UpgradeSettingsRequest, + AcknowledgedResponse, + UpgradeSettingsRequestBuilder> { + + public UpgradeSettingsRequestBuilder(OpenSearchClient client, UpgradeSettingsAction action) { + super(client, action, new UpgradeSettingsRequest()); + } + + /** + * Sets the index versions to be updated + */ + public UpgradeSettingsRequestBuilder setVersions(Map> versions) { + request.versions(versions); + return this; + } +}