Charles-Edouard Brétéché
d79d4a514f
fix: add more jp unit tests and check for out of bounds argument ( #6230 )
...
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-06 11:39:53 +00:00
Charles-Edouard Brétéché
83c188dd5e
fix: jp divide quantities ( #6229 )
...
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-06 10:21:30 +00:00
Charles-Edouard Brétéché
417b2a9eba
chore: add a few unit tests for jp functions ( #6219 )
...
* chore: add a few unit tests for jp functions
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* refactor
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
---------
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-02-06 06:27:27 +00:00
Charles-Edouard Brétéché
376378fd09
test: add a couple unit tests ( #6202 )
...
* test: add a couple unit tests
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* more
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
---------
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-03 05:37:31 +00:00
Charles-Edouard Brétéché
8f2f263694
fix: jp items function ( #6196 )
...
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-02 13:19:35 +00:00
Charles-Edouard Brétéché
7540daa906
feat: support arrays in jp items() function ( #6180 )
2023-02-01 05:43:58 +00:00
Charles-Edouard Brétéché
91f2622384
feat: add more time jmespath filters ( #5950 )
...
* feat: add more time jmespath filters
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* add time_utc and time_now_utc
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* add time_diff
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* more time filters
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* Update pkg/engine/jmespath/functions.go
Signed-off-by: shuting <shutting06@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-01-10 04:40:46 +00:00
Vishal Choudhary
837f474969
Fixes time_now
failing ( #5928 )
...
* fixes time_now
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* testing
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* simplified
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
2023-01-09 15:16:43 +01:00
Vishal Choudhary
bb6005a7a3
Added a time_add() filter to add duration and absolute time ( #5817 )
...
* time_add
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* output is RFC3339 only now
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* added note to timeadd
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* added time_convert
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* removed blank string timezone
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* renamed to time_parse
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-01-06 16:48:13 +00:00
Vishal Choudhary
e9d2c00c16
Adds JMESPath filter for returning cron expression for absolute time ( #5814 )
...
* time_to_cron
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* tests
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* Update pkg/engine/jmespath/functions.go
Signed-off-by: shuting <shutting06@gmail.com>
* fix linter
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: shuting <shutting06@gmail.com>
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-01-06 07:27:57 +00:00
Vishal Choudhary
8572d53cc9
Adds JMESPath filter for returning current time ( #5813 )
...
* time_current
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* name change
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* added note
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-01-02 15:35:01 +01:00
Vishal Choudhary
6516e921fc
Adds notes to functions ( #5824 )
...
* added notes
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* changes stated in chart.yaml
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
* undo
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
2023-01-02 09:00:25 +01:00
Jim Bugwadia
9d3b176def
Nested foreach ( #5589 )
...
* updated foreach logic and added tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* uncomment tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix vars and unit tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix vars and unit tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix some tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix more tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* format
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* make codegen
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* linter
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* cleanup
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix linter issue
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* revert local launch
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* propagate context
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* uncomment tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix propagation of registry client
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-12-12 15:20:20 +00:00
Charles-Edouard Brétéché
d9272d9b93
refactor: jmespath arithmetic operations ( #5544 )
...
* refactor: add and subtract jmespath operations
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix tests
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix tests
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix multiply
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* divide
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* fix
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
* modulo
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-12-05 11:15:32 +00:00
Vishal Choudhary
44763cf61b
Fix: Typo in x509_decode JMESPath function's note ( #4773 )
...
* changed 'json' to 'an object'
* changed 'json' to 'an object'
sign: Vishal Choudhary <contactvishaltech@gmail.com>
* changed 'json' to 'an object'
* changed 'json' to 'an object'
sign: Vishal Choudhary <contactvishaltech@gmail.com>
Signed-off-by: Vishal Choudhary <contactvishaltech@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-10-03 08:26:19 +00:00
Abhinav Sinha
a1182859ad
Added x509_decode
JMESPath function ( #4664 )
...
* Added `x509_decode` JMESPath function
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Use `crypto/x509` stdlib
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Return result as `map[string]interface{}`
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Made minor fixes
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Fixed error with unmarshalling decoded certificate
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Added e2e test for decoding X.509 certs
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Reverted to using `smallstep/zcrypto` for X.509
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Minor fix
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Addressed reviews
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
* Removed redundant dependency on `pkg/errors`
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-09-28 18:15:39 +00:00
Charles-Edouard Brétéché
6a8085522a
fix: jmespath random error handling ( #4697 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-09-26 13:33:52 +00:00
Anurag
cadf577e4b
enhance jmespath random-filter ( #4591 )
...
Signed-off-by: Anurag <contact.anurag7@gmail.com>
Signed-off-by: Anurag <contact.anurag7@gmail.com>
2022-09-14 06:27:32 +00:00
Anurag
560cec329e
add random filter ( #4527 )
...
* add random filter
Signed-off-by: Anurag <contact.anurag7@gmail.com>
* update go.mod file
Signed-off-by: Anurag <contact.anurag7@gmail.com>
* update go.sum
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* linter fix
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: Anurag <contact.anurag7@gmail.com>
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: ShutingZhao <shuting@nirmata.com>
2022-09-07 16:22:30 +00:00
Charles-Edouard Brétéché
fc1a4601a7
refactor: introduce wildcard utils package ( #4406 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-08-25 05:23:01 +00:00
Charles-Edouard Brétéché
0099ef54ad
chore: enable gofmt and gofumpt linters ( #3931 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 06:19:03 +00:00
Anurag
e8b1e1275a
fix: return type changed to bool in jpfCompare fn ( #3924 )
...
* return type changed to bool in jpfCompare fn
Signed-off-by: Anurag <contact.anurag7@gmail.com>
* update functions.go
Signed-off-by: Anurag <contact.anurag7@gmail.com>
* updated the commit
Signed-off-by: Anurag <contact.anurag7@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-16 21:11:43 +00:00
Charles-Edouard Brétéché
97e5e64fd4
chore: enable whitespace linter ( #3864 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-10 17:01:29 +00:00
Sambhav Kothari
c3604c1170
Add an object_from_lists function ( #3824 )
2022-05-07 12:05:04 +00:00
gsweene2
af51ceb4ff
Add JMESPath Function items
( #3777 )
...
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-04 10:33:24 +00:00
Soumya Singh
84aa2e3fbb
Add returnType for regexMatch in kyverno jp output ( #3575 )
...
Signed-off-by: tend2infinity <somu12.ss@gmail.coom>
Co-authored-by: tend2infinity <somu12.ss@gmail.coom>
2022-04-11 08:34:14 +01:00
shuting
d1bf3d4742
clean up dependencies ( #3469 )
...
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-03-25 08:40:25 +00:00
Sambhav Kothari
4445780c7c
Add a kyverno jp command to test jmespath expressions ( #3169 )
...
* Add a kyverno jp command to test jmespath expressions
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
* Auto-generate custom function docs
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-02-04 05:23:12 +00:00
Abhinav Sinha
7a55d26d89
Fixed kyverno panic at JMESPath zero division ( #3137 )
...
Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-31 17:45:20 +00:00
Kumar Mallikarjuna
4124e0f682
Update division for same units ( #3038 )
...
Signed-off-by: Kumar Mallikarjuna <kumar@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>
2022-01-21 11:06:08 +00:00
Sambhav Kothari
f5e00ee034
Add a parse_yaml function ( #2999 )
...
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
2022-01-17 13:41:08 +00:00
Sambhav Kothari
baf4fa335b
Remove spurious prints and fix line endings ( #2963 )
...
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-11 14:15:26 +00:00
Sambhav Kothari
6b9798f76f
Add parse_json function the decode json strings ( #2941 )
...
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-10 13:42:02 -08:00
Naman Lakhwani
898520b7cf
add semver_compare
JMESPath function ( #2846 )
...
* add semver_compare JMESPath function
Signed-off-by: Namanl2001 <namanlakhwani@gmail.com>
* adding tests for semver_compare
Signed-off-by: Namanl2001 <namanlakhwani@gmail.com>
* enabling version compaision via regular operators
Signed-off-by: Namanl2001 <namanlakhwani@gmail.com>
* adding tests for version compaision via regular operators
Signed-off-by: Namanl2001 <namanlakhwani@gmail.com>
* removing unnecessary switch cases
Signed-off-by: Namanl2001 <namanlakhwani@gmail.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2021-12-21 08:12:35 -08:00
Danny Kulchinsky
ff99d92f80
jmespath truncate - handle negative input value ( #2856 )
...
Signed-off-by: Danny Kulchinsky <dkulchinsky@fastly.com>
2021-12-20 06:50:46 +00:00
Danny Kulchinsky
f6982760fc
truncate custom jmespath function ( #2836 )
...
* [feature] custom jmespath truncate function
Signed-off-by: Danny Kulchinsky <dkulchinsky@fastly.com>
* formatting
Signed-off-by: Danny Kulchinsky <dkulchinsky@fastly.com>
* simplify naming a bit
Signed-off-by: Danny Kulchinsky <dkulchinsky@fastly.com>
Co-authored-by: shuting <shutting06@gmail.com>
2021-12-17 15:52:52 +08:00
Danny__Wei
8da64cb5cf
fix: add Windows testcases for path_canonicalize ( #2803 )
...
Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>
Co-authored-by: weiwei.danny <weiwei.danny@bytedance.com>
Co-authored-by: Bricktop <marcel.mueller1@rwth-aachen.de>
2021-12-08 15:14:49 +00:00
Kumar Mallikarjuna
a667a69812
JMESPath arithmetic function units ( #2753 )
...
* MAS arithmetic functions
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Adding Divide() and Modulo()
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Added tests
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Tidy go.mod
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Fix lift issues
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Set division scale to maximum of operands
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Precision for Add()/Subtract()
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Set duration precision
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Added comment for duration diff calculation
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
Co-authored-by: Bricktop <marcel.mueller1@rwth-aachen.de>
2021-12-07 15:44:46 +00:00
Danny__Wei
beeec06c7f
Add path_canonicalize
custom JMESPath function ( #2787 )
...
* Add path_canonicalize custom JMESPath function
Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>
* Add CLI test for the custom path_canonicalize function
Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>
* remove the extra parameter
Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>
Co-authored-by: weiwei.danny <weiwei.danny@bytedance.com>
2021-12-06 12:10:34 +01:00
Sebastian Widmer
4c251bcffd
Add pattern_match
custom JMESPath function analogous to regex_match
( #2717 )
...
* Add `pattern_match` custom JMESPath function analogous to `regex_match`
Signed-off-by: Sebastian Widmer <sebastian.widmer@vshn.net>
* Add CLI test for the custom `pattern_match` function
Signed-off-by: Sebastian Widmer <sebastian.widmer@vshn.net>
2021-11-30 00:13:07 +08:00
Kumar Mallikarjuna
7f95bee23c
Added time_since() custom JMESPath function ( #2680 )
...
* Added time_since() custom JMESPath function
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Remove time.Layout (not supported in Go 1.16)
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Modify time_since() for 3 arguments
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Add tests for functions_test.go
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Timestamp literals and tabulated tests
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Remove layout map and default to RFC3339
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-11-17 21:17:17 +01:00
Bricktop
f42144b929
Improve consistency in jmesPath functions test file ( #2640 )
...
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-29 14:45:03 -07:00
Kumar Mallikarjuna
f74f7c841a
Change split return from []string to []interface{} ( #2604 )
...
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-10-28 22:56:18 -07:00
Marcus Noble
d69b81e03e
added base64 jmespath functions ( #2542 )
...
* added base64 jmespath functions
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* added base64_decode test to emulate working with secret
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Update regex to allow number in func name
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Added CLI tests for preconditions and custom funcs
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
Co-authored-by: AverageMarcus <git@marcusnoble.co.uk>
Co-authored-by: Bricktop <marcel.mueller1@rwth-aachen.de>
2021-10-14 11:46:06 -07:00
Bricktop
d62234d776
Fix remaining static check findings ( #2541 )
...
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-13 16:00:41 -07:00
Kumar Mallikarjuna
0616429267
JMESPath: Arithmetic Operators ( #2416 )
...
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-09-22 14:40:45 -07:00
Max Goncharenko
2a375fa1b5
Remove contains function ( #2346 )
...
* remove contains function
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
* added test for contains issue case
Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-09-08 12:33:41 -07:00
Thoro
e80d18e692
Add function label_match, to use matchLabel in JMESPath, usage: label_match(labels_from_network_policy, labels_from pod) bool, Remove validation for JMESPath ( #1862 )
...
Signed-off-by: Thomas Rosenstein <thomas@thoro.at>
2021-05-04 09:28:30 -07:00
Max Goncharenko
6a0305674a
JMESPath custom functions ( #1772 )
...
* JMESPath: Support regex expressions
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* JMESPath: Add string functions
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* Removed {{$}} variable handling logic
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* Name all functions in snake case; Update error message; Fix {{@}} behavior
Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-16 16:17:00 -07:00