Skip to content

Commit

Permalink
Undo unnecessary change.
Browse files Browse the repository at this point in the history
  • Loading branch information
gigerdo committed Mar 14, 2024
1 parent 8926e04 commit 9652d19
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
40 changes: 19 additions & 21 deletions ec/ecdatasource/deploymentsdatasource/expanders.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,25 @@ func expandFilters(ctx context.Context, state modelV0) (*models.SearchRequest, d
})
}

if !state.Tags.IsNull() {
var tags = make(map[string]string)
tmp := state.Tags.ElementsAs(ctx, &tags, false)
diags.Append(tmp...)
if diags.HasError() {
return nil, diags
}
var tagQueries []*models.QueryContainer
for key, value := range tags {
tagQueries = append(tagQueries,
newNestedTagQuery(key, value),
)
}
if len(tagQueries) > 0 {
queries = append(queries, &models.QueryContainer{
Bool: &models.BoolQuery{
MinimumShouldMatch: int32(len(tags)),
Should: tagQueries,
},
})
}
var tags = make(map[string]string)
tmp := state.Tags.ElementsAs(ctx, &tags, false)
diags.Append(tmp...)
if diags.HasError() {
return nil, diags
}
var tagQueries []*models.QueryContainer
for key, value := range tags {
tagQueries = append(tagQueries,
newNestedTagQuery(key, value),
)
}
if len(tagQueries) > 0 {
queries = append(queries, &models.QueryContainer{
Bool: &models.BoolQuery{
MinimumShouldMatch: int32(len(tags)),
Should: tagQueries,
},
})
}

type resourceFilter struct {
Expand Down
1 change: 1 addition & 0 deletions ec/ecdatasource/deploymentsdatasource/expanders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func Test_expandFilters(t *testing.T) {
args: args{
state: modelV0{
Name: types.StringValue("test"),
Tags: types.MapNull(types.StringType),
},
},
want: &models.SearchRequest{
Expand Down

0 comments on commit 9652d19

Please sign in to comment.