@@ -42,6 +42,12 @@ public interface IAction
42
42
[ IgnoreDataMember ]
43
43
string Foreach { get ; set ; }
44
44
45
+ [ IgnoreDataMember ]
46
+ /// <summary>The maximum number of iterations that each watch executes. If this limit is reached,
47
+ /// the execution is gracefully stopped. Defaults to <c>100</c>.
48
+ /// </summary>
49
+ int ? MaxIterations { get ; set ; }
50
+
45
51
/// <summary>
46
52
/// Transforms the payload before executing the action. The transformation is only applied
47
53
/// for the payload for this action.
@@ -75,6 +81,9 @@ internal ActionBase() { }
75
81
/// <inheritdoc />
76
82
public string Foreach { get ; set ; }
77
83
84
+ /// <inheritdoc />
85
+ public int ? MaxIterations { get ; set ; }
86
+
78
87
/// <inheritdoc />
79
88
public TransformContainer Transform { get ; set ; }
80
89
@@ -125,7 +134,8 @@ internal class ActionsFormatter : IJsonFormatter<Actions>
125
134
{ "pagerduty" , 6 } ,
126
135
{ "foreach" , 7 } ,
127
136
{ "transform" , 8 } ,
128
- { "condition" , 9 }
137
+ { "condition" , 9 } ,
138
+ { "max_iterations" , 10 } ,
129
139
} ;
130
140
131
141
public Actions Deserialize ( ref JsonReader reader , IJsonFormatterResolver formatterResolver )
@@ -140,6 +150,7 @@ public Actions Deserialize(ref JsonReader reader, IJsonFormatterResolver formatt
140
150
Time throttlePeriod = null ;
141
151
IAction action = null ;
142
152
string @foreach = null ;
153
+ int ? maxIterations = null ;
143
154
TransformContainer transform = null ;
144
155
ConditionContainer condition = null ;
145
156
@@ -190,6 +201,9 @@ public Actions Deserialize(ref JsonReader reader, IJsonFormatterResolver formatt
190
201
condition = formatterResolver . GetFormatter < ConditionContainer > ( )
191
202
. Deserialize ( ref reader , formatterResolver ) ;
192
203
break ;
204
+ case 10 :
205
+ maxIterations = reader . ReadInt32 ( ) ;
206
+ break ;
193
207
}
194
208
}
195
209
else
@@ -201,6 +215,7 @@ public Actions Deserialize(ref JsonReader reader, IJsonFormatterResolver formatt
201
215
action . Name = name ;
202
216
action . ThrottlePeriod = throttlePeriod ;
203
217
action . Foreach = @foreach ;
218
+ action . MaxIterations = maxIterations ;
204
219
action . Transform = transform ;
205
220
action . Condition = condition ;
206
221
dictionary . Add ( name , action ) ;
@@ -238,6 +253,12 @@ public void Serialize(ref JsonWriter writer, Actions value, IJsonFormatterResolv
238
253
writer . WriteString ( action . Foreach ) ;
239
254
writer . WriteValueSeparator ( ) ;
240
255
}
256
+ if ( action . MaxIterations . HasValue )
257
+ {
258
+ writer . WritePropertyName ( "max_iterations" ) ;
259
+ writer . WriteInt32 ( action . MaxIterations . Value ) ;
260
+ writer . WriteValueSeparator ( ) ;
261
+ }
241
262
242
263
if ( action . Transform != null )
243
264
{
0 commit comments