Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Add support for any, all and not ODATA operators #327

Merged
1 commit merged into from
Jul 28, 2023
Merged

Add support for any, all and not ODATA operators #327

1 commit merged into from
Jul 28, 2023

Conversation

ghost
Copy link

@ghost ghost commented May 30, 2023

Description

The any() lamdba operator can be used like:

GET api/Targets?$filter=findingInfo/tags/any(t: t/Key eq 'Name' and t/Value eq 'vmclarity-server')

This will return all Targets with at least one tag which has Key Name and the Value vmclarity-server.

The all lamba operator can be used like:

GET api/Targets?$filter=findingInfo/securityGroups/all(g: g/id eq 'sg1' or g/id eq 'sg2')

This will return Targets which are only in the security groups sg1 and sg2, no other security groups.

The not operator can be used like:

GET api/Targets?$filter=not(startswith(location, 'us-east-2'))

This will return all Targets which do not have a location which starts with us-east-2.

Type of Change

[ ] Bug Fix
[X] New Feature
[ ] Breaking Change
[ ] Refactor
[ ] Documentation
[ ] Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@ghost ghost self-requested a review as a code owner May 30, 2023 15:20
akpsgit
akpsgit previously approved these changes Jul 27, 2023
@ghost ghost enabled auto-merge July 28, 2023 10:04
The any() lamdba operator can be used like:

    GET api/Targets?$filter=findingInfo/tags/any(t: t/Key eq 'Name' and t/Value eq 'vmclarity-server')

This will return all Targets with at least one tag which has Key Name
and the Value vmclarity-server.

The all lamba operator can be used like:

    GET api/Targets?$filter=findingInfo/securityGroups/all(g: g/id eq 'sg1' or g/id eq 'sg2')

This will return Targets which are only in the security groups sg1 and
sg2, no other security groups.

The not operator can be used like:

    GET api/Targets?$filter=not(startswith(location, 'us-east-2'))

This will return all Targets which do not have a location which starts
with us-east-2.
@ghost ghost added this pull request to the merge queue Jul 28, 2023
Merged via the queue into main with commit 76b9e47 Jul 28, 2023
5 checks passed
@ghost ghost deleted the odata_any_all branch July 28, 2023 13:15
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants