Пример #1
0
        protected override void ProcessRecord()
        {
            if (!string.IsNullOrEmpty(Id))
            {
                WriteObject(OperationalInsightsClient.GetSearchResultsUpdate(ResourceGroupName, WorkspaceName, Id), true);
            }
            else if (!string.IsNullOrEmpty(Query))
            {
                PSHighlight highlight = new PSHighlight()
                {
                    Pre  = PreHighlight,
                    Post = PostHighlight
                };

                PSSearchGetSearchResultsParameters parameters = new PSSearchGetSearchResultsParameters()
                {
                    Top       = Top,
                    Highlight = highlight,
                    Query     = Query,
                    Start     = Start,
                    End       = End,
                };

                WriteObject(OperationalInsightsClient.GetSearchResults(ResourceGroupName, WorkspaceName, parameters), true);
            }
            else
            {
                ThrowTerminatingError(new ErrorRecord(new ArgumentException("Either the Query or Id parameter must be provided"), "QueryOrIdRequired", ErrorCategory.InvalidArgument, null));
            }
        }
Пример #2
0
        protected override void ProcessRecord()
        {
            if (Id != null)
            {
                WriteObject(OperationalInsightsClient.GetSearchResultsUpdate(ResourceGroupName, WorkspaceName, Id), true);
            }
            else
            {
                PSHighlight highlight = new PSHighlight()
                {
                    Pre  = PreHighlight,
                    Post = PostHighlight
                };
                PSSearchGetSearchResultsParameters parameters = new PSSearchGetSearchResultsParameters()
                {
                    Top       = Top,
                    Highlight = highlight,
                    Query     = Query,
                    Start     = Start,
                    End       = End,
                };

                WriteObject(OperationalInsightsClient.GetSearchResults(ResourceGroupName, WorkspaceName, parameters), true);
            }
        }