diff --git a/go.mod b/go.mod index eeb168723..0f00cbaa8 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-logr/logr v1.4.2 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/hashicorp/go-getter v1.7.6 - github.com/jmespath-community/go-jmespath v1.1.2-0.20240627155901-bdbb290f571e + github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a github.com/jstemmer/go-junit-report/v2 v2.1.0 github.com/kudobuilder/kuttl v0.19.0 github.com/kyverno/kyverno-json v0.0.4-0.20240730143747-aade3d42fc0e diff --git a/go.sum b/go.sum index 9399bc535..003c8bed8 100644 --- a/go.sum +++ b/go.sum @@ -450,8 +450,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jmespath-community/go-jmespath v1.1.2-0.20240627155901-bdbb290f571e h1:e9zkuKm+DRAW1xGu90nokWkxOAWhOPYkMNojmTmtvPE= -github.com/jmespath-community/go-jmespath v1.1.2-0.20240627155901-bdbb290f571e/go.mod h1:YlGIjNhh2pH+qyifSpVtQQIbI8YUoVytgZyKBVAMVX4= +github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a h1:baQnVszUF+wENqBnqJDlgmSIBpJLMqQE0i+hICMZ9sI= +github.com/jmespath-community/go-jmespath v1.1.2-0.20240919193755-5e4e8ae73c8a/go.mod h1:VL6C6nwf/wRivvXAjziX9yFRVmvOC1qzERc8RTQ0tv4= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/website/docs/reference/jp/examples/abs.md b/website/docs/reference/jp/examples/abs.md new file mode 100644 index 000000000..3227cf882 --- /dev/null +++ b/website/docs/reference/jp/examples/abs.md @@ -0,0 +1,15 @@ +# abs + +## Signature + +`abs(number)` + +## Description + +Returns the absolute value of the provided argument. + +## Examples + +``` +abs(`-1`) == `1` +``` diff --git a/website/docs/reference/jp/examples/add.md b/website/docs/reference/jp/examples/add.md new file mode 100644 index 000000000..ff56d6c9a --- /dev/null +++ b/website/docs/reference/jp/examples/add.md @@ -0,0 +1,13 @@ +# add + +## Signature + +`add(any, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/as_string.md b/website/docs/reference/jp/examples/as_string.md new file mode 100644 index 000000000..1c1e3af73 --- /dev/null +++ b/website/docs/reference/jp/examples/as_string.md @@ -0,0 +1,13 @@ +# as_string + +## Signature + +`as_string(any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/at.md b/website/docs/reference/jp/examples/at.md new file mode 100644 index 000000000..0ab0e8750 --- /dev/null +++ b/website/docs/reference/jp/examples/at.md @@ -0,0 +1,13 @@ +# at + +## Signature + +`at(array, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/avg.md b/website/docs/reference/jp/examples/avg.md new file mode 100644 index 000000000..d0f8ec081 --- /dev/null +++ b/website/docs/reference/jp/examples/avg.md @@ -0,0 +1,15 @@ +# avg + +## Signature + +`avg(array[number])` + +## Description + +Returns the average of the elements in the provided array. An empty array will produce a return value of null. + +## Examples + +``` +avg([`10`,`15`,`20`]) == `15` +``` \ No newline at end of file diff --git a/website/docs/reference/jp/examples/base64_decode.md b/website/docs/reference/jp/examples/base64_decode.md new file mode 100644 index 000000000..8be8c474f --- /dev/null +++ b/website/docs/reference/jp/examples/base64_decode.md @@ -0,0 +1,13 @@ +# base64_decode + +## Signature + +`base64_decode(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/base64_encode.md b/website/docs/reference/jp/examples/base64_encode.md new file mode 100644 index 000000000..fc607a763 --- /dev/null +++ b/website/docs/reference/jp/examples/base64_encode.md @@ -0,0 +1,13 @@ +# base64_encode + +## Signature + +`base64_encode(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/ceil.md b/website/docs/reference/jp/examples/ceil.md new file mode 100644 index 000000000..c97589876 --- /dev/null +++ b/website/docs/reference/jp/examples/ceil.md @@ -0,0 +1,15 @@ +# ceil + +## Signature + +`ceil(number)` + +## Description + +Returns the next highest integer value by rounding up if necessary. + +## Examples + +``` +ceil(`1.9`) == `2` +``` diff --git a/website/docs/reference/jp/examples/compare.md b/website/docs/reference/jp/examples/compare.md new file mode 100644 index 000000000..875b63e4b --- /dev/null +++ b/website/docs/reference/jp/examples/compare.md @@ -0,0 +1,13 @@ +# compare + +## Signature + +`compare(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/concat.md b/website/docs/reference/jp/examples/concat.md new file mode 100644 index 000000000..ac4036ef4 --- /dev/null +++ b/website/docs/reference/jp/examples/concat.md @@ -0,0 +1,13 @@ +# concat + +## Signature + +`concat(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/contains.md b/website/docs/reference/jp/examples/contains.md new file mode 100644 index 000000000..1626abe4f --- /dev/null +++ b/website/docs/reference/jp/examples/contains.md @@ -0,0 +1,32 @@ +# contains + +## Signature + +`contains(array|string, any)` + +## Description + +Returns `true` if the given subject contains the provided search value. If the subject is an array, this function returns `true` if one of the elements in the array is equal to the provided search value. If the provided subject is a string, this function returns `true` if the string contains the provided search argument. + +## Examples + +### With strings + +``` +contains('foobar', 'bar') == true +``` + +``` +contains('foobar', 'not') == false +``` + +### With arrays + + +``` +contains(['foo', 'bar'], 'bar') == true +``` + +``` +contains(['foo', 'bar'], 'not') == true +``` diff --git a/website/docs/reference/jp/examples/divide.md b/website/docs/reference/jp/examples/divide.md new file mode 100644 index 000000000..52efaea69 --- /dev/null +++ b/website/docs/reference/jp/examples/divide.md @@ -0,0 +1,13 @@ +# divide + +## Signature + +`divide(any, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/ends_with.md b/website/docs/reference/jp/examples/ends_with.md new file mode 100644 index 000000000..4c409faa6 --- /dev/null +++ b/website/docs/reference/jp/examples/ends_with.md @@ -0,0 +1,19 @@ +# ends_with + +## Signature + +`ends_with(string, string)` + +## Description + +Reports whether the given string ends with the provided suffix argument. + +## Examples + +``` +ends_with('foobar', 'bar') == true +``` + +``` +ends_with('foobar', 'foo') == false +``` diff --git a/website/docs/reference/jp/examples/env.md b/website/docs/reference/jp/examples/env.md new file mode 100644 index 000000000..e4d6f7130 --- /dev/null +++ b/website/docs/reference/jp/examples/env.md @@ -0,0 +1,13 @@ +# env + +## Signature + +`env(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/equal_fold.md b/website/docs/reference/jp/examples/equal_fold.md new file mode 100644 index 000000000..4433057ef --- /dev/null +++ b/website/docs/reference/jp/examples/equal_fold.md @@ -0,0 +1,13 @@ +# equal_fold + +## Signature + +`equal_fold(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/find_first.md b/website/docs/reference/jp/examples/find_first.md new file mode 100644 index 000000000..64581b440 --- /dev/null +++ b/website/docs/reference/jp/examples/find_first.md @@ -0,0 +1,31 @@ +# find_first + +## Signature + +`find_first(string, string, number, number)` + +## Description + + + +## Examples + +``` +find_first('subject string', 'string', `0`) == `8` +``` + +``` +find_first('subject string', 'string', `8`) == `8` +``` + +``` +find_first('subject string', 'string', `9`) == null +``` + +``` +find_first('subject string', 'string', `0`, `14`) == `8` +``` + +``` +find_first('subject string', 'string', `0`, `13`) == null +``` diff --git a/website/docs/reference/jp/examples/find_last.md b/website/docs/reference/jp/examples/find_last.md new file mode 100644 index 000000000..e1e4ec33b --- /dev/null +++ b/website/docs/reference/jp/examples/find_last.md @@ -0,0 +1,31 @@ +# find_last + +## Signature + +`find_last(string, string, number, number)` + +## Description + + + +## Examples + +``` +find_last('subject string', 'string', `0`) == `8` +``` + +``` +find_last('subject string', 'string', `8`) == `8` +``` + +``` +find_last('subject string', 'string', `9`) == null +``` + +``` +find_last('subject string', 'string', `0`, `14`) == `8` +``` + +``` +find_last('subject string', 'string', `0`, `13`) == null +``` diff --git a/website/docs/reference/jp/examples/floor.md b/website/docs/reference/jp/examples/floor.md new file mode 100644 index 000000000..b2e1f6851 --- /dev/null +++ b/website/docs/reference/jp/examples/floor.md @@ -0,0 +1,15 @@ +# floor + +## Signature + +`floor(number)` + +## Description + +Returns the next lowest integer value by rounding down if necessary. + +## Examples + +``` +floor(`1.9`) == `1` +``` diff --git a/website/docs/reference/jp/examples/from_items.md b/website/docs/reference/jp/examples/from_items.md new file mode 100644 index 000000000..9f6dc3d0c --- /dev/null +++ b/website/docs/reference/jp/examples/from_items.md @@ -0,0 +1,13 @@ +# from_items + +## Signature + +`from_items(array[array])` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/group_by.md b/website/docs/reference/jp/examples/group_by.md new file mode 100644 index 000000000..e1691afbd --- /dev/null +++ b/website/docs/reference/jp/examples/group_by.md @@ -0,0 +1,13 @@ +# group_by + +## Signature + +`group_by(array, expref)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/items.md b/website/docs/reference/jp/examples/items.md new file mode 100644 index 000000000..45479f4f0 --- /dev/null +++ b/website/docs/reference/jp/examples/items.md @@ -0,0 +1,13 @@ +# items + +## Signature + +`items(object|array, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/join.md b/website/docs/reference/jp/examples/join.md new file mode 100644 index 000000000..c8f117b29 --- /dev/null +++ b/website/docs/reference/jp/examples/join.md @@ -0,0 +1,13 @@ +# join + +## Signature + +`join(string, array[string])` + +## Description + +Returns all of the elements from the provided array joined together using the glue argument as a separator between each. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/json_parse.md b/website/docs/reference/jp/examples/json_parse.md new file mode 100644 index 000000000..2bb6acae0 --- /dev/null +++ b/website/docs/reference/jp/examples/json_parse.md @@ -0,0 +1,13 @@ +# json_parse + +## Signature + +`json_parse(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/keys.md b/website/docs/reference/jp/examples/keys.md new file mode 100644 index 000000000..9abc0ab32 --- /dev/null +++ b/website/docs/reference/jp/examples/keys.md @@ -0,0 +1,13 @@ +# keys + +## Signature + +`keys(object)` + +## Description + +Returns an array containing the keys of the provided object. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/label_match.md b/website/docs/reference/jp/examples/label_match.md new file mode 100644 index 000000000..7dd95d82a --- /dev/null +++ b/website/docs/reference/jp/examples/label_match.md @@ -0,0 +1,13 @@ +# label_match + +## Signature + +`label_match(object, object)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/length.md b/website/docs/reference/jp/examples/length.md new file mode 100644 index 000000000..d1adc43e9 --- /dev/null +++ b/website/docs/reference/jp/examples/length.md @@ -0,0 +1,13 @@ +# length + +## Signature + +`length(string|array|object)` + +## Description + +Returns the length of the given argument. If the argument is a string this function returns the number of code points in the string. If the argument is an array this function returns the number of elements in the array. If the argument is an object this function returns the number of key-value pairs in the object. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/lookup.md b/website/docs/reference/jp/examples/lookup.md new file mode 100644 index 000000000..dfa7ed0fb --- /dev/null +++ b/website/docs/reference/jp/examples/lookup.md @@ -0,0 +1,13 @@ +# lookup + +## Signature + +`lookup(object|array, string|number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/lower.md b/website/docs/reference/jp/examples/lower.md new file mode 100644 index 000000000..34d9547fa --- /dev/null +++ b/website/docs/reference/jp/examples/lower.md @@ -0,0 +1,13 @@ +# lower + +## Signature + +`lower(string)` + +## Description + +Returns the given string with all Unicode letters mapped to their lower case. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/map.md b/website/docs/reference/jp/examples/map.md new file mode 100644 index 000000000..52c115924 --- /dev/null +++ b/website/docs/reference/jp/examples/map.md @@ -0,0 +1,13 @@ +# map + +## Signature + +`map(expref, array)` + +## Description + +Transforms elements in a given array and returns the result. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/max.md b/website/docs/reference/jp/examples/max.md new file mode 100644 index 000000000..95c7db8ed --- /dev/null +++ b/website/docs/reference/jp/examples/max.md @@ -0,0 +1,13 @@ +# max + +## Signature + +`max(array[number]|array[string])` + +## Description + +Returns the highest found element in the provided array argument. An empty array will produce a return value of null. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/max_by.md b/website/docs/reference/jp/examples/max_by.md new file mode 100644 index 000000000..670b8ccb2 --- /dev/null +++ b/website/docs/reference/jp/examples/max_by.md @@ -0,0 +1,13 @@ +# max_by + +## Signature + +`max_by(array, expref)` + +## Description + +Returns the highest found element using a custom expression to compute the associated value for each element in the input array. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/merge.md b/website/docs/reference/jp/examples/merge.md new file mode 100644 index 000000000..7f4dc959a --- /dev/null +++ b/website/docs/reference/jp/examples/merge.md @@ -0,0 +1,13 @@ +# merge + +## Signature + +`merge(object)` + +## Description + +Meges a list of objects together and returns the result. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/min.md b/website/docs/reference/jp/examples/min.md new file mode 100644 index 000000000..6385f0d57 --- /dev/null +++ b/website/docs/reference/jp/examples/min.md @@ -0,0 +1,13 @@ +# min + +## Signature + +`min(array[number]|array[string])` + +## Description + +Returns the lowest found element in the provided array argument. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/min_by.md b/website/docs/reference/jp/examples/min_by.md new file mode 100644 index 000000000..c21aa16c6 --- /dev/null +++ b/website/docs/reference/jp/examples/min_by.md @@ -0,0 +1,13 @@ +# min_by + +## Signature + +`min_by(array, expref)` + +## Description + +Returns the lowest found element using a custom expression to compute the associated value for each element in the input array. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/modulo.md b/website/docs/reference/jp/examples/modulo.md new file mode 100644 index 000000000..7c2144d72 --- /dev/null +++ b/website/docs/reference/jp/examples/modulo.md @@ -0,0 +1,13 @@ +# modulo + +## Signature + +`modulo(any, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/multiply.md b/website/docs/reference/jp/examples/multiply.md new file mode 100644 index 000000000..d0e29d042 --- /dev/null +++ b/website/docs/reference/jp/examples/multiply.md @@ -0,0 +1,13 @@ +# multiply + +## Signature + +`multiply(any, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/not_null.md b/website/docs/reference/jp/examples/not_null.md new file mode 100644 index 000000000..db6a73309 --- /dev/null +++ b/website/docs/reference/jp/examples/not_null.md @@ -0,0 +1,13 @@ +# not_null + +## Signature + +`not_null(any)` + +## Description + +Returns the first non null element in the input array. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/object_from_lists.md b/website/docs/reference/jp/examples/object_from_lists.md new file mode 100644 index 000000000..b4d0b74a2 --- /dev/null +++ b/website/docs/reference/jp/examples/object_from_lists.md @@ -0,0 +1,13 @@ +# object_from_lists + +## Signature + +`object_from_lists(array, array)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/pad_left.md b/website/docs/reference/jp/examples/pad_left.md new file mode 100644 index 000000000..c0c14c7aa --- /dev/null +++ b/website/docs/reference/jp/examples/pad_left.md @@ -0,0 +1,13 @@ +# pad_left + +## Signature + +`pad_left(string, number, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/pad_right.md b/website/docs/reference/jp/examples/pad_right.md new file mode 100644 index 000000000..d8d34c4e4 --- /dev/null +++ b/website/docs/reference/jp/examples/pad_right.md @@ -0,0 +1,13 @@ +# pad_right + +## Signature + +`pad_right(string, number, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/parse_json.md b/website/docs/reference/jp/examples/parse_json.md new file mode 100644 index 000000000..d831c5c10 --- /dev/null +++ b/website/docs/reference/jp/examples/parse_json.md @@ -0,0 +1,13 @@ +# parse_json + +## Signature + +`parse_json(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/parse_yaml.md b/website/docs/reference/jp/examples/parse_yaml.md new file mode 100644 index 000000000..2305b3a42 --- /dev/null +++ b/website/docs/reference/jp/examples/parse_yaml.md @@ -0,0 +1,13 @@ +# parse_yaml + +## Signature + +`parse_yaml(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/path_canonicalize.md b/website/docs/reference/jp/examples/path_canonicalize.md new file mode 100644 index 000000000..3ebdf18a2 --- /dev/null +++ b/website/docs/reference/jp/examples/path_canonicalize.md @@ -0,0 +1,13 @@ +# path_canonicalize + +## Signature + +`path_canonicalize(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/pattern_match.md b/website/docs/reference/jp/examples/pattern_match.md new file mode 100644 index 000000000..ecd652d64 --- /dev/null +++ b/website/docs/reference/jp/examples/pattern_match.md @@ -0,0 +1,13 @@ +# pattern_match + +## Signature + +`pattern_match(string, string|number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/random.md b/website/docs/reference/jp/examples/random.md new file mode 100644 index 000000000..43e3cc821 --- /dev/null +++ b/website/docs/reference/jp/examples/random.md @@ -0,0 +1,13 @@ +# random + +## Signature + +`random(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/regex_match.md b/website/docs/reference/jp/examples/regex_match.md new file mode 100644 index 000000000..13c4ec51c --- /dev/null +++ b/website/docs/reference/jp/examples/regex_match.md @@ -0,0 +1,13 @@ +# regex_match + +## Signature + +`regex_match(string, string|number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/regex_replace_all.md b/website/docs/reference/jp/examples/regex_replace_all.md new file mode 100644 index 000000000..eb0f8e5be --- /dev/null +++ b/website/docs/reference/jp/examples/regex_replace_all.md @@ -0,0 +1,13 @@ +# regex_replace_all + +## Signature + +`regex_replace_all(string, string|number, string|number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/regex_replace_all_literal.md b/website/docs/reference/jp/examples/regex_replace_all_literal.md new file mode 100644 index 000000000..e60f64770 --- /dev/null +++ b/website/docs/reference/jp/examples/regex_replace_all_literal.md @@ -0,0 +1,13 @@ +# regex_replace_all_literal + +## Signature + +`regex_replace_all_literal(string, string|number, string|number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/replace.md b/website/docs/reference/jp/examples/replace.md new file mode 100644 index 000000000..366ba647d --- /dev/null +++ b/website/docs/reference/jp/examples/replace.md @@ -0,0 +1,13 @@ +# replace + +## Signature + +`replace(string, string, string, number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/replace_all.md b/website/docs/reference/jp/examples/replace_all.md new file mode 100644 index 000000000..fe1149255 --- /dev/null +++ b/website/docs/reference/jp/examples/replace_all.md @@ -0,0 +1,13 @@ +# replace_all + +## Signature + +`replace_all(string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/reverse.md b/website/docs/reference/jp/examples/reverse.md new file mode 100644 index 000000000..48e07e18f --- /dev/null +++ b/website/docs/reference/jp/examples/reverse.md @@ -0,0 +1,13 @@ +# reverse + +## Signature + +`reverse(array|string)` + +## Description + +Reverses the input string or array and returns the result. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/round.md b/website/docs/reference/jp/examples/round.md new file mode 100644 index 000000000..754926506 --- /dev/null +++ b/website/docs/reference/jp/examples/round.md @@ -0,0 +1,13 @@ +# round + +## Signature + +`round(number, number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/semver_compare.md b/website/docs/reference/jp/examples/semver_compare.md new file mode 100644 index 000000000..21b6aab6d --- /dev/null +++ b/website/docs/reference/jp/examples/semver_compare.md @@ -0,0 +1,13 @@ +# semver_compare + +## Signature + +`semver_compare(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/sort.md b/website/docs/reference/jp/examples/sort.md new file mode 100644 index 000000000..c15dc1bd5 --- /dev/null +++ b/website/docs/reference/jp/examples/sort.md @@ -0,0 +1,13 @@ +# sort + +## Signature + +`sort(array[string]|array[number])` + +## Description + +This function accepts an array argument and returns the sorted elements as an array. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/sort_by.md b/website/docs/reference/jp/examples/sort_by.md new file mode 100644 index 000000000..d6fe7ea6a --- /dev/null +++ b/website/docs/reference/jp/examples/sort_by.md @@ -0,0 +1,13 @@ +# sort_by + +## Signature + +`sort_by(array, expref)` + +## Description + +This function accepts an array argument and returns the sorted elements as an array using a custom expression to compute the associated value for each element. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/split.md b/website/docs/reference/jp/examples/split.md new file mode 100644 index 000000000..dac216bd5 --- /dev/null +++ b/website/docs/reference/jp/examples/split.md @@ -0,0 +1,13 @@ +# split + +## Signature + +`split(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/starts_with.md b/website/docs/reference/jp/examples/starts_with.md new file mode 100644 index 000000000..4d111cfa0 --- /dev/null +++ b/website/docs/reference/jp/examples/starts_with.md @@ -0,0 +1,13 @@ +# starts_with + +## Signature + +`starts_with(string, string)` + +## Description + +Reports whether the input string begins with the provided string prefix argument. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/subtract.md b/website/docs/reference/jp/examples/subtract.md new file mode 100644 index 000000000..168645a7c --- /dev/null +++ b/website/docs/reference/jp/examples/subtract.md @@ -0,0 +1,13 @@ +# subtract + +## Signature + +`subtract(any, any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/sum.md b/website/docs/reference/jp/examples/sum.md new file mode 100644 index 000000000..dc60abcd9 --- /dev/null +++ b/website/docs/reference/jp/examples/sum.md @@ -0,0 +1,13 @@ +# sum + +## Signature + +`sum(array)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_add.md b/website/docs/reference/jp/examples/time_add.md new file mode 100644 index 000000000..81f2b7d21 --- /dev/null +++ b/website/docs/reference/jp/examples/time_add.md @@ -0,0 +1,13 @@ +# time_add + +## Signature + +`time_add(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_after.md b/website/docs/reference/jp/examples/time_after.md new file mode 100644 index 000000000..103a0d709 --- /dev/null +++ b/website/docs/reference/jp/examples/time_after.md @@ -0,0 +1,13 @@ +# time_after + +## Signature + +`time_after(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_before.md b/website/docs/reference/jp/examples/time_before.md new file mode 100644 index 000000000..8380e62e8 --- /dev/null +++ b/website/docs/reference/jp/examples/time_before.md @@ -0,0 +1,13 @@ +# time_before + +## Signature + +`time_before(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_between.md b/website/docs/reference/jp/examples/time_between.md new file mode 100644 index 000000000..c88367e80 --- /dev/null +++ b/website/docs/reference/jp/examples/time_between.md @@ -0,0 +1,13 @@ +# time_between + +## Signature + +`time_between(string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_diff.md b/website/docs/reference/jp/examples/time_diff.md new file mode 100644 index 000000000..72b804b74 --- /dev/null +++ b/website/docs/reference/jp/examples/time_diff.md @@ -0,0 +1,13 @@ +# time_diff + +## Signature + +`time_diff(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_now.md b/website/docs/reference/jp/examples/time_now.md new file mode 100644 index 000000000..2f6672367 --- /dev/null +++ b/website/docs/reference/jp/examples/time_now.md @@ -0,0 +1,13 @@ +# time_now + +## Signature + +`time_now()` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_now_utc.md b/website/docs/reference/jp/examples/time_now_utc.md new file mode 100644 index 000000000..ac57077d4 --- /dev/null +++ b/website/docs/reference/jp/examples/time_now_utc.md @@ -0,0 +1,13 @@ +# time_now_utc + +## Signature + +`time_now_utc()` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_parse.md b/website/docs/reference/jp/examples/time_parse.md new file mode 100644 index 000000000..2a59700de --- /dev/null +++ b/website/docs/reference/jp/examples/time_parse.md @@ -0,0 +1,13 @@ +# time_parse + +## Signature + +`time_parse(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_since.md b/website/docs/reference/jp/examples/time_since.md new file mode 100644 index 000000000..228fb0b25 --- /dev/null +++ b/website/docs/reference/jp/examples/time_since.md @@ -0,0 +1,13 @@ +# time_since + +## Signature + +`time_since(string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_to_cron.md b/website/docs/reference/jp/examples/time_to_cron.md new file mode 100644 index 000000000..3fc7ea4c7 --- /dev/null +++ b/website/docs/reference/jp/examples/time_to_cron.md @@ -0,0 +1,13 @@ +# time_to_cron + +## Signature + +`time_to_cron(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_truncate.md b/website/docs/reference/jp/examples/time_truncate.md new file mode 100644 index 000000000..cb04678a1 --- /dev/null +++ b/website/docs/reference/jp/examples/time_truncate.md @@ -0,0 +1,13 @@ +# time_truncate + +## Signature + +`time_truncate(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/time_utc.md b/website/docs/reference/jp/examples/time_utc.md new file mode 100644 index 000000000..b922bb4fc --- /dev/null +++ b/website/docs/reference/jp/examples/time_utc.md @@ -0,0 +1,13 @@ +# time_utc + +## Signature + +`time_utc(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_array.md b/website/docs/reference/jp/examples/to_array.md new file mode 100644 index 000000000..e055205d6 --- /dev/null +++ b/website/docs/reference/jp/examples/to_array.md @@ -0,0 +1,13 @@ +# to_array + +## Signature + +`to_array(any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_boolean.md b/website/docs/reference/jp/examples/to_boolean.md new file mode 100644 index 000000000..e579125be --- /dev/null +++ b/website/docs/reference/jp/examples/to_boolean.md @@ -0,0 +1,13 @@ +# to_boolean + +## Signature + +`to_boolean(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_lower.md b/website/docs/reference/jp/examples/to_lower.md new file mode 100644 index 000000000..7100e2aa9 --- /dev/null +++ b/website/docs/reference/jp/examples/to_lower.md @@ -0,0 +1,13 @@ +# to_lower + +## Signature + +`to_lower(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_number.md b/website/docs/reference/jp/examples/to_number.md new file mode 100644 index 000000000..ea0a280fe --- /dev/null +++ b/website/docs/reference/jp/examples/to_number.md @@ -0,0 +1,13 @@ +# to_number + +## Signature + +`to_number(any)` + +## Description + +Returns the parsed number. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_string.md b/website/docs/reference/jp/examples/to_string.md new file mode 100644 index 000000000..2400ea3f6 --- /dev/null +++ b/website/docs/reference/jp/examples/to_string.md @@ -0,0 +1,13 @@ +# to_string + +## Signature + +`to_string(any)` + +## Description + +The JSON encoded value of the given argument. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/to_upper.md b/website/docs/reference/jp/examples/to_upper.md new file mode 100644 index 000000000..777cdc6f2 --- /dev/null +++ b/website/docs/reference/jp/examples/to_upper.md @@ -0,0 +1,13 @@ +# to_upper + +## Signature + +`to_upper(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/trim.md b/website/docs/reference/jp/examples/trim.md new file mode 100644 index 000000000..054cf844d --- /dev/null +++ b/website/docs/reference/jp/examples/trim.md @@ -0,0 +1,13 @@ +# trim + +## Signature + +`trim(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/trim_left.md b/website/docs/reference/jp/examples/trim_left.md new file mode 100644 index 000000000..11b50986d --- /dev/null +++ b/website/docs/reference/jp/examples/trim_left.md @@ -0,0 +1,13 @@ +# trim_left + +## Signature + +`trim_left(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/trim_prefix.md b/website/docs/reference/jp/examples/trim_prefix.md new file mode 100644 index 000000000..451604cb7 --- /dev/null +++ b/website/docs/reference/jp/examples/trim_prefix.md @@ -0,0 +1,13 @@ +# trim_prefix + +## Signature + +`trim_prefix(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/trim_right.md b/website/docs/reference/jp/examples/trim_right.md new file mode 100644 index 000000000..e8c3136b8 --- /dev/null +++ b/website/docs/reference/jp/examples/trim_right.md @@ -0,0 +1,13 @@ +# trim_right + +## Signature + +`trim_right(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/trim_space.md b/website/docs/reference/jp/examples/trim_space.md new file mode 100644 index 000000000..c56ff9cd6 --- /dev/null +++ b/website/docs/reference/jp/examples/trim_space.md @@ -0,0 +1,13 @@ +# trim_space + +## Signature + +`trim_space(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/truncate.md b/website/docs/reference/jp/examples/truncate.md new file mode 100644 index 000000000..3081e9da8 --- /dev/null +++ b/website/docs/reference/jp/examples/truncate.md @@ -0,0 +1,13 @@ +# truncate + +## Signature + +`truncate(string, number)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/type.md b/website/docs/reference/jp/examples/type.md new file mode 100644 index 000000000..a6e2401a4 --- /dev/null +++ b/website/docs/reference/jp/examples/type.md @@ -0,0 +1,13 @@ +# type + +## Signature + +`type(any)` + +## Description + +Returns the JavaScript type of the given argument as a string value. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/upper.md b/website/docs/reference/jp/examples/upper.md new file mode 100644 index 000000000..6f48e38d5 --- /dev/null +++ b/website/docs/reference/jp/examples/upper.md @@ -0,0 +1,13 @@ +# upper + +## Signature + +`upper(string)` + +## Description + +Returns the given string with all Unicode letters mapped to their upper case. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/values.md b/website/docs/reference/jp/examples/values.md new file mode 100644 index 000000000..875d891b8 --- /dev/null +++ b/website/docs/reference/jp/examples/values.md @@ -0,0 +1,13 @@ +# values + +## Signature + +`values(object)` + +## Description + +Returns the values of the provided object. + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/wildcard.md b/website/docs/reference/jp/examples/wildcard.md new file mode 100644 index 000000000..6cc2053df --- /dev/null +++ b/website/docs/reference/jp/examples/wildcard.md @@ -0,0 +1,13 @@ +# wildcard + +## Signature + +`wildcard(string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x509_decode.md b/website/docs/reference/jp/examples/x509_decode.md new file mode 100644 index 000000000..a29bb40b7 --- /dev/null +++ b/website/docs/reference/jp/examples/x509_decode.md @@ -0,0 +1,13 @@ +# x509_decode + +## Signature + +`x509_decode(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_k8s_exists.md b/website/docs/reference/jp/examples/x_k8s_exists.md new file mode 100644 index 000000000..333bc62e6 --- /dev/null +++ b/website/docs/reference/jp/examples/x_k8s_exists.md @@ -0,0 +1,13 @@ +# x_k8s_exists + +## Signature + +`x_k8s_exists(any, string, string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_k8s_get.md b/website/docs/reference/jp/examples/x_k8s_get.md index 8770e0429..bd5fea54f 100644 --- a/website/docs/reference/jp/examples/x_k8s_get.md +++ b/website/docs/reference/jp/examples/x_k8s_get.md @@ -1,64 +1,13 @@ -# `x_k8s_get` +# x_k8s_get -```yaml - - description: >- - 1. Look up some details about a Deployment object with 'x_k8s_get(...)', and store them in a binding. - 2. Make use of the binding in a `script` block through environment variables. - 3. Refer to the same bound Deployment object in an `assert` block. - bindings: - - name: xpNS - value: crossplane-system - - name: xpDeploy - # Arguments to 'x_k8s_get(any, string, string, string, string)': - # - # 1. any: Supply the '$client' built-in binding here, which is needed to connect to the cluster: - # https://kyverno.github.io/chainsaw/latest/reference/builtins/ - # - # 2. string: 'apiVersion' field on the object. - # - # 3. string: 'Kind' field on the object. - # - # 4. string: The namespace of the object. If the object type is not namespaced, this field can be an empty - # string, or any string; it doesn't seem to matter. - # - # 5. string: The name of the object. - value: (x_k8s_get($client, 'apps/v1', 'Deployment', $xpNS, 'crossplane')) - try: - - script: - bindings: - - # Re-bind the version label from the Deployment to give us a more succinct name to refer to. - name: deployVersion - # If the label key has any periods in it, double-quote the whole key. - value: ($xpDeploy.metadata.labels."app.kubernetes.io/version") - env: - - # Refer to the Deployment version label the long way. - name: DEP_VER_LONG - value: ($xpDeploy.metadata.labels."app.kubernetes.io/version") - - # Refer to the Deployment version label the short way, through the additional binding scoped to this - # 'script' block. - name: DEP_VER_SHORT - value: ($deployVersion) - # The version values printed by the script here will be the same, even though they were derived through - # slightly different routes. - content: |- - echo "DEP_VER_LONG: '$DEP_VER_LONG'" - echo "DEP_VER_SHORT: '$DEP_VER_SHORT'" - - assert: - bindings: - - name: depVer - value: ($xpDeploy.metadata.labels."app.kubernetes.io/version") - resource: - apiVersion: v1 - kind: Pod - metadata: - # Match the pod(s) with namespace and label selectors. - namespace: ($xpNS) - labels: - app: crossplane - # Make a binding that holds this Pod's version from its label. - (metadata.labels."app.kubernetes.io/version")->podVer: - # Assert that the version labels for the Deployment and this Pod equal each other, using the - # 'semver_compare()' function described here: - # https://kyverno.io/docs/writing-policies/jmespath/#semver_compare - (semver_compare($depVer, $podVer)): true -``` +## Signature + +`x_k8s_get(any, string, string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_k8s_list.md b/website/docs/reference/jp/examples/x_k8s_list.md new file mode 100644 index 000000000..d24e0d9c8 --- /dev/null +++ b/website/docs/reference/jp/examples/x_k8s_list.md @@ -0,0 +1,13 @@ +# x_k8s_list + +## Signature + +`x_k8s_list(any, string, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_k8s_resource_exists.md b/website/docs/reference/jp/examples/x_k8s_resource_exists.md new file mode 100644 index 000000000..7204d0a14 --- /dev/null +++ b/website/docs/reference/jp/examples/x_k8s_resource_exists.md @@ -0,0 +1,13 @@ +# x_k8s_resource_exists + +## Signature + +`x_k8s_resource_exists(any, string, string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_k8s_server_version.md b/website/docs/reference/jp/examples/x_k8s_server_version.md new file mode 100644 index 000000000..0a5113f8e --- /dev/null +++ b/website/docs/reference/jp/examples/x_k8s_server_version.md @@ -0,0 +1,13 @@ +# x_k8s_server_version + +## Signature + +`x_k8s_server_version(any)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/x_metrics_decode.md b/website/docs/reference/jp/examples/x_metrics_decode.md new file mode 100644 index 000000000..3871e9a01 --- /dev/null +++ b/website/docs/reference/jp/examples/x_metrics_decode.md @@ -0,0 +1,13 @@ +# x_metrics_decode + +## Signature + +`x_metrics_decode(string)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/examples/zip.md b/website/docs/reference/jp/examples/zip.md new file mode 100644 index 000000000..559325b5a --- /dev/null +++ b/website/docs/reference/jp/examples/zip.md @@ -0,0 +1,13 @@ +# zip + +## Signature + +`zip(array, array)` + +## Description + + + +## Examples + +TODO diff --git a/website/docs/reference/jp/functions.md b/website/docs/reference/jp/functions.md index 377f37e46..3f8448792 100644 --- a/website/docs/reference/jp/functions.md +++ b/website/docs/reference/jp/functions.md @@ -8,125 +8,121 @@ ## built-in functions -| Name | Signature | -|---|---| -| abs | `abs(number)` | -| avg | `avg(array[number])` | -| ceil | `ceil(number)` | -| contains | `contains(array|string, any)` | -| ends_with | `ends_with(string, string)` | -| find_first | `find_first(string, string, number, number)` | -| find_last | `find_last(string, string, number, number)` | -| floor | `floor(number)` | -| from_items | `from_items(array[array])` | -| group_by | `group_by(array, expref)` | -| items | `items(object)` | -| join | `join(string, array[string])` | -| keys | `keys(object)` | -| length | `length(string|array|object)` | -| lower | `lower(string)` | -| map | `map(expref, array)` | -| max | `max(array[number]|array[string])` | -| max_by | `max_by(array, expref)` | -| merge | `merge(object)` | -| min | `min(array[number]|array[string])` | -| min_by | `min_by(array, expref)` | -| not_null | `not_null(any)` | -| pad_left | `pad_left(string, number, string)` | -| pad_right | `pad_right(string, number, string)` | -| replace | `replace(string, string, string, number)` | -| reverse | `reverse(array|string)` | -| sort | `sort(array[string]|array[number])` | -| sort_by | `sort_by(array, expref)` | -| split | `split(string, string, number)` | -| starts_with | `starts_with(string, string)` | -| sum | `sum(array[number])` | -| to_array | `to_array(any)` | -| to_number | `to_number(any)` | -| to_string | `to_string(any)` | -| trim | `trim(string, string)` | -| trim_left | `trim_left(string, string)` | -| trim_right | `trim_right(string, string)` | -| type | `type(any)` | -| upper | `upper(string)` | -| values | `values(object)` | -| zip | `zip(array, array)` | +| Name | Signature | Description | +|---|---|---| +| [abs](./examples/abs.md) | `abs(number)` | Returns the absolute value of the provided argument. | +| [avg](./examples/avg.md) | `avg(array[number])` | Returns the average of the elements in the provided array. An empty array will produce a return value of null. | +| [ceil](./examples/ceil.md) | `ceil(number)` | Returns the next highest integer value by rounding up if necessary. | +| [contains](./examples/contains.md) | `contains(array|string, any)` | Returns `true` if the given subject contains the provided search value. If the subject is an array, this function returns `true` if one of the elements in the array is equal to the provided search value. If the provided subject is a string, this function returns `true` if the string contains the provided search argument. | +| [ends_with](./examples/ends_with.md) | `ends_with(string, string)` | Reports whether the given string ends with the provided suffix argument. | +| [find_first](./examples/find_first.md) | `find_first(string, string, number, number)` | | +| [find_last](./examples/find_last.md) | `find_last(string, string, number, number)` | | +| [floor](./examples/floor.md) | `floor(number)` | Returns the next lowest integer value by rounding down if necessary. | +| [from_items](./examples/from_items.md) | `from_items(array[array])` | | +| [group_by](./examples/group_by.md) | `group_by(array, expref)` | | +| [items](./examples/items.md) | `items(object)` | Converts a given object into an array of key-value pairs. | +| [join](./examples/join.md) | `join(string, array[string])` | Returns all of the elements from the provided array joined together using the glue argument as a separator between each. | +| [keys](./examples/keys.md) | `keys(object)` | Returns an array containing the keys of the provided object. | +| [length](./examples/length.md) | `length(string|array|object)` | Returns the length of the given argument. If the argument is a string this function returns the number of code points in the string. If the argument is an array this function returns the number of elements in the array. If the argument is an object this function returns the number of key-value pairs in the object. | +| [lower](./examples/lower.md) | `lower(string)` | Returns the given string with all Unicode letters mapped to their lower case. | +| [map](./examples/map.md) | `map(expref, array)` | Transforms elements in a given array and returns the result. | +| [max](./examples/max.md) | `max(array[number]|array[string])` | Returns the highest found element in the provided array argument. An empty array will produce a return value of null. | +| [max_by](./examples/max_by.md) | `max_by(array, expref)` | Returns the highest found element using a custom expression to compute the associated value for each element in the input array. | +| [merge](./examples/merge.md) | `merge(object)` | Meges a list of objects together and returns the result. | +| [min](./examples/min.md) | `min(array[number]|array[string])` | Returns the lowest found element in the provided array argument. | +| [min_by](./examples/min_by.md) | `min_by(array, expref)` | Returns the lowest found element using a custom expression to compute the associated value for each element in the input array. | +| [not_null](./examples/not_null.md) | `not_null(any)` | Returns the first non null element in the input array. | +| [pad_left](./examples/pad_left.md) | `pad_left(string, number, string)` | | +| [pad_right](./examples/pad_right.md) | `pad_right(string, number, string)` | | +| [replace](./examples/replace.md) | `replace(string, string, string, number)` | Returns a copy of the input string with instances of old string argument replaced by new string argument. | +| [reverse](./examples/reverse.md) | `reverse(array|string)` | Reverses the input string or array and returns the result. | +| [sort](./examples/sort.md) | `sort(array[string]|array[number])` | This function accepts an array argument and returns the sorted elements as an array. | +| [sort_by](./examples/sort_by.md) | `sort_by(array, expref)` | This function accepts an array argument and returns the sorted elements as an array using a custom expression to compute the associated value for each element. | +| [split](./examples/split.md) | `split(string, string, number)` | Slices input string into substrings separated by a string argument and returns an array of the substrings between those separators. | +| [starts_with](./examples/starts_with.md) | `starts_with(string, string)` | Reports whether the input string begins with the provided string prefix argument. | +| [sum](./examples/sum.md) | `sum(array[number])` | Returns the sum of all numbers contained in the provided array. | +| [to_array](./examples/to_array.md) | `to_array(any)` | | +| [to_number](./examples/to_number.md) | `to_number(any)` | Returns the parsed number. | +| [to_string](./examples/to_string.md) | `to_string(any)` | The JSON encoded value of the given argument. | +| [trim](./examples/trim.md) | `trim(string, string)` | | +| [trim_left](./examples/trim_left.md) | `trim_left(string, string)` | | +| [trim_right](./examples/trim_right.md) | `trim_right(string, string)` | | +| [type](./examples/type.md) | `type(any)` | Returns the JavaScript type of the given argument as a string value. | +| [upper](./examples/upper.md) | `upper(string)` | Returns the given string with all Unicode letters mapped to their upper case. | +| [values](./examples/values.md) | `values(object)` | Returns the values of the provided object. | +| [zip](./examples/zip.md) | `zip(array, array)` | | ## kyverno-json functions -| Name | Signature | -|---|---| -| at | `at(array, any)` | -| concat | `concat(string, string)` | -| json_parse | `json_parse(string)` | -| wildcard | `wildcard(string, string)` | +| Name | Signature | Description | +|---|---|---| +| [at](./examples/at.md) | `at(array, any)` | | +| [concat](./examples/concat.md) | `concat(string, string)` | | +| [json_parse](./examples/json_parse.md) | `json_parse(string)` | | +| [wildcard](./examples/wildcard.md) | `wildcard(string, string)` | | ## kyverno functions -| Name | Signature | -|---|---| -| compare | `compare(string, string)` | -| equal_fold | `equal_fold(string, string)` | -| replace | `replace(string, string, string, number)` | -| replace_all | `replace_all(string, string, string)` | -| to_upper | `to_upper(string)` | -| to_lower | `to_lower(string)` | -| trim | `trim(string, string)` | -| trim_prefix | `trim_prefix(string, string)` | -| split | `split(string, string)` | -| regex_replace_all | `regex_replace_all(string, string|number, string|number)` | -| regex_replace_all_literal | `regex_replace_all_literal(string, string|number, string|number)` | -| regex_match | `regex_match(string, string|number)` | -| pattern_match | `pattern_match(string, string|number)` | -| label_match | `label_match(object, object)` | -| to_boolean | `to_boolean(string)` | -| add | `add(any, any)` | -| sum | `sum(array)` | -| subtract | `subtract(any, any)` | -| multiply | `multiply(any, any)` | -| divide | `divide(any, any)` | -| modulo | `modulo(any, any)` | -| round | `round(number, number)` | -| base64_decode | `base64_decode(string)` | -| base64_encode | `base64_encode(string)` | -| time_since | `time_since(string, string, string)` | -| time_now | `time_now()` | -| time_now_utc | `time_now_utc()` | -| path_canonicalize | `path_canonicalize(string)` | -| truncate | `truncate(string, number)` | -| semver_compare | `semver_compare(string, string)` | -| parse_json | `parse_json(string)` | -| parse_yaml | `parse_yaml(string)` | -| lookup | `lookup(object|array, string|number)` | -| items | `items(object|array, string, string)` | -| object_from_lists | `object_from_lists(array, array)` | -| random | `random(string)` | -| x509_decode | `x509_decode(string)` | -| time_to_cron | `time_to_cron(string)` | -| time_add | `time_add(string, string)` | -| time_parse | `time_parse(string, string)` | -| time_utc | `time_utc(string)` | -| time_diff | `time_diff(string, string)` | -| time_before | `time_before(string, string)` | -| time_after | `time_after(string, string)` | -| time_between | `time_between(string, string, string)` | -| time_truncate | `time_truncate(string, string)` | +| Name | Signature | Description | +|---|---|---| +| [compare](./examples/compare.md) | `compare(string, string)` | | +| [equal_fold](./examples/equal_fold.md) | `equal_fold(string, string)` | | +| [replace](./examples/replace.md) | `replace(string, string, string, number)` | | +| [replace_all](./examples/replace_all.md) | `replace_all(string, string, string)` | | +| [to_upper](./examples/to_upper.md) | `to_upper(string)` | | +| [to_lower](./examples/to_lower.md) | `to_lower(string)` | | +| [trim](./examples/trim.md) | `trim(string, string)` | | +| [trim_prefix](./examples/trim_prefix.md) | `trim_prefix(string, string)` | | +| [split](./examples/split.md) | `split(string, string)` | | +| [regex_replace_all](./examples/regex_replace_all.md) | `regex_replace_all(string, string|number, string|number)` | | +| [regex_replace_all_literal](./examples/regex_replace_all_literal.md) | `regex_replace_all_literal(string, string|number, string|number)` | | +| [regex_match](./examples/regex_match.md) | `regex_match(string, string|number)` | | +| [pattern_match](./examples/pattern_match.md) | `pattern_match(string, string|number)` | | +| [label_match](./examples/label_match.md) | `label_match(object, object)` | | +| [to_boolean](./examples/to_boolean.md) | `to_boolean(string)` | | +| [add](./examples/add.md) | `add(any, any)` | | +| [sum](./examples/sum.md) | `sum(array)` | | +| [subtract](./examples/subtract.md) | `subtract(any, any)` | | +| [multiply](./examples/multiply.md) | `multiply(any, any)` | | +| [divide](./examples/divide.md) | `divide(any, any)` | | +| [modulo](./examples/modulo.md) | `modulo(any, any)` | | +| [round](./examples/round.md) | `round(number, number)` | | +| [base64_decode](./examples/base64_decode.md) | `base64_decode(string)` | | +| [base64_encode](./examples/base64_encode.md) | `base64_encode(string)` | | +| [time_since](./examples/time_since.md) | `time_since(string, string, string)` | | +| [time_now](./examples/time_now.md) | `time_now()` | | +| [time_now_utc](./examples/time_now_utc.md) | `time_now_utc()` | | +| [path_canonicalize](./examples/path_canonicalize.md) | `path_canonicalize(string)` | | +| [truncate](./examples/truncate.md) | `truncate(string, number)` | | +| [semver_compare](./examples/semver_compare.md) | `semver_compare(string, string)` | | +| [parse_json](./examples/parse_json.md) | `parse_json(string)` | | +| [parse_yaml](./examples/parse_yaml.md) | `parse_yaml(string)` | | +| [lookup](./examples/lookup.md) | `lookup(object|array, string|number)` | | +| [items](./examples/items.md) | `items(object|array, string, string)` | | +| [object_from_lists](./examples/object_from_lists.md) | `object_from_lists(array, array)` | | +| [random](./examples/random.md) | `random(string)` | | +| [x509_decode](./examples/x509_decode.md) | `x509_decode(string)` | | +| [time_to_cron](./examples/time_to_cron.md) | `time_to_cron(string)` | | +| [time_add](./examples/time_add.md) | `time_add(string, string)` | | +| [time_parse](./examples/time_parse.md) | `time_parse(string, string)` | | +| [time_utc](./examples/time_utc.md) | `time_utc(string)` | | +| [time_diff](./examples/time_diff.md) | `time_diff(string, string)` | | +| [time_before](./examples/time_before.md) | `time_before(string, string)` | | +| [time_after](./examples/time_after.md) | `time_after(string, string)` | | +| [time_between](./examples/time_between.md) | `time_between(string, string, string)` | | +| [time_truncate](./examples/time_truncate.md) | `time_truncate(string, string)` | | ## chainsaw functions -| Name | Signature | -|---|---| -| env | `env(string)` | -| x_k8s_get | `x_k8s_get(any, string, string, string, string)` | -| x_k8s_list | `x_k8s_list(any, string, string, string)` | -| x_k8s_exists | `x_k8s_exists(any, string, string, string, string)` | -| x_k8s_resource_exists | `x_k8s_resource_exists(any, string, string)` | -| x_k8s_server_version | `x_k8s_server_version(any)` | -| x_metrics_decode | `x_metrics_decode(string)` | -| trim_space | `trim_space(string)` | -| as_string | `as_string(any)` | - -## examples - -- [x_k8s_get](./examples/x_k8s_get.md) +| Name | Signature | Description | +|---|---|---| +| [env](./examples/env.md) | `env(string)` | | +| [x_k8s_get](./examples/x_k8s_get.md) | `x_k8s_get(any, string, string, string, string)` | | +| [x_k8s_list](./examples/x_k8s_list.md) | `x_k8s_list(any, string, string, string)` | | +| [x_k8s_exists](./examples/x_k8s_exists.md) | `x_k8s_exists(any, string, string, string, string)` | | +| [x_k8s_resource_exists](./examples/x_k8s_resource_exists.md) | `x_k8s_resource_exists(any, string, string)` | | +| [x_k8s_server_version](./examples/x_k8s_server_version.md) | `x_k8s_server_version(any)` | | +| [x_metrics_decode](./examples/x_metrics_decode.md) | `x_metrics_decode(string)` | | +| [trim_space](./examples/trim_space.md) | `trim_space(string)` | | +| [as_string](./examples/as_string.md) | `as_string(any)` | | diff --git a/website/jp/examples/abs.md b/website/jp/examples/abs.md new file mode 100644 index 000000000..3d2f867a8 --- /dev/null +++ b/website/jp/examples/abs.md @@ -0,0 +1,3 @@ +``` +abs(`-1`) == `1` +``` diff --git a/website/jp/examples/add.md b/website/jp/examples/add.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/add.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/as_string.md b/website/jp/examples/as_string.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/as_string.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/at.md b/website/jp/examples/at.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/at.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/avg.md b/website/jp/examples/avg.md new file mode 100644 index 000000000..b60df264d --- /dev/null +++ b/website/jp/examples/avg.md @@ -0,0 +1,3 @@ +``` +avg([`10`,`15`,`20`]) == `15` +``` \ No newline at end of file diff --git a/website/jp/examples/base64_decode.md b/website/jp/examples/base64_decode.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/base64_decode.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/base64_encode.md b/website/jp/examples/base64_encode.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/base64_encode.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/ceil.md b/website/jp/examples/ceil.md new file mode 100644 index 000000000..ede45a4e7 --- /dev/null +++ b/website/jp/examples/ceil.md @@ -0,0 +1,3 @@ +``` +ceil(`1.9`) == `2` +``` diff --git a/website/jp/examples/compare.md b/website/jp/examples/compare.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/compare.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/concat.md b/website/jp/examples/concat.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/concat.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/contains.md b/website/jp/examples/contains.md new file mode 100644 index 000000000..ad548889a --- /dev/null +++ b/website/jp/examples/contains.md @@ -0,0 +1,20 @@ +### With strings + +``` +contains('foobar', 'bar') == true +``` + +``` +contains('foobar', 'not') == false +``` + +### With arrays + + +``` +contains(['foo', 'bar'], 'bar') == true +``` + +``` +contains(['foo', 'bar'], 'not') == true +``` diff --git a/website/jp/examples/divide.md b/website/jp/examples/divide.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/divide.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/ends_with.md b/website/jp/examples/ends_with.md new file mode 100644 index 000000000..6075a03b8 --- /dev/null +++ b/website/jp/examples/ends_with.md @@ -0,0 +1,7 @@ +``` +ends_with('foobar', 'bar') == true +``` + +``` +ends_with('foobar', 'foo') == false +``` diff --git a/website/jp/examples/env.md b/website/jp/examples/env.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/env.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/equal_fold.md b/website/jp/examples/equal_fold.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/equal_fold.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/find_first.md b/website/jp/examples/find_first.md new file mode 100644 index 000000000..e519b142d --- /dev/null +++ b/website/jp/examples/find_first.md @@ -0,0 +1,19 @@ +``` +find_first('subject string', 'string', `0`) == `8` +``` + +``` +find_first('subject string', 'string', `8`) == `8` +``` + +``` +find_first('subject string', 'string', `9`) == null +``` + +``` +find_first('subject string', 'string', `0`, `14`) == `8` +``` + +``` +find_first('subject string', 'string', `0`, `13`) == null +``` diff --git a/website/jp/examples/find_last.md b/website/jp/examples/find_last.md new file mode 100644 index 000000000..feb90dde8 --- /dev/null +++ b/website/jp/examples/find_last.md @@ -0,0 +1,19 @@ +``` +find_last('subject string', 'string', `0`) == `8` +``` + +``` +find_last('subject string', 'string', `8`) == `8` +``` + +``` +find_last('subject string', 'string', `9`) == null +``` + +``` +find_last('subject string', 'string', `0`, `14`) == `8` +``` + +``` +find_last('subject string', 'string', `0`, `13`) == null +``` diff --git a/website/jp/examples/floor.md b/website/jp/examples/floor.md new file mode 100644 index 000000000..ce262d438 --- /dev/null +++ b/website/jp/examples/floor.md @@ -0,0 +1,3 @@ +``` +floor(`1.9`) == `1` +``` diff --git a/website/jp/examples/from_items.md b/website/jp/examples/from_items.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/from_items.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/group_by.md b/website/jp/examples/group_by.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/group_by.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/items.md b/website/jp/examples/items.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/items.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/join.md b/website/jp/examples/join.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/join.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/json_parse.md b/website/jp/examples/json_parse.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/json_parse.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/keys.md b/website/jp/examples/keys.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/keys.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/label_match.md b/website/jp/examples/label_match.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/label_match.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/length.md b/website/jp/examples/length.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/length.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/lookup.md b/website/jp/examples/lookup.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/lookup.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/lower.md b/website/jp/examples/lower.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/lower.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/map.md b/website/jp/examples/map.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/map.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/max.md b/website/jp/examples/max.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/max.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/max_by.md b/website/jp/examples/max_by.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/max_by.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/merge.md b/website/jp/examples/merge.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/merge.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/min.md b/website/jp/examples/min.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/min.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/min_by.md b/website/jp/examples/min_by.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/min_by.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/modulo.md b/website/jp/examples/modulo.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/modulo.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/multiply.md b/website/jp/examples/multiply.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/multiply.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/not_null.md b/website/jp/examples/not_null.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/not_null.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/object_from_lists.md b/website/jp/examples/object_from_lists.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/object_from_lists.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/pad_left.md b/website/jp/examples/pad_left.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/pad_left.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/pad_right.md b/website/jp/examples/pad_right.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/pad_right.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/parse_json.md b/website/jp/examples/parse_json.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/parse_json.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/parse_yaml.md b/website/jp/examples/parse_yaml.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/parse_yaml.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/path_canonicalize.md b/website/jp/examples/path_canonicalize.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/path_canonicalize.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/pattern_match.md b/website/jp/examples/pattern_match.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/pattern_match.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/random.md b/website/jp/examples/random.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/random.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/regex_match.md b/website/jp/examples/regex_match.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/regex_match.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/regex_replace_all.md b/website/jp/examples/regex_replace_all.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/regex_replace_all.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/regex_replace_all_literal.md b/website/jp/examples/regex_replace_all_literal.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/regex_replace_all_literal.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/replace.md b/website/jp/examples/replace.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/replace.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/replace_all.md b/website/jp/examples/replace_all.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/replace_all.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/reverse.md b/website/jp/examples/reverse.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/reverse.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/round.md b/website/jp/examples/round.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/round.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/semver_compare.md b/website/jp/examples/semver_compare.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/semver_compare.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/sort.md b/website/jp/examples/sort.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/sort.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/sort_by.md b/website/jp/examples/sort_by.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/sort_by.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/split.md b/website/jp/examples/split.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/split.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/starts_with.md b/website/jp/examples/starts_with.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/starts_with.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/subtract.md b/website/jp/examples/subtract.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/subtract.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/sum.md b/website/jp/examples/sum.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/sum.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_add.md b/website/jp/examples/time_add.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_add.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_after.md b/website/jp/examples/time_after.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_after.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_before.md b/website/jp/examples/time_before.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_before.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_between.md b/website/jp/examples/time_between.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_between.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_diff.md b/website/jp/examples/time_diff.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_diff.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_now.md b/website/jp/examples/time_now.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_now.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_now_utc.md b/website/jp/examples/time_now_utc.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_now_utc.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_parse.md b/website/jp/examples/time_parse.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_parse.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_since.md b/website/jp/examples/time_since.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_since.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_to_cron.md b/website/jp/examples/time_to_cron.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_to_cron.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_truncate.md b/website/jp/examples/time_truncate.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_truncate.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/time_utc.md b/website/jp/examples/time_utc.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/time_utc.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_array.md b/website/jp/examples/to_array.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_array.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_boolean.md b/website/jp/examples/to_boolean.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_boolean.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_lower.md b/website/jp/examples/to_lower.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_lower.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_number.md b/website/jp/examples/to_number.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_number.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_string.md b/website/jp/examples/to_string.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_string.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/to_upper.md b/website/jp/examples/to_upper.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/to_upper.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/trim.md b/website/jp/examples/trim.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/trim.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/trim_left.md b/website/jp/examples/trim_left.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/trim_left.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/trim_prefix.md b/website/jp/examples/trim_prefix.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/trim_prefix.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/trim_right.md b/website/jp/examples/trim_right.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/trim_right.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/trim_space.md b/website/jp/examples/trim_space.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/trim_space.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/truncate.md b/website/jp/examples/truncate.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/truncate.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/type.md b/website/jp/examples/type.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/type.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/upper.md b/website/jp/examples/upper.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/upper.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/values.md b/website/jp/examples/values.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/values.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/wildcard.md b/website/jp/examples/wildcard.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/wildcard.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x509_decode.md b/website/jp/examples/x509_decode.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x509_decode.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_k8s_exists.md b/website/jp/examples/x_k8s_exists.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_k8s_exists.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_k8s_get.md b/website/jp/examples/x_k8s_get.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_k8s_get.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_k8s_list.md b/website/jp/examples/x_k8s_list.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_k8s_list.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_k8s_resource_exists.md b/website/jp/examples/x_k8s_resource_exists.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_k8s_resource_exists.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_k8s_server_version.md b/website/jp/examples/x_k8s_server_version.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_k8s_server_version.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/x_metrics_decode.md b/website/jp/examples/x_metrics_decode.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/x_metrics_decode.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/examples/zip.md b/website/jp/examples/zip.md new file mode 100644 index 000000000..1333ed77b --- /dev/null +++ b/website/jp/examples/zip.md @@ -0,0 +1 @@ +TODO diff --git a/website/jp/main.go b/website/jp/main.go index bdf97870f..d22a79829 100644 --- a/website/jp/main.go +++ b/website/jp/main.go @@ -1,7 +1,9 @@ package main import ( + "embed" "fmt" + "os" "strings" jpfunctions "github.com/jmespath-community/go-jmespath/pkg/functions" @@ -10,6 +12,9 @@ import ( kyvernofunctions "github.com/kyverno/kyverno-json/pkg/engine/template/kyverno" ) +//go:embed examples +var examples embed.FS + func main() { fmt.Println("# Functions") fmt.Println() @@ -35,17 +40,23 @@ func main() { fmt.Println() printFunctions(chainsawfunctions.GetFunctions()...) fmt.Println() - fmt.Println("## examples") - fmt.Println() - fmt.Println("- [x_k8s_get](./examples/x_k8s_get.md)") - fmt.Println() } func printFunctions(funcs ...jpfunctions.FunctionEntry) { - fmt.Println("| Name | Signature |") - fmt.Println("|---|---|") + fmt.Println("| Name | Signature | Description |") + fmt.Println("|---|---|---|") for _, function := range funcs { - fmt.Println("|", function.Name, "|", "`"+functionString(function)+"`", "|") + sig := functionString(function) + fmt.Println("|", fmt.Sprintf("[%s](./examples/%s.md)", function.Name, function.Name), "|", "`"+sig+"`", "|", function.Description, "|") + data := fmt.Sprintf("# %s\n\n## Signature\n\n`%s`\n\n## Description\n\n%s\n\n## Examples\n\n", function.Name, sig, function.Description) + if e, err := examples.ReadFile(fmt.Sprintf("examples/%s.md", function.Name)); err != nil { + panic(err) + } else { + data += string(e) + } + if err := os.WriteFile(fmt.Sprintf("./website/docs/reference/jp/examples/%s.md", function.Name), []byte(data), 0o600); err != nil { + panic(err) + } } }