public void CanGetSearchResultsAndUpdate()
        {
            BasicDelegatingHandler handler = new BasicDelegatingHandler();

            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();

                var client = TestHelper.GetOperationalInsightsManagementClient(handler);

                // Rasha's workspace is the only one in int with cold data, which is necessary to test the update search method
                string resourceGroupName = "OI-Default-East-US";
                string workspaceName = "rasha";
                int topCount = 25;

                SearchGetSearchResultsParameters parameters = new SearchGetSearchResultsParameters();
                parameters.Query = "*";
                parameters.Top = topCount;
                var searchResult = client.Search.GetSearchResults(resourceGroupName, workspaceName, parameters);
                Assert.NotNull(searchResult);
                Assert.NotNull(searchResult.Metadata);
                Assert.NotNull(searchResult.Value);
                Assert.Equal(searchResult.Value.Count, topCount);

                var updatedSearchResult = client.Search.UpdateSearchResults(
                    resourceGroupName,
                    workspaceName,
                    searchResult.Metadata.SearchId);
                Assert.NotNull(updatedSearchResult);
                Assert.NotNull(searchResult.Metadata);
                Assert.NotNull(searchResult.Value);
            }
        }
        public virtual PSSearchGetSearchResultsResponse GetSearchResults(string resourceGroupName, string workspaceName, PSSearchGetSearchResultsParameters psParameters)
        {
            SearchGetSearchResultsParameters parameters = new SearchGetSearchResultsParameters();
            parameters.Top = psParameters.Top;
            if (psParameters.Highlight != null)
            {
                parameters.Highlight = new Highlight();
                parameters.Highlight.Pre = psParameters.Highlight.Pre;
                parameters.Highlight.Post = psParameters.Highlight.Post;
            }
            parameters.Query = psParameters.Query;
            parameters.Start = psParameters.Start;
            parameters.End = psParameters.End;

            SearchGetSearchResultsResponse response = OperationalInsightsManagementClient.Search.GetSearchResults(resourceGroupName, workspaceName, parameters);
            PSSearchGetSearchResultsResponse searchResponse = new PSSearchGetSearchResultsResponse(response);
            return searchResponse;
        }
 /// <summary>
 /// Gets the search results for a given workspace.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.OperationalInsights.ISearchOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the workspace.
 /// </param>
 /// <param name='workspaceName'>
 /// Required. A unique workspace instance name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to execute a search query.
 /// </param>
 /// <returns>
 /// The get search result operation response.
 /// </returns>
 public static Task<SearchGetSearchResultsResponse> GetSearchResultsAsync(this ISearchOperations operations, string resourceGroupName, string workspaceName, SearchGetSearchResultsParameters parameters)
 {
     return operations.GetSearchResultsAsync(resourceGroupName, workspaceName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Gets the search results for a given workspace.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.OperationalInsights.ISearchOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the workspace.
 /// </param>
 /// <param name='workspaceName'>
 /// Required. A unique workspace instance name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to execute a search query.
 /// </param>
 /// <returns>
 /// The get search result operation response.
 /// </returns>
 public static SearchGetSearchResultsResponse GetSearchResults(this ISearchOperations operations, string resourceGroupName, string workspaceName, SearchGetSearchResultsParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((ISearchOperations)s).GetSearchResultsAsync(resourceGroupName, workspaceName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }