@@ -23,29 +23,6 @@ namespace Microsoft.Azure.Commands.OperationalInsights
23
23
24
24
internal class SearchCommandHelper
25
25
{
26
- /// <summary>
27
- /// Return true if the provided query is a list of computers, return false otherwise.
28
- /// </summary>
29
- public static bool IsListOfComputers ( string groupQuery )
30
- {
31
- if ( string . IsNullOrEmpty ( groupQuery ) )
32
- {
33
- return false ;
34
- }
35
-
36
- // First, remove white spaces from group query.
37
- string query = new string (
38
- groupQuery . ToCharArray ( ) . Where ( c => ! Char . IsWhiteSpace ( c ) ) . ToArray ( ) ) ;
39
-
40
- if ( ( query . IndexOf ( "|measurecount()bycomputer" , StringComparison . InvariantCultureIgnoreCase ) >= 0 ) ||
41
- ( query . IndexOf ( "|distinctcomputer" , StringComparison . InvariantCultureIgnoreCase ) >= 0 ) )
42
- {
43
- return true ;
44
- }
45
-
46
- return false ;
47
- }
48
-
49
26
/// <summary>
50
27
/// Populate and validate SavedSearch.Properties.Tags from a Hashtable of tags specified in the cmdlet.
51
28
/// </summary>
@@ -57,7 +34,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
57
34
return null ;
58
35
}
59
36
60
- bool hasGroupTag = false ;
61
37
string groupKey = null ;
62
38
IList < Tag > tagList = new List < Tag > ( ) ;
63
39
@@ -69,7 +45,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
69
45
70
46
if ( key . Equals ( "group" , System . StringComparison . InvariantCultureIgnoreCase ) )
71
47
{
72
- hasGroupTag = true ;
73
48
groupKey = key ;
74
49
}
75
50
}
@@ -79,16 +54,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
79
54
}
80
55
}
81
56
82
- // If the saved search is tagged as a group of computers, do a sanity check on the query as it should be a list of computers.
83
- if ( hasGroupTag &&
84
- tags [ groupKey ] . ToString ( ) . Equals ( "computer" , StringComparison . InvariantCultureIgnoreCase ) )
85
- {
86
- if ( ! IsListOfComputers ( query ) )
87
- {
88
- throw new PSArgumentException ( "Query is not a list of computers. Please use aggregations such as: distinct Computer or measure count() by Computer." ) ;
89
- }
90
- }
91
-
92
57
return tagList ;
93
58
}
94
59
}
0 commit comments