Beispiel #1
0
        public void AddKqlQuery(CslParagraph para)
        {
            try
            {
                // Load any functions for use across the node
                GlobalFunctions.ReadFunctionsFromQuery(para.Query);

                // Create the KqlQuery info, and hold reference to the object to prevent GC from releasing.
                var newKqlQuery = new KqlQuery(this, para.Comment, para.Query)
                {
                    IsValid = true,
                    Message = "Success",
                    KqlQueryEngagedDateTime = DateTime.UtcNow
                };

                KqlQueryList.Add(newKqlQuery);
                SubscriptionReferenceDisposables.Add(newKqlQuery);
            }
            catch (Exception ex)
            {
                FailedKqlQueryList.Add(new KqlQuery
                {
                    Node          = this,
                    Comment       = para.Comment,
                    Query         = para.Query,
                    IsValid       = false,
                    Message       = ex.Message,
                    FailureReason = ex,
                });
            }
        }
Beispiel #2
0
        /// <summary>
        /// Add a single KqlQuery to the KqlNode.
        /// </summary>
        /// <param name="kqlQuery">The KqlQuery object</param>
        /// <param name="stopKqlQueries">Optionally clear out currently executing KqlQueries, or only add new ones</param>
        public void AddKqlQuery(KqlQuery kqlQuery, bool stopKqlQueries = false)
        {
            try
            {
                // Optionally clear out currently executing KqlQueries, or only add new ones
                if (stopKqlQueries)
                {
                    InitializeKqlQueryLists();
                }

                // Load any functions for use across the node
                GlobalFunctions.ReadFunctionsFromQuery(kqlQuery.Query);

                // Create the KqlQuery info, and hold reference to the object to prevent GC from releasing.
                var newKqlQuery = new KqlQuery(this, kqlQuery.Comment, kqlQuery.Query)
                {
                    IsValid = true,
                    Message = "Success",
                    KqlQueryEngagedDateTime = DateTime.UtcNow,
                    QueryGuid        = kqlQuery.QueryGuid,
                    QueryName        = kqlQuery.QueryName,
                    QueryDescription = kqlQuery.QueryDescription,
                    QueryId          = kqlQuery.QueryId,
                };

                KqlQueryList.Add(newKqlQuery);
                SubscriptionReferenceDisposables.Add(newKqlQuery);
            }
            catch (Exception ex)
            {
                FailedKqlQueryList.Add(new KqlQuery
                {
                    Node             = this,
                    Comment          = kqlQuery.Comment,
                    Query            = kqlQuery.Query,
                    IsValid          = false,
                    Message          = ex.Message,
                    QueryGuid        = kqlQuery.QueryGuid,
                    QueryName        = kqlQuery.QueryName,
                    QueryDescription = kqlQuery.QueryDescription,
                    QueryId          = kqlQuery.QueryId,
                    FailureReason    = ex,
                });
            }
        }
Beispiel #3
0
 /// <summary>
 /// Add a Kql function directly from it's definition
 /// </summary>
 /// <param name="kqlFunctionQuery"></param>
 public void AddKqlFunction(string kqlFunctionQuery)
 {
     // Load any functions for use across the node
     GlobalFunctions.ReadFunctionsFromQuery(kqlFunctionQuery);
 }