Skip to content

Commit 9081063

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Azure/dev' into dev
2 parents cebd4f3 + ddb5d48 commit 9081063

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/NewAzureOperationalInsightsComputerGroupCommand.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ protected override void ProcessRecord()
7373
Tags = new List<Tag>() { new Tag() { Name = "Group", Value = "Computer" } }
7474
};
7575

76-
if (!SearchCommandHelper.IsListOfComputers(this.Query))
77-
{
78-
throw new PSArgumentException("Query is not a list of computers. Please use aggregations such as: distinct Computer or measure count() by Computer.");
79-
}
80-
8176
WriteObject(OperationalInsightsClient.CreateOrUpdateSavedSearch(ResourceGroupName, WorkspaceName, SavedSearchId, properties, Force, ConfirmAction), true);
8277
}
8378

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/SearchCommandHelper.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,6 @@ namespace Microsoft.Azure.Commands.OperationalInsights
2323

2424
internal class SearchCommandHelper
2525
{
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-
4926
/// <summary>
5027
/// Populate and validate SavedSearch.Properties.Tags from a Hashtable of tags specified in the cmdlet.
5128
/// </summary>
@@ -57,7 +34,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
5734
return null;
5835
}
5936

60-
bool hasGroupTag = false;
6137
string groupKey = null;
6238
IList<Tag> tagList = new List<Tag>();
6339

@@ -69,7 +45,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
6945

7046
if (key.Equals("group", System.StringComparison.InvariantCultureIgnoreCase))
7147
{
72-
hasGroupTag = true;
7348
groupKey = key;
7449
}
7550
}
@@ -79,16 +54,6 @@ public static IList<Tag> PopulateAndValidateTagsForProperties(Hashtable tags, st
7954
}
8055
}
8156

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-
9257
return tagList;
9358
}
9459
}

0 commit comments

Comments
 (0)