Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected List<ResourceGroupSelector> buildSelectors(ManagerSpec managerSpec)
spec.getSourceRegex(),
spec.getClientTags(),
spec.getResourceEstimate(),
spec.getQueryText(),
spec.getQueryTextRegex(),
spec.getQueryType(),
spec.getGroup()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class SelectorSpec
private final Optional<Pattern> originalUserRegex;
private final Optional<Pattern> authenticatedUserRegex;
private final Optional<Pattern> sourceRegex;
private final Optional<Pattern> queryText;
private final Optional<Pattern> queryTextRegex;
private final Optional<String> queryType;
private final Optional<List<String>> clientTags;
private final Optional<SelectorResourceEstimate> selectorResourceEstimate;
Expand All @@ -44,7 +44,7 @@ public SelectorSpec(
@JsonProperty("originalUser") Optional<Pattern> originalUserRegex,
@JsonProperty("authenticatedUser") Optional<Pattern> authenticatedUserRegex,
@JsonProperty("source") Optional<Pattern> sourceRegex,
@JsonProperty("queryText") Optional<Pattern> queryText,
@JsonProperty("queryText") Optional<Pattern> queryTextRegex,
@JsonProperty("queryType") Optional<String> queryType,
@JsonProperty("clientTags") Optional<List<String>> clientTags,
@JsonProperty("selectorResourceEstimate") Optional<SelectorResourceEstimate> selectorResourceEstimate,
Expand All @@ -55,7 +55,7 @@ public SelectorSpec(
this.originalUserRegex = requireNonNull(originalUserRegex, "originalUserRegex is null");
this.authenticatedUserRegex = requireNonNull(authenticatedUserRegex, "authenticatedUserRegex is null");
this.sourceRegex = requireNonNull(sourceRegex, "sourceRegex is null");
this.queryText = requireNonNull(queryText, "queryText is null");
this.queryTextRegex = requireNonNull(queryTextRegex, "queryTextRegex is null");
this.queryType = requireNonNull(queryType, "queryType is null");
this.clientTags = requireNonNull(clientTags, "clientTags is null");
this.selectorResourceEstimate = requireNonNull(selectorResourceEstimate, "selectorResourceEstimate is null");
Expand Down Expand Up @@ -87,9 +87,9 @@ public Optional<Pattern> getSourceRegex()
return sourceRegex;
}

public Optional<Pattern> getQueryText()
public Optional<Pattern> getQueryTextRegex()
{
return queryText;
return queryTextRegex;
}

public Optional<String> getQueryType()
Expand Down Expand Up @@ -132,8 +132,8 @@ public boolean equals(Object other)
authenticatedUserRegex.map(Pattern::flags).equals(that.authenticatedUserRegex.map(Pattern::flags)) &&
sourceRegex.map(Pattern::pattern).equals(that.sourceRegex.map(Pattern::pattern))) &&
sourceRegex.map(Pattern::flags).equals(that.sourceRegex.map(Pattern::flags)) &&
queryText.map(Pattern::pattern).equals(that.queryText.map(Pattern::pattern)) &&
queryText.map(Pattern::flags).equals(that.queryText.map(Pattern::flags)) &&
queryTextRegex.map(Pattern::pattern).equals(that.queryTextRegex.map(Pattern::pattern)) &&
queryTextRegex.map(Pattern::flags).equals(that.queryTextRegex.map(Pattern::flags)) &&
queryType.equals(that.queryType) &&
clientTags.equals(that.clientTags);
}
Expand All @@ -153,8 +153,8 @@ public int hashCode()
authenticatedUserRegex.map(Pattern::flags),
sourceRegex.map(Pattern::pattern),
sourceRegex.map(Pattern::flags),
queryText.map(Pattern::pattern),
queryText.map(Pattern::flags),
queryTextRegex.map(Pattern::pattern),
queryTextRegex.map(Pattern::flags),
queryType,
clientTags);
}
Expand All @@ -174,8 +174,8 @@ public String toString()
.add("authenticatedUserFlags", authenticatedUserRegex.map(Pattern::flags))
.add("sourceRegex", sourceRegex)
.add("sourceFlags", sourceRegex.map(Pattern::flags))
.add("queryTextRegex", queryText)
.add("queryTextFlags", queryText.map(Pattern::flags))
.add("queryTextRegex", queryTextRegex)
.add("queryTextFlags", queryTextRegex.map(Pattern::flags))
.add("queryType", queryType)
.add("clientTags", clientTags)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public void testSelectorResourceEstimate()
}

@Test
public void testQueryText()
public void testQueryTextRegex()
{
ResourceGroupId resourceGroupId = new ResourceGroupId(new ResourceGroupId("global"), "foo");
{
Expand Down Expand Up @@ -366,9 +366,9 @@ public void testQueryText()
}
}

private SelectionCriteria newSelectionCriteriaQueryText(String user, String queryText)
private SelectionCriteria newSelectionCriteriaQueryText(String user, String queryTextRegex)
{
return new SelectionCriteria(true, user, ImmutableSet.of(), user, Optional.empty(), Optional.empty(), Set.of(), EMPTY_RESOURCE_ESTIMATES, queryText, Optional.empty());
return new SelectionCriteria(true, user, ImmutableSet.of(), user, Optional.empty(), Optional.empty(), Set.of(), EMPTY_RESOURCE_ESTIMATES, queryTextRegex, Optional.empty());
}

private SelectionCriteria newSelectionCriteria(String user, String source, Set<String> tags, ResourceEstimates resourceEstimates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public SelectorSpecBuilder users(String... users)
spec.getOriginalUserRegex(),
spec.getAuthenticatedUserRegex(),
spec.getSourceRegex(),
spec.getQueryText(),
spec.getQueryTextRegex(),
spec.getQueryType(),
spec.getClientTags(),
spec.getResourceEstimate(),
Expand All @@ -127,7 +127,7 @@ public SelectorSpecBuilder userGroups(String... groups)
spec.getOriginalUserRegex(),
spec.getAuthenticatedUserRegex(),
spec.getSourceRegex(),
spec.getQueryText(),
spec.getQueryTextRegex(),
spec.getQueryType(),
spec.getClientTags(),
spec.getResourceEstimate(),
Expand All @@ -143,7 +143,7 @@ public SelectorSpecBuilder originalUserPattern(String originalUserPattern)
Optional.of(Pattern.compile(originalUserPattern)),
spec.getAuthenticatedUserRegex(),
spec.getSourceRegex(),
spec.getQueryText(),
spec.getQueryTextRegex(),
spec.getQueryType(),
spec.getClientTags(),
spec.getResourceEstimate(),
Expand All @@ -159,7 +159,7 @@ public SelectorSpecBuilder authenticatedUserPattern(String authenticatedUserPatt
spec.getOriginalUserRegex(),
Optional.of(Pattern.compile(authenticatedUserPattern)),
spec.getSourceRegex(),
spec.getQueryText(),
spec.getQueryTextRegex(),
spec.getQueryType(),
spec.getClientTags(),
spec.getResourceEstimate(),
Expand Down