44
55namespace Nest
66{
7+ /// <summary>
8+ /// A watch action that sends email notifications.
9+ /// To use the email action, you must configure at least one email account.
10+ /// </summary>
711 [ JsonObject ]
812 public interface IEmailAction : IAction
913 {
@@ -36,8 +40,16 @@ public interface IEmailAction : IAction
3640
3741 [ JsonProperty ( "attachments" ) ]
3842 IEmailAttachments Attachments { get ; set ; }
43+
44+ [ JsonProperty ( "attach_data" ) ]
45+ [ Obsolete ( "Deprecated in Watcher 2.3. Use Attachments to set Attachment data" ) ]
46+ Union < bool ? , AttachData > AttachData { get ; set ; }
3947 }
4048
49+ /// <summary>
50+ /// A watch action that sends email notifications.
51+ /// To use the email action, you must configure at least one email account.
52+ /// </summary>
4153 public class EmailAction : ActionBase , IEmailAction
4254 {
4355 public override ActionType ActionType => ActionType . Email ;
@@ -62,9 +74,28 @@ public EmailAction(string name) : base(name) {}
6274
6375 public EmailPriority ? Priority { get ; set ; }
6476
77+ /// <summary>
78+ /// Attaches an attachment to the email
79+ /// </summary>
80+ /// <remarks>
81+ /// Only available in Watcher 2.3 and up
82+ /// </remarks>
6583 public IEmailAttachments Attachments { get ; set ; }
84+
85+ /// <summary>
86+ /// Indicates whether the watch execution data should be attached to the email.
87+ /// If set to <c>true</c>, the data is attached as a YAML file called data.yml.
88+ /// If it’s set to <c>false</c>, no data is attached.
89+ /// To attach data and control the format of the attached data, assign <see cref="AttachData"/>
90+ /// </summary>
91+ [ Obsolete ( "Deprecated in Watcher 2.3. Use Attachments to set Attachment data" ) ]
92+ public Union < bool ? , AttachData > AttachData { get ; set ; }
6693 }
6794
95+ /// <summary>
96+ /// A watch action that sends email notifications.
97+ /// To use the email action, you must configure at least one email account.
98+ /// </summary>
6899 public class EmailActionDescriptor : ActionsDescriptorBase < EmailActionDescriptor , IEmailAction > , IEmailAction
69100 {
70101 public EmailActionDescriptor ( string name ) : base ( name ) { }
@@ -81,6 +112,7 @@ public EmailActionDescriptor(string name) : base(name) {}
81112 IEmailBody IEmailAction . Body { get ; set ; }
82113 EmailPriority ? IEmailAction . Priority { get ; set ; }
83114 IEmailAttachments IEmailAction . Attachments { get ; set ; }
115+ Union < bool ? , AttachData > IEmailAction . AttachData { get ; set ; }
84116
85117 public EmailActionDescriptor Account ( string account ) => Assign ( a => a . Account = account ) ;
86118
@@ -109,7 +141,27 @@ public EmailActionDescriptor Body(Func<EmailBodyDescriptor, IEmailBody> selector
109141
110142 public EmailActionDescriptor Priority ( EmailPriority priority ) => Assign ( a => a . Priority = priority ) ;
111143
144+ /// <summary>
145+ /// Attach an attachment to the email, only available since watcher 2.3 and up.
146+ /// </summary>
112147 public EmailActionDescriptor Attachments ( Func < EmailAttachmentsDescriptor , IPromise < IEmailAttachments > > selector ) =>
113148 Assign ( a => a . Attachments = selector ? . Invoke ( new EmailAttachmentsDescriptor ( ) ) ? . Value ) ;
149+
150+ /// <summary>
151+ /// Indicates whether the watch execution data should be attached to the email.
152+ /// If set to <c>true</c>, the data is attached as a YAML file called data.yml.
153+ /// If it’s set to <c>false</c>, no data is attached.
154+ /// To attach data and control the format of the attached data, use <see cref="AttachData(DataAttachmentFormat)"/>
155+ /// </summary>
156+ [ Obsolete ( "Deprecated in Watcher 2.3. Use Attachments to set Attachment data" ) ]
157+ public EmailActionDescriptor AttachData ( bool attach = true ) =>
158+ Assign ( a => a . AttachData = attach ) ;
159+
160+ /// <summary>
161+ /// Indicates to attach the watch execution data attached to the email and the format.
162+ /// </summary>
163+ [ Obsolete ( "Deprecated in Watcher 2.3. Use Attachments to set Attachment data" ) ]
164+ public EmailActionDescriptor AttachData ( DataAttachmentFormat format ) =>
165+ Assign ( a => a . AttachData = new AttachData { Format = format } ) ;
114166 }
115167}
0 commit comments