diff --git a/src/Nest/XPack/Ilm/Actions/WaitForSnapshotLifecycleAction.cs b/src/Nest/XPack/Ilm/Actions/WaitForSnapshotLifecycleAction.cs
new file mode 100644
index 00000000000..3fbcc1515b7
--- /dev/null
+++ b/src/Nest/XPack/Ilm/Actions/WaitForSnapshotLifecycleAction.cs
@@ -0,0 +1,35 @@
+using System.Runtime.Serialization;
+
+namespace Nest
+{
+ ///
+ /// The Wait For Snapshot Action waits for defined SLM policy to be executed to ensure that snapshot of index exists before deletion.
+ ///
+ /// Available in Elasticsearch 7.6.0+
+ ///
+ public interface IWaitForSnapshotLifecycleAction : ILifecycleAction
+ {
+ ///
+ /// The Snapshot Lifecycle Management (SLM) policy name that this action should wait for
+ ///
+ [DataMember(Name = "policy")]
+ string Policy { get; set; }
+ }
+
+ ///
+ public class WaitForSnapshotLifecycleAction : IWaitForSnapshotLifecycleAction
+ {
+ ///
+ public string Policy { get; set; }
+ }
+
+ ///
+ public class WaitForSnapshotLifecycleActionDescriptor
+ : DescriptorBase, IWaitForSnapshotLifecycleAction
+ {
+ string IWaitForSnapshotLifecycleAction.Policy { get; set; }
+
+ ///
+ public WaitForSnapshotLifecycleActionDescriptor Policy(string policy) => Assign(policy, (a, v) => a.Policy = policy);
+ }
+}
diff --git a/src/Nest/XPack/Ilm/LifecycleActions.cs b/src/Nest/XPack/Ilm/LifecycleActions.cs
index add2529075b..c9c708eea96 100644
--- a/src/Nest/XPack/Ilm/LifecycleActions.cs
+++ b/src/Nest/XPack/Ilm/LifecycleActions.cs
@@ -15,23 +15,35 @@ public LifecycleActions() { }
public LifecycleActions(IDictionary container) : base(container) { }
+ ///
public void Add(IAllocateLifecycleAction action) => BackingDictionary.Add("allocate", action);
+ ///
public void Add(IDeleteLifecycleAction action) => BackingDictionary.Add("delete", action);
+ ///
public void Add(IForceMergeLifecycleAction action) => BackingDictionary.Add("forcemerge", action);
+ ///
public void Add(IFreezeLifecycleAction action) => BackingDictionary.Add("freeze", action);
+ ///
public void Add(IReadOnlyLifecycleAction action) => BackingDictionary.Add("readonly", action);
+ ///
public void Add(IRolloverLifecycleAction action) => BackingDictionary.Add("rollover", action);
+ ///
public void Add(ISetPriorityLifecycleAction action) => BackingDictionary.Add("set_priority", action);
+ ///
public void Add(IShrinkLifecycleAction action) => BackingDictionary.Add("shrink", action);
+ ///
public void Add(IUnfollowLifecycleAction action) => BackingDictionary.Add("unfollow", action);
+
+ ///
+ public void Add(IWaitForSnapshotLifecycleAction action) => BackingDictionary.Add("wait_for_snapshot", action);
}
internal class LifecycleActionsJsonFormatter : IJsonFormatter
@@ -47,6 +59,7 @@ internal class LifecycleActionsJsonFormatter : IJsonFormatter
{ "set_priority", 6 },
{ "shrink", 7 },
{ "unfollow", 8 },
+ { "wait_for_snapshot", 9 },
};
public ILifecycleActions Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
@@ -104,6 +117,10 @@ public ILifecycleActions Deserialize(ref JsonReader reader, IJsonFormatterResolv
lifecycleAction = formatterResolver.GetFormatter()
.Deserialize(ref reader, formatterResolver);
break;
+ case 9:
+ lifecycleAction = formatterResolver.GetFormatter()
+ .Deserialize(ref reader, formatterResolver);
+ break;
}
lifecycles.Add(type.Utf8String(), lifecycleAction);
@@ -161,6 +178,9 @@ public void Serialize(ref JsonWriter writer, ILifecycleActions value, IJsonForma
case "unfollow":
Serialize(ref writer, action.Value, formatterResolver);
break;
+ case "wait_for_snapshot":
+ Serialize(ref writer, action.Value, formatterResolver);
+ break;
default:
DynamicObjectResolver.ExcludeNullCamelCase.GetFormatter()
.Serialize(ref writer, action.Value, formatterResolver);
@@ -181,31 +201,44 @@ public class LifecycleActionsDescriptor : IsADictionaryDescriptorBase
public LifecycleActionsDescriptor Allocate(Func selector) =>
Assign("allocate", selector.InvokeOrDefault(new AllocateLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor Delete(Func selector) =>
Assign("delete", selector.InvokeOrDefault(new DeleteLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor ForceMerge(Func selector) =>
Assign("forcemerge", selector.InvokeOrDefault(new ForceMergeLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor Freeze(Func selector) =>
Assign("freeze", selector.InvokeOrDefault(new FreezeLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor ReadOnly(Func selector) =>
Assign("readonly", selector.InvokeOrDefault(new ReadOnlyLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor Rollover(Func selector) =>
Assign("rollover", selector.InvokeOrDefault(new RolloverLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor SetPriority(Func selector) =>
Assign("set_priority", selector.InvokeOrDefault(new SetPriorityLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor Shrink(Func selector) =>
Assign("shrink", selector.InvokeOrDefault(new ShrinkLifecycleActionDescriptor()));
+ ///
public LifecycleActionsDescriptor Unfollow(Func selector) =>
Assign("unfollow", selector.InvokeOrDefault(new UnfollowLifecycleActionDescriptor()));
+
+ ///
+ public LifecycleActionsDescriptor WaitForSnapshot(Func selector) =>
+ Assign("wait_for_snapshot", selector.InvokeOrDefault(new WaitForSnapshotLifecycleActionDescriptor()));
}
}