/* 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. */ /* * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. * * 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. */ using System; using System.Collections.Generic; using System.Runtime.Serialization; using OpenSearch.Client.Specification.IndicesApi; namespace OpenSearch.Client.Specification.SnapshotApi { /// /// Restores a snapshot /// [MapsApi("snapshot.restore.json")] public partial interface IRestoreRequest { /// /// The index settings to ignore as part of the restore operation /// [DataMember(Name ="ignore_index_settings")] List IgnoreIndexSettings { get; set; } /// /// Whether indices specified that do not exist /// should be ignored. /// [DataMember(Name ="ignore_unavailable")] bool? IgnoreUnavailable { get; set; } /// /// Whether to include aliases as part of the restore /// [DataMember(Name ="include_aliases")] bool? IncludeAliases { get; set; } /// /// Whether the cluster global state should be included /// [DataMember(Name ="include_global_state")] bool? IncludeGlobalState { get; set; } /// /// The index settings that should be applied as part of /// the restore operation. Some settings cannot be changed /// as part of a restore operation, for example, the number /// of shards. /// [DataMember(Name ="index_settings")] IUpdateIndexSettingsRequest IndexSettings { get; set; } /// /// The indices to restore /// [DataMember(Name ="indices")] Indices Indices { get; set; } /// /// Allow partial restore for indices that don't have snapshots of all shards available. /// /// By default, the entire restore operation will fail if one or more indices participating /// in the operation don’t have snapshots of all shards available. It can occur if some /// shards failed to snapshot for example. It is still possible to restore such indices /// by setting to true. Only successfully snapshotted shards /// will be restored in this case and all missing shards will be recreated empty. /// [DataMember(Name ="partial")] bool? Partial { get; set; } /// /// A pattern to use to rename restored indices. The pattern /// can be used to capture parts of the original index name /// and used within /// [DataMember(Name ="rename_pattern")] string RenamePattern { get; set; } /// /// A replacement to use to rename restored indices. Used /// in conjunction with . /// [DataMember(Name ="rename_replacement")] string RenameReplacement { get; set; } } /// public partial class RestoreRequest { /// public List IgnoreIndexSettings { get; set; } /// public bool? IgnoreUnavailable { get; set; } /// public bool? IncludeAliases { get; set; } /// public bool? IncludeGlobalState { get; set; } /// public IUpdateIndexSettingsRequest IndexSettings { get; set; } /// public Indices Indices { get; set; } /// public bool? Partial { get; set; } /// public string RenamePattern { get; set; } /// public string RenameReplacement { get; set; } } /// public partial class RestoreDescriptor { List IRestoreRequest.IgnoreIndexSettings { get; set; } bool? IRestoreRequest.IgnoreUnavailable { get; set; } bool? IRestoreRequest.IncludeAliases { get; set; } bool? IRestoreRequest.IncludeGlobalState { get; set; } IUpdateIndexSettingsRequest IRestoreRequest.IndexSettings { get; set; } Indices IRestoreRequest.Indices { get; set; } bool? IRestoreRequest.Partial { get; set; } string IRestoreRequest.RenamePattern { get; set; } string IRestoreRequest.RenameReplacement { get; set; } /// public RestoreDescriptor Index(IndexName index) => Indices(index); /// public RestoreDescriptor Index() where T : class => Indices(typeof(T)); /// public RestoreDescriptor Indices(Indices indices) => Assign(indices, (a, v) => a.Indices = v); /// public RestoreDescriptor IgnoreUnavailable(bool? ignoreUnavailable = true) => Assign(ignoreUnavailable, (a, v) => a.IgnoreUnavailable = v); /// public RestoreDescriptor IncludeGlobalState(bool? includeGlobalState = true) => Assign(includeGlobalState, (a, v) => a.IncludeGlobalState = v); /// public RestoreDescriptor RenamePattern(string renamePattern) => Assign(renamePattern, (a, v) => a.RenamePattern = v); /// public RestoreDescriptor RenameReplacement(string renameReplacement) => Assign(renameReplacement, (a, v) => a.RenameReplacement = v); /// public RestoreDescriptor IndexSettings(Func settingsSelector) => Assign(settingsSelector, (a, v) => a.IndexSettings = v?.Invoke(new UpdateIndexSettingsDescriptor())); /// public RestoreDescriptor IgnoreIndexSettings(List ignoreIndexSettings) => Assign(ignoreIndexSettings, (a, v) => a.IgnoreIndexSettings = v); /// public RestoreDescriptor IgnoreIndexSettings(params string[] ignoreIndexSettings) => Assign(ignoreIndexSettings.ToListOrNullIfEmpty(), (a, v) => a.IgnoreIndexSettings = v); /// public RestoreDescriptor IncludeAliases(bool? includeAliases = true) => Assign(includeAliases, (a, v) => a.IncludeAliases = v); /// public RestoreDescriptor Partial(bool? partial = true) => Assign(partial, (a, v) => a.Partial = v); } }