Skip to content

Commit

Permalink
Merge pull request #145 from OpsLevel/kr/bugfix-for-filters
Browse files Browse the repository at this point in the history
Kr/bugfix for filters
  • Loading branch information
rocktavious authored Nov 3, 2023
2 parents 8941154 + e9bb7c6 commit 472e1eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changes/unreleased/Bugfix-20231103-140018.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: Bugfix
body: Fix bug with case sensitive field on filter predicates being sent always when
it should only be when specified
time: 2023-11-03T14:00:18.562892-05:00
9 changes: 6 additions & 3 deletions opslevel/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,16 @@ func expandFilterPredicates(d *schema.ResourceData) []opslevel.FilterPredicate {
output := make([]opslevel.FilterPredicate, 0)
for _, item := range d.Get("predicate").([]interface{}) {
data := item.(map[string]interface{})
output = append(output, opslevel.FilterPredicate{
predicate := opslevel.FilterPredicate{
Type: opslevel.PredicateTypeEnum(data["type"].(string)),
Value: strings.TrimSpace(data["value"].(string)),
Key: opslevel.PredicateKeyEnum(data["key"].(string)),
KeyData: strings.TrimSpace(data["key_data"].(string)),
CaseSensitive: opslevel.Bool(data["case_sensitive"].(bool)),
})
}
if caseSensitive, ok := d.GetOk("case_sensitive"); ok {
predicate.CaseSensitive = opslevel.Bool(caseSensitive.(bool))
}
output = append(output, predicate)
}
return output
}
Expand Down

0 comments on commit 472e1eb

Please sign in to comment.