/
IEngine.cs
1437 lines (1338 loc) · 58.5 KB
/
IEngine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using Skyline.DataMiner.Net;
using Skyline.DataMiner.Net.Exceptions;
using Skyline.DataMiner.Net.Messages;
using Skyline.DataMiner.Net.Profiles;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Skyline.DataMiner.Automation
{
/// <summary>
/// Engine interface.
/// </summary>
public interface IEngine
{
/// <summary>
/// Acknowledges the specified alarm tree using the provided comment message.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="comment">A comment.</param>
/// <remarks>If a user launches the script manually or attaches to it interactively, that user will become the owner of the alarm. If the script runs in the background, the alarm owner will become “Administrator”.</remarks>
/// <example>
/// <code>
/// engine.AcknowledgeAlarm(7, 304022, "Alarm acknowledged.");
/// </code>
/// </example>
void AcknowledgeAlarm(int dataMinerID, int alarmID, string comment);
/// <summary>
/// Acknowledges the specified alarm tree using the provided comment message.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="comment">A comment.</param>
/// <remarks>If a user launches the script manually or attaches to it interactively, that user will become the owner of the alarm. If the script runs in the background, the alarm owner will become “Administrator”.</remarks>
/// <example>
/// <code>
/// engine.AcknowledgeAlarm(7, 400, 304022, "Alarm acknowledged.");
/// </code>
/// </example>
void AcknowledgeAlarm(int dataMinerID, int elementID, int alarmID, string comment);
/// <summary>
/// Adds an error message to the Automation script, which will eventually cause the script to fail.
/// </summary>
/// <param name="error">The error message.</param>
/// <example>
/// <code>
/// engine.AddError("A non-fatal error has occurred.");
/// </code>
/// </example>
void AddError(string error);
/// <summary>
/// Adds a key to the script output if it has not yet been added.
/// </summary>
/// <param name="key">The key to add or update.</param>
/// <param name="value">The value.</param>
/// <remarks>
/// <para>If the key already exists, it will update it with the specified value.</para>
/// <para>Feature introduced in DataMiner 10.0.2 (RN 23936).</para>
/// </remarks>
void AddOrUpdateScriptOutput(string key, string value);
/// <summary>
/// Adds a key and value to the dictionary that will be passed to the parent script.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <remarks>Feature introduced in DataMiner 9.6.8 (RN 21952).</remarks>
void AddScriptOutput(string key, string value);
/// <summary>
/// Clears the script output.
/// </summary>
/// <remarks>Feature introduced in DataMiner 10.0.2 (RN 23936).</remarks>
void ClearScriptResult();
/// <summary>
/// Removes the entry with the specified key from the script output.
/// </summary>
/// <param name="key">The key of the entry to clear.</param>
/// <remarks>Feature introduced in DataMiner 10.0.2 (RN 23936).</remarks>
void ClearScriptOutput(string key);
/// <summary>
/// Adds an additional dummy to the Automation script.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <returns>The created dummy.</returns>
/// <exception cref="DataMinerException">The specified element was not found.</exception>
/// <example>
/// <code>
/// ScriptDummy extradummy1 = engine.CreateExtraDummy(366,22);
/// </code>
/// </example>
ScriptDummy CreateExtraDummy(int dataMinerID, int elementID);
/// <summary>
/// Adds an additional dummy to the Automation script.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <param name="key">The key.</param>
/// <returns>The created dummy.</returns>
/// <exception cref="DataMinerException">The specified element was not found.</exception>
/// <example>
/// <code>
/// ScriptDummy extradummy1 = engine.CreateExtraDummy(366,22, "myDummy");
/// </code>
/// </example>
ScriptDummy CreateExtraDummy(int dataMinerID, int elementID, string key);
/// <summary>
/// Aborts the Automation script, and indicates that it has failed.
/// </summary>
/// <param name="reason">Message describing the reason.</param>
/// <example>
/// <code>
/// engine.ExitFail("A fatal error has occurred.");
/// </code>
/// </example>
/// <remarks>
/// <note type="caution">This method throws an <see cref="ScriptAbortException"/>. The script author is supposed to take this into account and make sure the script does not run endlessly, and that it does not swallow <see cref="ScriptAbortException"/> when calling <see cref="ExitFail(string)"/>.</note>
/// </remarks>
void ExitFail(string reason);
/// <summary>
/// Aborts the Automation script, but does not indicate that it has failed.
/// </summary>
/// <param name="reason">Message describing the reason.</param>
/// <example>
/// <code>
/// engine.ExitSuccess("The script has been stopped.");
/// </code>
/// </example>
/// <remarks>
/// <note type="caution">This method throws an <see cref="ScriptAbortException"/>. The script author is supposed to take this into account and make sure the script does not run endlessly, and that it does not swallow <see cref="ScriptAbortException"/> when calling <see cref="ExitSuccess(string)"/>.</note>
/// </remarks>
void ExitSuccess(string reason);
/// <summary>
/// Retrieves all elements matching the specified filter.
/// </summary>
/// <param name="filter">The element filter.</param>
/// <returns>The elements matching the specified filter.</returns>
/// <example>
/// <code>
/// ElementFilter myElementFilter = new ElementFilter { MajorOnly=true };
/// Element[] elements = engine.FindElements(myElementFilter);
/// </code>
/// </example>
Element[] FindElements(ElementFilter filter);
/// <summary>
/// Retrieves all elements executing the specified protocol in the specified view.
/// </summary>
/// <param name="viewID">The view ID.</param>
/// <param name="protocolName">The protocol name.</param>
/// <param name="protocolVersion">The protocol version.</param>
/// <returns>The elements running the specified protocol in the specified view.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsInView(14,"Microsoft Platform","1.1.0.48");
/// </code>
/// </example>
Element[] FindElementsInView(int viewID, string protocolName, string protocolVersion);
/// <summary>
/// Retrieves all elements executing the specified protocol in the specified view.
/// </summary>
/// <param name="viewName">The view name.</param>
/// <param name="protocolName">The protocol name.</param>
/// <param name="protocolVersion">The protocol version.</param>
/// <returns>The elements running the specified protocol in the specified view.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsInView("MySpecialElements","Microsoft Platform","1.1.0.48");
/// </code>
/// </example>
Element[] FindElementsInView(string viewName, string protocolName, string protocolVersion);
/// <summary>
/// Retrieves all elements in the specified view.
/// </summary>
/// <param name="viewID">The view ID.</param>
/// <returns>The elements in the specified view.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsInView(14);
/// </code>
/// </example>
Element[] FindElementsInView(int viewID);
/// <summary>
/// Retrieves all elements in the specified view.
/// </summary>
/// <param name="viewName">The view name.</param>
/// <returns>The elements in the specified view.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsInView("MySpecialElements");
/// </code>
/// </example>
Element[] FindElementsInView(string viewName);
/// <summary>
/// Retrieves all elements executing the specified protocol.
/// </summary>
/// <param name="name">The name of the protocol.</param>
/// <returns>The elements executing the specified protocol.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsByProtocol("Microsoft Platform");
/// </code>
/// </example>
Element[] FindElementsByProtocol(string name);
/// <summary>
/// Retrieves all elements sharing the specified protocol and protocol version.
/// </summary>
/// <param name="name">The protocol name.</param>
/// <param name="version">The protocol version.</param>
/// <returns>The elements executing the specified version of the specified protocol.</returns>
/// <example>
/// <code>
/// Elements[] elements = engine.FindElementsByProtocol("Microsoft Platform","1.1.0.48");
/// </code>
/// </example>
Element[] FindElementsByProtocol(string name, string version);
/// <summary>
/// Retrieves all elements of which the name matches the specified name filter.
/// </summary>
/// <param name="nameFilter">The name filter.</param>
/// <returns>The elements of which the name matches the specified name filter.</returns>
/// <remarks><para>Name masks can contain the following wildcards:</para>
/// <list type="bullet">
/// <item><description>* : Any string of characters</description></item>
/// <item><description>? : Any single character</description></item>
/// </list>
/// </remarks>
/// <example>
/// <code>
/// Element[] elements = engine.FindElementsByName("Test*");
/// </code>
/// </example>
Element[] FindElementsByName(string nameFilter);
/// <summary>
/// Retrieves the element with the specified name.
/// </summary>
/// <param name="name">The name of the element.</param>
/// <returns>The element with the specified name or <see langword="null"/> if no element was found with the specified name.</returns>
/// <example>
/// <code>
/// Element myElement = engine.FindElement("myElement");
/// </code>
/// </example>
Element FindElement(string name);
/// <summary>
/// Retrieves the element with the specified DataMiner Agent ID/element ID.
/// </summary>
/// <param name="dmaID">The DataMiner Agent ID of the element.</param>
/// <param name="elementID">The element ID.</param>
/// <returns>The element with the specified DataMiner Agent ID/element ID or <see langword="null"/> if no element was found with the specified ID.</returns>
/// <example>
/// <code>
/// Element myElement = engine.FindElement(7,32);
/// </code>
/// </example>
Element FindElement(int dmaID, int elementID);
/// <summary>
/// Retrieves the element with the specified key.
/// </summary>
/// <param name="key">The key of the element. The key must be formatted as follows: "DataMiner Agent ID/element ID".</param>
/// <returns>The element with the specified key or <see langword="null"/> if no element was found with the specified key.</returns>
/// <example>
/// <code>
/// Element myElement = engine.FindElementByKey("7/32");
/// </code>
/// </example>
Element FindElementByKey(string key);
/// <summary>
/// Retrieves all services matching the specified filter.
/// </summary>
/// <param name="filter">The service filter.</param>
/// <returns>The services matching the specified filter.</returns>
/// <example>
/// <code>
/// ServiceFilter myServiceFilter = ServiceFilter.ByView("MyView");
/// Service[] services = engine.FindServices(myServiceFilter);
/// </code>
/// </example>
Service[] FindServices(ServiceFilter filter);
/// <summary>
/// Retrieves all services in the view with the specified ID.
/// </summary>
/// <param name="viewID">The view ID.</param>
/// <returns>The services in the specified view.</returns>
/// <example>
/// <code>
/// Service[] services = engine.FindServicesInView(19);
/// </code>
/// </example>
Service[] FindServicesInView(int viewID);
/// <summary>
/// Retrieves all services in the view with the specified name.
/// </summary>
/// <param name="viewName">The view name.</param>
/// <returns>The services in the specified view.</returns>
/// <example>
/// <code>
/// Service[] services = engine.FindServicesInView("MySpecialView");
/// </code>
/// </example>
Service[] FindServicesInView(string viewName);
/// <summary>
/// Retrieves all services of which the name matches the specified name filter.
/// </summary>
/// <param name="nameFilter">The name filter.</param>
/// <returns>The services of which the name matches the specified name filter.</returns>
/// <remarks>
/// <para>Name masks can contain the following wildcards:</para>
/// <list type="bullet">
/// <item><description>* : Any string of characters</description></item>
/// <item><description>? : Any single character</description></item>
/// </list>
/// </remarks>
/// <example>
/// <code>
/// Service[] services = engine.FindServicesByName("Test*");
/// </code>
/// </example>
Service[] FindServicesByName(string nameFilter);
/// <summary>
/// Retrieves the service with the specified name.
/// </summary>
/// <param name="name">The service name.</param>
/// <returns>The service with the specified name or <see langword="null"/> if the service was not found.</returns>
/// <example>
/// <code>
/// Service myService = engine.FindService("MyService");
/// </code>
/// </example>
Service FindService(string name);
/// <summary>
/// Retrieves the service with the specified ID.
/// </summary>
/// <param name="dmaID">The DMA ID of the service.</param>
/// <param name="serviceID">The ID of the service.</param>
/// <returns>The service with the specified ID or <see langword="null"/> if the service was not found.</returns>
/// <example>
/// <code>
/// Service myService = engine.FindService(3, 56);
/// </code>
/// </example>
Service FindService(int dmaID, int serviceID);
/// <summary>
/// Retrieves the service with the specified key.
/// </summary>
/// <param name="key">The key of the service. The key must be formatted as follows: "DMA ID/service ID".</param>
/// <returns>The service with the specified key or <see langword="null"/> if the service was not found.</returns>
/// <example>
/// <code>
/// Service myService = engine.FindServiceByKey("3/56");
/// </code>
/// </example>
Service FindServiceByKey(string key);
/// <summary>
/// Retrieves all redundancy groups matching the specified filter.
/// </summary>
/// <param name="filter">The redundancy group filter.</param>
/// <returns>The redundancy groups matching the specified filter.</returns>
/// <example>
/// <code>
/// RedundancyGroupFilter myGroupFilter = RedundancyGroupFilter.ByView("MyView");
/// RedundancyGroup[] groups = engine.FindRedundancyGroups(myGroupFilter);
/// </code>
/// </example>
RedundancyGroup[] FindRedundancyGroups(RedundancyGroupFilter filter);
/// <summary>
/// Retrieves all redundancy groups in the specified view.
/// </summary>
/// <param name="viewID">The view ID.</param>
/// <returns>The redundancy groups in the specified view.</returns>
/// <example>
/// <code>
/// RedundancyGroup[] groups = engine.FindRedundancyGroupsInView(17);
/// </code>
/// </example>
RedundancyGroup[] FindRedundancyGroupsInView(int viewID);
/// <summary>
/// Retrieves all redundancy groups in the specified view.
/// </summary>
/// <param name="viewName">The view name.</param>
/// <returns>The redundancy groups in the specified view.</returns>
/// <example>
/// <code>
/// RedundancyGroup[] groups = engine.FindRedundancyGroupsInView("MySpecialView");
/// </code>
/// </example>
RedundancyGroup[] FindRedundancyGroupsInView(string viewName);
/// <summary>
/// Retrieves all redundancy groups of which the name matches the specified name mask.
/// </summary>
/// <param name="nameFilter">The name filter.</param>
/// <returns>The redundancy groups of which the name matches the specified name mask.</returns>
/// <remarks>
/// <para>Name masks can contain the following wildcards:</para>
/// <list type="bullet">
/// <item><description>* : Any string of characters</description></item>
/// <item><description>? : Any single character</description></item>
/// </list>
/// </remarks>
/// <example><code>RedundancyGroup[] groups = engine.FindRedundancyGroupsByName("Test*");</code></example>
RedundancyGroup[] FindRedundancyGroupsByName(string nameFilter);
/// <summary>
/// Retrieves the redundancy group with the specified name.
/// </summary>
/// <param name="name">The redundancy group name.</param>
/// <returns>The redundancy group with the specified name or <see langword="null"/> if no redundancy group with the specified name exists..</returns>
/// <remarks>
/// <para>Name masks can contain the following wildcards:</para>
/// <list type="bullet">
/// <item><description>* : Any string of characters</description></item>
/// <item><description>? : Any single character</description></item>
/// </list>
/// </remarks>
/// <example>
/// <code>
/// RedundancyGroup group = engine.FindRedundancyGroup("MySpecialRedundancyGroup");
/// </code>
/// </example>
RedundancyGroup FindRedundancyGroup(string name);
/// <summary>
/// Retrieves the redundancy group with the specified DMA ID and group ID.
/// </summary>
/// <param name="dmaID">The DMA ID of the redundancy group.</param>
/// <param name="groupID">The group ID of the redundancy group.</param>
/// <returns>The redundancy group with the specified DMA ID and group ID or <see langword="null"/> if no redundancy group with the specified ID exists.</returns>
/// <example>
/// <code>
/// RedundancyGroup group = engine.FindRedundancyGroup(7,24);
/// </code>
/// </example>
RedundancyGroup FindRedundancyGroup(int dmaID, int groupID);
/// <summary>
/// Retrieves the redundancy group with the specified key.
/// </summary>
/// <param name="key">The key of the redundancy group. The key must be formatted as follows: "DataMiner Agent ID/redundancy group ID".</param>
/// <returns>The redundancy group with the specified key or <see langword="null"/> if no redundancy group with the specified key exists.</returns>
/// <example>
/// <code>
/// RedundancyGroup group = engine.FindRedundancyGroupByKey("7/24");
/// </code>
/// </example>
RedundancyGroup FindRedundancyGroupByKey(string key);
/// <summary>
/// Asks input from a user.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="timeoutTime">A timeout (in seconds). When this timeout expires, the script will continue and the FindInteractiveClient method will return “False”. The script can then decide how to deal with this result: issue a new request, fail, or execute automatic actions.</param>
/// <param name="allowedGroups">Indication of which users will receive the request, i.e. a list of DataMiner security group names, separated by semicolons. In this list of groups, you can also specify individual users. To do so, specify “user:”, followed by the user name.</param>
/// <param name="options">Options in the form of a set of binary flags.</param>
/// <exception cref="DataMinerException">Failed to find interactive client.</exception>
/// <returns><c>true</c> if attaching to the interactive client succeeded; otherwise, <c>false</c>.</returns>
/// <remarks>
/// <para>In an Automation script executed from e.g. a scheduled background task or as a Correlation action, you can use the FindInteractiveClient method to ask for input from a user.</para>
/// <para>In a message box, the user will be asked to click either Attach or Ignore.</para>
/// <list type="bullet">
/// <item><description>If the user clicks Attach, the script will start in a pop-up window.</description></item>
/// <item><description>If the user clicks Ignore, the message box will be closed.</description></item>
/// </list>
/// <note type="note">In DataMiner Cube, you can also use the script action Find interactive client, instead of using C#. For more information, see Find interactive client.</note>
/// </remarks>
/// <example>
/// <code>
/// string allowedGroups = "grpA;grpB";
/// bool ok = engine.FindInteractiveClient("Hello world", 100 , allowedGroups, AutomationScriptAttachOptions.None);
/// if (!ok)
/// {
/// engine.GenerateInformation("Could not attach");
/// }
/// else
/// {
/// engine.GenerateInformation("Attached! As " + engine.UserDisplayName);
/// engine.ShowProgress("A message");
/// engine.ShowUI("Another message", true);
/// }
/// </code>
/// </example>
[return: MarshalAs(UnmanagedType.U1)]
bool FindInteractiveClient(string message, int timeoutTime, string allowedGroups, AutomationScriptAttachOptions options);
/// <summary>
/// Asks input from a user.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="timeoutTime">A timeout (in seconds). When this timeout expires, the script will continue and the FindInteractiveClient method will return “False”. The script can then decide how to deal with this result: issue a new request, fail, or execute automatic actions.</param>
/// <param name="allowedGroups">Indication of which users will receive the request, i.e. a list of DataMiner security group names, separated by semicolons. In this list of groups, you can also specify individual users. To do so, specify “user:”, followed by the user name.</param>
/// <exception cref="DataMinerException">Failed to find interactive client.</exception>
/// <returns><c>true</c> if attaching to the interactive client succeeded; otherwise, <c>false</c>.</returns>
/// <remarks>
/// <para>In an Automation script executed from e.g. a scheduled background task or as a Correlation action, you can use the FindInteractiveClient method to ask for input from a user.</para>
/// <para>In a message box, the user will be asked to click either Attach or Ignore.</para>
/// <list type="bullet">
/// <item><description>If the user clicks Attach, the script will start in a pop-up window.</description></item>
/// <item><description>If the user clicks Ignore, the message box will be closed.</description></item>
/// </list>
/// <note type="note">In DataMiner Cube, you can also use the script action Find interactive client, instead of using C#. For more information, see Find interactive client.</note>
/// </remarks>
/// <example>
/// <code>
/// string allowedGroups = "grpA;grpB";
/// bool ok = engine.FindInteractiveClient("Hello world", 100 , allowedGroups, AutomationScriptAttachOptions.None);
/// if (!ok)
/// {
/// engine.GenerateInformation("Could not attach");
/// }
/// else
/// {
/// engine.GenerateInformation("Attached! As " + engine.UserDisplayName);
/// engine.ShowProgress("A message");
/// engine.ShowUI("Another message", true);
/// }
/// </code>
/// </example>
[return: MarshalAs(UnmanagedType.U1)]
bool FindInteractiveClient(string message, int timeoutTime, string allowedGroups);
/// <summary>
/// Asks input from a user.
/// </summary>
/// <param name="message">The message to be shown.</param>
/// <param name="timeoutTime">A timeout (in seconds). When this timeout expires, the script will continue and the FindInteractiveClient method will return “False”. The script can then decide how to deal with this result: issue a new request, fail, or execute automatic actions.</param>
/// <exception cref="DataMinerException">Failed to find interactive client.</exception>
/// <returns><c>true</c> if attaching to the interactive client succeeded; otherwise, <c>false</c>.</returns>
/// <remarks>
/// <para>In an Automation script executed from e.g. a scheduled background task or as a Correlation action, you can use the FindInteractiveClient method to ask for input from a user.</para>
/// <para>In a message box, the user will be asked to click either Attach or Ignore.</para>
/// <list type="bullet">
/// <item><description>If the user clicks Attach, the script will start in a pop-up window.</description></item>
/// <item><description>If the user clicks Ignore, the message box will be closed.</description></item>
/// </list>
/// <note type="note">In DataMiner Cube, you can also use the script action Find interactive client, instead of using C#. For more information, see Find interactive client.</note>
/// </remarks>
/// <example>
/// <code>
/// string allowedGroups = "grpA;grpB";
/// bool ok = engine.FindInteractiveClient("Hello world", 100 , allowedGroups, AutomationScriptAttachOptions.None);
///
/// if(!ok)
/// {
/// engine.GenerateInformation("Could not attach");
/// }
/// else
/// {
/// engine.GenerateInformation("Attached! As " + engine.UserDisplayName);
/// engine.ShowProgress("A message");
/// engine.ShowUI("Another message", true);
/// }
/// </code>
/// </example>
[return: MarshalAs(UnmanagedType.U1)]
bool FindInteractiveClient(string message, int timeoutTime);
/// <summary>
/// Generates an information message with the specified text.
/// </summary>
/// <param name="text">Message to be shown in the information message.</param>
/// <exception cref="DataMinerException">Information event generation failed.</exception>
/// <example>
/// <code>
/// engine.GenerateInformation("Hello World!");
/// </code>
/// </example>
void GenerateInformation(string text);
/// <summary>
/// Retrieves an object representing one of the script dummies.
/// </summary>
/// <param name="name">The dummy name.</param>
/// <returns>The object representing the specified script dummy or <see langword="null"/> if the dummy with the specified name is not found.</returns>
/// <remarks><para>Through this object, actions like "set parameter" can be executed.</para></remarks>
/// <example>
/// <code>
/// ScriptDummy dummyTest = engine.GetDummy("matrix");
/// </code>
/// </example>
ScriptDummy GetDummy(string name);
/// <summary>
/// Retrieves the value of the specified custom alarm property.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="propertyName">The name of the alarm property.</param>
/// <exception cref="ArgumentException">Alarm not found.</exception>
/// <returns>The value of the specified alarm property.</returns>
/// <example>
/// <code>
/// string propertyValue = engine.GetAlarmProperty(200, 400, 59851, "SourceDetail");
/// </code>
/// </example>
string GetAlarmProperty(int dataMinerID, int elementID, int alarmID, string propertyName);
/// <summary>
/// Retrieves the value of the specified custom alarm property.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="propertyName">The name of the alarm property.</param>
/// <exception cref="ArgumentException">Alarm not found.</exception>
/// <returns>The value of the specified alarm property.</returns>
/// <example>
/// <code>
/// string propertyValue = engine.GetAlarmProperty(200, 59851, "SourceDetail");
/// </code>
/// </example>
string GetAlarmProperty(int dataMinerID, int alarmID, string propertyName);
/// <summary>
/// Retrieves an object representing one of the script dummies.
/// </summary>
/// <param name="id">The dummy ID.</param>
/// <returns>The object representing the specified script dummy or <see langword="null"/> if the dummy with the specified ID is not found.</returns>
/// <remarks><para>Through this object, actions like "set parameter" can be executed.</para></remarks>
/// <example>
/// <code>
/// ScriptDummy dummyTest = engine.GetDummy(5);
/// </code>
/// </example>
ScriptDummy GetDummy(int id);
/// <summary>
/// Retrieves an object representing one of the script’s memory files. Through this object, data can be read from or written into the memory file.
/// </summary>
/// <param name="name">The name of the memory file.</param>
/// <returns>The object representing the specified script memory file or <see langword="null"/> if the memory with the specified name is not found.</returns>
/// <example>
/// <code>
/// ScriptMemory memoryData = engine.GetMemory("name");
/// </code>
/// </example>
ScriptMemory GetMemory(string name);
/// <summary>
/// Retrieves an object representing one of the script’s memory files. Through this object, data can be read from or written into the memory file.
/// </summary>
/// <param name="id">The ID of the memory file.</param>
/// <returns>The object representing the specified script memory file or <see langword="null"/> if the memory with the specified ID is not found.</returns>
/// <example>
/// <code>
/// ScriptMemory memoryData = engine.GetMemory(3);
/// </code>
/// </example>
ScriptMemory GetMemory(int id);
/// <summary>
/// Returns the script output of the specified key.
/// </summary>
/// <param name="key">The key of the entry for which the value should be retrieved.</param>
/// <returns>The value of the specified key or <see langword="null"/> when the specified key cannot be found.</returns>
/// <remarks>
/// <para>Feature introduced in DataMiner 10.0.2 (RN 23936).</para>
/// <para>When a subscript fails or throws an exception, its script output will still be filled in.</para>
/// </remarks>
string GetScriptOutput(string key);
/// <summary>
/// Retrieves an object representing a script parameter. Through this object, its value can be retrieved.
/// </summary>
/// <param name="name">The name of the script parameter.</param>
/// <returns>The specified script parameter or <see langword="null"/> if the script parameter with the specified name is not found.</returns>
/// <example>
/// <code>
/// ScriptParam param = engine.GetScriptParam("input");
/// </code>
/// </example>
ScriptParam GetScriptParam(string name);
/// <summary>
/// Retrieves an object representing a script parameter. Through this object, its value can be retrieved.
/// </summary>
/// <param name="id">The ID of the script parameter.</param>
/// <returns>The specified script parameter or <see langword="null"/> if the script parameter with the specified ID is not found..</returns>
/// <example>
/// <code>
/// ScriptParam param = engine.GetScriptParam(5);
/// </code>
/// </example>
ScriptParam GetScriptParam(int id);
/// <summary>
/// Returns a copy of the script output of the current script and, if the <see cref="SubScriptOptions.InheritScriptOutput"/> option is set to “true”, the child scripts.
/// </summary>
/// <returns>The script results.</returns>
/// <remarks>
/// <para>Feature introduced in DataMiner 10.0.2 (RN 23936).</para>
/// <para>When a subscript fails or throws an exception, its script output will still be filled in.</para>
/// </remarks>
Dictionary<string, string> GetScriptResult();
/// <summary>
/// Retrieves a connection representing the user that executed the Automation script.
/// </summary>
/// <returns>A connection representing the user that executed the Automation script</returns>
/// <remarks>
/// <para>In case of an interactive Automation script, the connection represents the user that is interacting with the interactive script. If the script was triggered by DataMiner instead of a user, the connection represents the built-in ManagedAutomation user.</para>
/// <para>Feature introduced in DataMiner 10.0.10 (RN 26434).</para>
/// </remarks>
/// <example>
/// <code>
/// using(var logHelper = LogHelper.Create(engine.GetUserConnection()))
/// {
/// // ...
/// }
/// </code>
/// </example>
IConnection GetUserConnection();
/// <summary>
/// Resets the timeout timer, extending the time the Automation script is allowed to execute.
/// The time can be specified via the <see cref="Timeout"/> property.
/// </summary>
/// <remarks>When a script reaches the timeout, a <see cref="ScriptTimeoutException"/> will be thrown to stop the execution.</remarks>
void KeepAlive();
/// <summary>
/// Retrieves a double value from a global script variable.
/// </summary>
/// <param name="name">The name of the global script variable.</param>
/// <exception cref="DataMinerException">Load value failed.</exception>
/// <returns>The value of the global script variable.</returns>
/// <example>
/// <code>
/// double myValue = engine.LoadDoubleValue("MyVariable");
/// </code>
/// </example>
double LoadDoubleValue(string name);
/// <summary>
/// Retrieves a string value from a global script variable.
/// </summary>
/// <param name="name">The name of the global script variable.</param>
/// <exception cref="DataMinerException">Load value failed.</exception>
/// <returns>The value of the global script variable.</returns>
/// <example>
/// <code>
/// string myValue = engine.LoadStringValue("MyVariable");
/// </code>
/// </example>
string LoadStringValue(string name);
/// <summary>
/// Retrieves a value from a global script variable.
/// </summary>
/// <param name="name">The name of the global script variable.</param>
/// <returns>The value of the global script variable.</returns>
/// <exception cref="DataMinerException">Load value failed.</exception>
/// <example>
/// <code>
/// object myValue = engine.LoadValue("MyVariable");
/// </code>
/// </example>
object LoadValue(string name);
/// <summary>
/// Adds an entry in the SLAutomation.txt log file.
/// </summary>
/// <param name="message">The message to log.</param>
/// <param name="type">The log type.</param>
/// <param name="logLevel">The log level.</param>
/// <param name="method">The method name to include in the log entry.</param>
/// <exception cref="DataMinerException">Log failed.</exception>
/// <example>
/// <code>
/// engine.Log("My log message", LogType.Always, 5, "Initialize");
/// </code>
/// </example>
void Log(string message, LogType type, int logLevel, string method);
/// <summary>
/// Adds an entry in the SLAutomation.txt log file.
/// </summary>
/// <param name="message">The message to log.</param>
/// <param name="type">The log type.</param>
/// <param name="logLevel">The log level.</param>
/// <exception cref="DataMinerException">Log failed.</exception>
/// <example>
/// <code>
/// engine.Log("My log message", LogType.Always, 5);
/// </code>
/// </example>
void Log(string message, LogType type, int logLevel);
/// <summary>
/// Adds an entry in the SLAutomation.txt log file.
/// </summary>
/// <param name="message">The message to log.</param>
/// <exception cref="DataMinerException">Log failed.</exception>
/// <example>
/// <code>
/// engine.Log("My log message");
/// </code>
/// </example>
void Log(string message);
/// <summary>
/// Returns a <see cref="SubScriptOptions" /> object, which you can use to configure and launch a subscript.
/// </summary>
/// <param name="scriptName">The name of the script to prepare.</param>
/// <exception cref="ArgumentNullException"><paramref name="scriptName"/> is <see langword="null"/>.</exception>
/// <returns>The <see cref="SubScriptOptions" /> object.</returns>
/// <example>
/// <code>
/// SubScriptOptions subscriptInfo;
/// subscriptInfo = engine.PrepareSubScript("myOtherScript");
/// subscriptInfo.Synchronous = true;
/// ...
/// subscriptInfo.StartScript();
/// </code>
/// </example>
SubScriptOptions PrepareSubScript(string scriptName);
/// <summary>
/// Returns a <see cref="MailReportOptions" /> object, which you can use to configure and launch an email report.
/// </summary>
/// <param name="mailReport">The mail report to prepare.</param>
/// <returns>The <see cref="MailReportOptions" /> object.</returns>
/// <exception cref="ArgumentException"><paramref name="mailReport"/> is <see langword="null"/> or the empty string ("").</exception>
/// <example>
/// <code>
/// MailReportOptions reportOptions;
/// reportOptions = engine.PrepareMailReport("myReportTemplate");
/// reportOptions.EmailOptions.SendAsPlainText = true;
/// ...
/// engine.SendReport(reportOptions);
/// </code>
/// </example>
MailReportOptions PrepareMailReport(string mailReport);
/// <summary>
/// Launches an application on the client in an interactive script.
/// </summary>
/// <param name="applicationPath">The application path.</param>
/// <param name="waitForCompletion">When set to <c>true</c>, the script will halt until the client application has completed or has been closed. In the interactive window, users will see the message “Wait for client program to finish”.</param>
/// <exception cref="InteractiveUserDetachedException">The interactive client was detached.</exception>
/// <returns>The UI result.</returns>
UIResults RunClientProgram(string applicationPath, [MarshalAs(UnmanagedType.U1)] bool waitForCompletion);
/// <summary>
/// Launches an application on the client in an interactive script.
/// </summary>
/// <param name="applicationPath">The application path.</param>
/// <exception cref="InteractiveUserDetachedException">The interactive client was detached.</exception>
/// <returns>The UI result.</returns>
UIResults RunClientProgram(string applicationPath);
/// <summary>
/// Launches an application on the client in an interactive script.
/// </summary>
/// <param name="applicationPath">The application path.</param>
/// <param name="arguments">The arguments.</param>
/// <exception cref="InteractiveUserDetachedException">The interactive client was detached.</exception>
/// <returns>The UI result.</returns>
/// <example>
/// <code>
/// engine.RunClientProgram("notepad.exe", @"C:\skyline dataminer\logging\slerrors.txt");
/// </code>
/// </example>
UIResults RunClientProgram(string applicationPath, string arguments);
/// <summary>
/// Launches an application on the client in an interactive script.
/// </summary>
/// <param name="applicationPath">The application path.</param>
/// <param name="arguments">The arguments.</param>
/// <param name="waitForCompletion">When set to <c>true</c>, the script will halt until the client application has completed or has been closed. In the interactive window, users will see the message “Wait for client program to finish”.</param>
/// <exception cref="InteractiveUserDetachedException">The interactive client was detached.</exception>
/// <returns>The UI result.</returns>
/// <example>
/// <code>
/// engine.RunClientProgram(@"C:\Skyline DataMiner\Tools\SLTaskbarUtility\SLTaskbarUtility.exe", @"\h", true);
/// </code>
/// </example>
UIResults RunClientProgram(string applicationPath, string arguments, [MarshalAs(UnmanagedType.U1)] bool waitForCompletion);
/// <summary>
/// Saves a value to a global script variable. This value can then be reused elsewhere in the same script.
/// </summary>
/// <param name="name">The name of the global script variable.</param>
/// <param name="value">The value to set.</param>
/// <exception cref="DataMinerException">Save value failed.</exception>
/// <example>
/// <code>
/// engine.SaveValue("MyVariable", 10.8);
/// </code>
/// </example>
void SaveValue(string name, double value);
/// <summary>
/// Saves a value to a global script variable. This value can then be reused elsewhere in the same script.
/// </summary>
/// <param name="name">The name of the global script variable.</param>
/// <param name="value">The value to set.</param>
/// <exception cref="DataMinerException">Save value failed.</exception>
/// <example>
/// <code>
/// engine.SaveValue("MyVariable", "MyValue");
/// </code>
/// </example>
void SaveValue(string name, string value);
/// <summary>
/// Updates a custom alarm property.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="propertyValue">The value to set.</param>
/// <remarks>
/// <note type="note">
/// <list type="bullet">
/// <item><description>In DataMiner versions prior to 9.0, this method cannot be used to override alarm property values that are defined in the element protocol.</description></item>
/// <item><description>When an alarm property value has been defined in the element protocol and this method is used to explicitly assign a new value to the property, the new value will only be retained until the severity of the alarm changes. After this, the value from the protocol is used again.</description></item>
/// </list>
/// </note>
/// </remarks>
void SetAlarmProperty(int dataMinerID, int elementID, int alarmID, string propertyName, string propertyValue);
/// <summary>
/// Updates a custom alarm property.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="propertyName">The property name.</param>
/// <param name="propertyValue">The value to set.</param>
/// <remarks>
/// <note type="note">
/// <list type="bullet">
/// <item><description>In DataMiner versions prior to 9.0, this method cannot be used to override alarm property values that are defined in the element protocol.</description></item>
/// <item><description>When an alarm property value has been defined in the element protocol and this method is used to explicitly assign a new value to the property, the new value will only be retained until the severity of the alarm changes. After this, the value from the protocol is used again.</description></item>
/// </list>
/// </note>
/// </remarks>
/// <example>
/// <code>
/// engine.SetAlarmProperty(200, 521655, "Property A", "Value A");
/// </code>
/// </example>
void SetAlarmProperty(int dataMinerID, int alarmID, string propertyName, string propertyValue);
/// <summary>
/// Sets the specified custom alarm properties to the specified values.
/// </summary>
/// <param name="dataMinerID">The DataMiner Agent ID.</param>
/// <param name="elementID">The element ID.</param>
/// <param name="alarmID">The alarm ID.</param>
/// <param name="propertyNames">The names of the properties.</param>
/// <param name="propertyValues">The values of the properties.</param>
/// <remarks>
/// <note type="note">
/// <list type="bullet">
/// <item><description>In DataMiner versions prior to 9.0, this method cannot be used to override alarm property values that are defined in the element protocol.</description></item>
/// <item><description>When an alarm property value has been defined in the element protocol and this method is used to explicitly assign a new value to the property, the new value will only be retained until the severity of the alarm changes. After this, the value from the protocol is used again.</description></item>
/// </list>
/// </note>
/// </remarks>
/// <example>
/// <code>
/// engine.SetAlarmProperties(200, 400, 521655, new string[]{"Property A", "Property B"}, new string[]{"Value A", "Value B"});
/// </code>
/// </example>
void SetAlarmProperties(int dataMinerID, int elementID, int alarmID, string[] propertyNames, string[] propertyValues);