diff --git a/docs/reference/remap/expressions/assignment.cue b/docs/reference/remap/expressions/assignment.cue index 1b7d5cbc571f8..57fc1b0846e3c 100644 --- a/docs/reference/remap/expressions/assignment.cue +++ b/docs/reference/remap/expressions/assignment.cue @@ -13,7 +13,7 @@ remap: expressions: assignment: { grammar: { source: """ - target ~ operator ~ expression + target ~ ("," ~ error)? ~ operator ~ expression """ definitions: { target: { @@ -22,6 +22,12 @@ remap: expressions: assignment: { with an optional second variable for error handling if the right-hand side is fallible. """ } + error: { + description: """ + The `error` allows for optional assignment to errors when the right-hand side expression is + fallible. This is commonly used when invoking fallible functions. + """ + } operator: { description: """ The `operator` delimits the `target` and `expression` and defines assignment conditions. diff --git a/docs/reference/remap/functions.cue b/docs/reference/remap/functions.cue index 2c6065f9bb8ea..91bf994189d0d 100644 --- a/docs/reference/remap/functions.cue +++ b/docs/reference/remap/functions.cue @@ -18,7 +18,10 @@ remap: { notices: [string, ...string] | *[] arguments: [...#Argument] - return: [remap.#Type, ...remap.#Type] + return: { + types: [remap.#Type, ...remap.#Type] + rules?: [string, ...string] + } internal_failure_reasons: [...string] examples?: [remap.#Example, ...remap.#Example] } diff --git a/docs/reference/remap/functions/append.cue b/docs/reference/remap/functions/append.cue index 1ad50eb4e0de1..bba38a2cbb1ca 100644 --- a/docs/reference/remap/functions/append.cue +++ b/docs/reference/remap/functions/append.cue @@ -16,7 +16,7 @@ remap: functions: append: { }, ] internal_failure_reasons: [] - return: ["array"] + return: types: ["array"] category: "Array" description: """ Adds each item from an array to the end of another array. diff --git a/docs/reference/remap/functions/assert.cue b/docs/reference/remap/functions/assert.cue index 173352d7e83cd..77e5810857eb5 100644 --- a/docs/reference/remap/functions/assert.cue +++ b/docs/reference/remap/functions/assert.cue @@ -18,7 +18,7 @@ remap: functions: assert: { internal_failure_reasons: [ "`condition` evaluates to `false`", ] - return: ["null"] + return: types: ["null"] category: "Debug" description: #""" Checks a given condition. diff --git a/docs/reference/remap/functions/ceil.cue b/docs/reference/remap/functions/ceil.cue index 6f33f02665ffd..03e547b3d4ece 100644 --- a/docs/reference/remap/functions/ceil.cue +++ b/docs/reference/remap/functions/ceil.cue @@ -17,7 +17,12 @@ remap: functions: ceil: { }, ] internal_failure_reasons: [] - return: ["timestamp"] + return: { + types: ["integer", "float"] + rules: [ + "If `precision` is `0`, then an integer is returned, otherwise a float is returned.", + ] + } category: "Number" description: #""" Rounds the given number up to the specified `precision`. diff --git a/docs/reference/remap/functions/compact.cue b/docs/reference/remap/functions/compact.cue index fdef0c7a74e72..21edd035f1686 100644 --- a/docs/reference/remap/functions/compact.cue +++ b/docs/reference/remap/functions/compact.cue @@ -52,7 +52,12 @@ remap: functions: compact: { }, ] internal_failure_reasons: [] - return: ["array", "map"] + return: { + types: ["array", "map"] + rules: [ + "The return type will match the `value` type.", + ] + } category: "Enumerate" description: #""" Compacts an `array` or `map` by removing "empty" values. diff --git a/docs/reference/remap/functions/contains.cue b/docs/reference/remap/functions/contains.cue index 89ceb76c0cf08..d54dca734e77b 100644 --- a/docs/reference/remap/functions/contains.cue +++ b/docs/reference/remap/functions/contains.cue @@ -23,7 +23,7 @@ remap: functions: contains: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "String" description: #""" Determines if the provided `value` contains a given `substring`. diff --git a/docs/reference/remap/functions/decode_base64.cue b/docs/reference/remap/functions/decode_base64.cue index 02e86ffefe083..2f17d26598ce4 100644 --- a/docs/reference/remap/functions/decode_base64.cue +++ b/docs/reference/remap/functions/decode_base64.cue @@ -12,7 +12,7 @@ remap: functions: decode_base64: { internal_failure_reasons: [ "`value` is not a valid encoded base64 string.", ] - return: ["string"] + return: types: ["string"] category: "Codec" description: """ Decodes the provided `value` (a [Base64](\(urls.base64)) string) into it's original string. diff --git a/docs/reference/remap/functions/del.cue b/docs/reference/remap/functions/del.cue index 7bbb2334a6f53..32570d0d8ae34 100644 --- a/docs/reference/remap/functions/del.cue +++ b/docs/reference/remap/functions/del.cue @@ -10,7 +10,12 @@ remap: functions: del: { }, ] internal_failure_reasons: [] - return: ["any"] + return: { + types: ["any"] + rules: [ + "The return is the value of the field being deleted.", + ] + } category: "Event" description: #""" Removes the field specified by the given path from the event object. diff --git a/docs/reference/remap/functions/downcase.cue b/docs/reference/remap/functions/downcase.cue index 1922129e57622..0ea8de18e3f7c 100644 --- a/docs/reference/remap/functions/downcase.cue +++ b/docs/reference/remap/functions/downcase.cue @@ -10,7 +10,7 @@ remap: functions: downcase: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Returns a copy of `value` that is entirely lowercase. diff --git a/docs/reference/remap/functions/encode_base64.cue b/docs/reference/remap/functions/encode_base64.cue index 78eabce7140ac..4340873ac016a 100644 --- a/docs/reference/remap/functions/encode_base64.cue +++ b/docs/reference/remap/functions/encode_base64.cue @@ -17,7 +17,7 @@ remap: functions: encode_base64: { }, { name: "charset" - description: "" + description: "The character set to use when encoding the data." required: false type: ["string"] default: "standard" @@ -28,7 +28,7 @@ remap: functions: encode_base64: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Codec" description: #""" Encodes the provided `value` to [Base64](\(urls.base64)) either padded or non-padded and diff --git a/docs/reference/remap/functions/encode_json.cue b/docs/reference/remap/functions/encode_json.cue index 6fcfca915c526..e7b268d55d502 100644 --- a/docs/reference/remap/functions/encode_json.cue +++ b/docs/reference/remap/functions/encode_json.cue @@ -10,7 +10,7 @@ remap: functions: encode_json: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Codec" description: """ Encodes the provided `value` into JSON. diff --git a/docs/reference/remap/functions/ends_with.cue b/docs/reference/remap/functions/ends_with.cue index 5fff2538d4b6d..2609caf5452b7 100644 --- a/docs/reference/remap/functions/ends_with.cue +++ b/docs/reference/remap/functions/ends_with.cue @@ -23,7 +23,7 @@ remap: functions: ends_with: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "String" description: #""" Determines if the provided `value` ends with a given `substring`. diff --git a/docs/reference/remap/functions/exists.cue b/docs/reference/remap/functions/exists.cue index c68f9ff3bb7f5..16bd7de6b947f 100644 --- a/docs/reference/remap/functions/exists.cue +++ b/docs/reference/remap/functions/exists.cue @@ -11,7 +11,7 @@ remap: functions: exists: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "Event" description: #""" Checks if the given `path` exists. Nested paths and arrays can also be checked. diff --git a/docs/reference/remap/functions/flatten.cue b/docs/reference/remap/functions/flatten.cue index 0998b49fb69f0..1872a49e3db60 100644 --- a/docs/reference/remap/functions/flatten.cue +++ b/docs/reference/remap/functions/flatten.cue @@ -10,7 +10,12 @@ remap: functions: flatten: { }, ] internal_failure_reasons: [] - return: ["array", "map"] + return: { + types: ["array", "map"] + rules: [ + "The return type will match the `value` type.", + ] + } category: "Enumerate" description: #""" Returns a nested `array` or `map` that has been flattened to a single level. diff --git a/docs/reference/remap/functions/floor.cue b/docs/reference/remap/functions/floor.cue index 19cff74eba503..0866e11c466ef 100644 --- a/docs/reference/remap/functions/floor.cue +++ b/docs/reference/remap/functions/floor.cue @@ -17,7 +17,12 @@ remap: functions: floor: { }, ] internal_failure_reasons: [] - return: ["timestamp"] + return: { + types: ["integer", "float"] + rules: [ + "If `precision` is `0`, then an integer is returned, otherwise a float is returned.", + ] + } category: "Number" description: #""" Rounds the given `value` down to the specified `precision`. diff --git a/docs/reference/remap/functions/format_number.cue b/docs/reference/remap/functions/format_number.cue index 4d79a171d4480..285a0ae269084 100644 --- a/docs/reference/remap/functions/format_number.cue +++ b/docs/reference/remap/functions/format_number.cue @@ -30,7 +30,7 @@ remap: functions: format_number: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Number" description: #""" Formats the given `value` into a string representation of the number. diff --git a/docs/reference/remap/functions/format_timestamp.cue b/docs/reference/remap/functions/format_timestamp.cue index 15f9984ac78ac..3ee3daff262dd 100644 --- a/docs/reference/remap/functions/format_timestamp.cue +++ b/docs/reference/remap/functions/format_timestamp.cue @@ -16,7 +16,7 @@ remap: functions: format_timestamp: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Timestamp" description: #""" Formats the provided `value` into a `string` as described by `format`. diff --git a/docs/reference/remap/functions/get_env_var.cue b/docs/reference/remap/functions/get_env_var.cue index 3acfae90f2459..c7fa6573a8efe 100644 --- a/docs/reference/remap/functions/get_env_var.cue +++ b/docs/reference/remap/functions/get_env_var.cue @@ -13,7 +13,7 @@ remap: functions: get_env_var: { "Environment variable `name` does not exist", "Value of environment variable `name` is not valid unicode", ] - return: ["string"] + return: types: ["string"] category: "System" description: #""" Get the value of an environment variable. If the variable does not exists, an error is returned. diff --git a/docs/reference/remap/functions/includes.cue b/docs/reference/remap/functions/includes.cue index 0e4cef8434c1b..cd3447a20a16c 100644 --- a/docs/reference/remap/functions/includes.cue +++ b/docs/reference/remap/functions/includes.cue @@ -16,7 +16,7 @@ remap: functions: includes: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "Enumerate" description: """ Determines whether the provided `values` contains the provided `item`. diff --git a/docs/reference/remap/functions/ip_cidr_contains.cue b/docs/reference/remap/functions/ip_cidr_contains.cue index d26ba583dbfe4..0582a3449153f 100644 --- a/docs/reference/remap/functions/ip_cidr_contains.cue +++ b/docs/reference/remap/functions/ip_cidr_contains.cue @@ -19,7 +19,7 @@ remap: functions: ip_cidr_contains: { "`cidr` is not a valid CIDR", "`ip` is not a valid IP address", ] - return: ["boolean"] + return: types: ["boolean"] category: "IP" description: #""" Returns `true` if the given `ip` is contained within the block referenced by the `cidr`. diff --git a/docs/reference/remap/functions/ip_subnet.cue b/docs/reference/remap/functions/ip_subnet.cue index 8e993cdd5921d..8166a63c05469 100644 --- a/docs/reference/remap/functions/ip_subnet.cue +++ b/docs/reference/remap/functions/ip_subnet.cue @@ -22,7 +22,7 @@ remap: functions: ip_subnet: { "`ip` is not a valid IP address", "`subnet` is not a valid subnet.", ] - return: ["string"] + return: types: ["string"] category: "IP" description: #""" Extracts the subnet address from the given `ip` using the supplied `subnet`. diff --git a/docs/reference/remap/functions/ip_to_ipv6.cue b/docs/reference/remap/functions/ip_to_ipv6.cue index 51c6f2f01b169..0cceb4fa76bfe 100644 --- a/docs/reference/remap/functions/ip_to_ipv6.cue +++ b/docs/reference/remap/functions/ip_to_ipv6.cue @@ -12,13 +12,16 @@ remap: functions: ip_to_ipv6: { internal_failure_reasons: [ "`ip` is not a valid IP address", ] - return: ["string"] + return: { + types: ["string"] + rules: [ + "If `ip` is already an IPv6 address it is passed through untouched.", + "If `ip` is a IPv4 address then it converted to IPv4 mapped IPv6 addresses.", + ] + } category: "IP" description: #""" Converts the provided `ip` to an IPv6 address. - - If the parameter is already an IPv6 address it is passed through untouched. IPv4 addresses are converted to - IPv4 mapped IPv6 addresses. """# examples: [ { diff --git a/docs/reference/remap/functions/ipv6_to_ipv4.cue b/docs/reference/remap/functions/ipv6_to_ipv4.cue index 18b837631b9b4..82a958b2c4e8f 100644 --- a/docs/reference/remap/functions/ipv6_to_ipv4.cue +++ b/docs/reference/remap/functions/ipv6_to_ipv4.cue @@ -13,13 +13,15 @@ remap: functions: ipv6_to_ipv4: { "`ip` is not a valid IP address", "`ip` is an IPv6 address that is not compatible with IPv4", ] - return: ["string"] + return: { + types: ["string"] + rules: [ + "If the parameter is already an IPv4 address it is passed through untouched. If it is an IPv6 address it has to be an IPv4 compatible address.", + ] + } category: "IP" description: #""" Converts the provided `ip` to an IPv4 address. - - If the parameter is already an IPv4 address it is passed through untouched. If it is an IPv6 address it has - to be an IPv4 compatible address. """# examples: [ { diff --git a/docs/reference/remap/functions/is_nullish.cue b/docs/reference/remap/functions/is_nullish.cue index e95b60fafe7b6..e780fa6e935da 100644 --- a/docs/reference/remap/functions/is_nullish.cue +++ b/docs/reference/remap/functions/is_nullish.cue @@ -10,16 +10,17 @@ remap: functions: is_nullish: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: { + types: ["boolean"] + rules: [ + #"If `value` is `null`, then `true` is returned."#, + #"If `value` is `"-"`, then `true` is returned."#, + #"If `value` is whitespace, as defined by [Unicode `White_Space` property](\#(urls.unicode_whitespace)), then `true` is returned."#, + ] + } category: "Type" description: #""" - Determines whether the provided `value` is "nullish," - - Nullish indicates the absence of a meaningful value. The following are considered nullish in VRL: - - * `null` - * `"-"` (A single dash) - * Whitespace as defined by [Unicode `White_Space` property](\(urls.unicode_whitespace)) + Determines whether the provided `value` is "nullish,". Nullish indicates the absence of a meaningful value. """# examples: [ { diff --git a/docs/reference/remap/functions/length.cue b/docs/reference/remap/functions/length.cue index 3bedb47b74209..e0ac3ad433095 100644 --- a/docs/reference/remap/functions/length.cue +++ b/docs/reference/remap/functions/length.cue @@ -10,14 +10,17 @@ remap: functions: length: { }, ] internal_failure_reasons: [] - return: ["integer"] + return: { + types: ["integer"] + rules: [ + "If `value` is an array, the size of the array is returned.", + "If `value` is a string, the size of the string is returned.", + "If `value` is a map, the number of map keys is returned (nested keys are ignored)", + ] + } category: "Enumerate" description: """ - Returns the length of the input: - - * If an array, the size of the array - * If a string, the number of bytes in the string - * If a map, the number of keys in the map (nested keys are ignored) + Returns the length of the input. """ examples: [ { diff --git a/docs/reference/remap/functions/log.cue b/docs/reference/remap/functions/log.cue index e3956441a9f82..dcb190bc81120 100644 --- a/docs/reference/remap/functions/log.cue +++ b/docs/reference/remap/functions/log.cue @@ -24,7 +24,7 @@ remap: functions: log: { }, ] internal_failure_reasons: [] - return: ["null"] + return: types: ["null"] category: "Debug" description: """ Logs the supplied error message to Vector's [stdout](\(urls.stdout)) at the specified log diff --git a/docs/reference/remap/functions/match.cue b/docs/reference/remap/functions/match.cue index b87c934312a5a..f13f9cd62ad4c 100644 --- a/docs/reference/remap/functions/match.cue +++ b/docs/reference/remap/functions/match.cue @@ -16,7 +16,7 @@ remap: functions: match: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "String" description: """ Returns `true` if the provided `value` matches the provided `pattern`. diff --git a/docs/reference/remap/functions/md5.cue b/docs/reference/remap/functions/md5.cue index 54939371da69c..c98306eccf736 100644 --- a/docs/reference/remap/functions/md5.cue +++ b/docs/reference/remap/functions/md5.cue @@ -10,7 +10,7 @@ remap: functions: md5: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Hash" description: #""" Calculates an md5 hash of a given `value`. diff --git a/docs/reference/remap/functions/merge.cue b/docs/reference/remap/functions/merge.cue index 2db4ca2725469..cd83f0e76b1d8 100644 --- a/docs/reference/remap/functions/merge.cue +++ b/docs/reference/remap/functions/merge.cue @@ -23,7 +23,7 @@ remap: functions: merge: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["map"] category: "Map" description: #""" Merges the `from` map provided into the `to` map. diff --git a/docs/reference/remap/functions/now.cue b/docs/reference/remap/functions/now.cue index 4e5302b06c89c..3269c718a2af4 100644 --- a/docs/reference/remap/functions/now.cue +++ b/docs/reference/remap/functions/now.cue @@ -3,7 +3,7 @@ package metadata remap: functions: now: { arguments: [] internal_failure_reasons: [] - return: ["timestamp"] + return: types: ["timestamp"] category: "Timestamp" description: #""" Returns the current timestamp in the UTC timezone with nanosecond precision. diff --git a/docs/reference/remap/functions/parse_aws_alb_log.cue b/docs/reference/remap/functions/parse_aws_alb_log.cue index 3a7b1262b41a5..89411372846b4 100644 --- a/docs/reference/remap/functions/parse_aws_alb_log.cue +++ b/docs/reference/remap/functions/parse_aws_alb_log.cue @@ -12,7 +12,7 @@ remap: functions: parse_aws_alb_log: { internal_failure_reasons: [ "`value` is not a properly formatted AWS ALB log", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses a Elastic Load Balancer Access log into it's constituent components. diff --git a/docs/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue b/docs/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue index 27177551aee7f..347519405fc7b 100644 --- a/docs/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue +++ b/docs/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue @@ -12,7 +12,7 @@ remap: functions: parse_aws_cloudwatch_log_subscription_message: { internal_failure_reasons: [ "`value` is not a properly formatted AWS Cloudwatch Log subscription message", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses AWS CloudWatch Logs events (configured through AWS Cloudwatch diff --git a/docs/reference/remap/functions/parse_aws_vpc_flow_log.cue b/docs/reference/remap/functions/parse_aws_vpc_flow_log.cue index 25d370f30a005..92d406950c070 100644 --- a/docs/reference/remap/functions/parse_aws_vpc_flow_log.cue +++ b/docs/reference/remap/functions/parse_aws_vpc_flow_log.cue @@ -18,7 +18,7 @@ remap: functions: parse_aws_vpc_flow_log: { internal_failure_reasons: [ "`value` is not a properly formatted AWS VPC Flow log", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses [VPC Flow Logs]\(urls.aws_vpc_flow_logs\) into it's constituent components. diff --git a/docs/reference/remap/functions/parse_duration.cue b/docs/reference/remap/functions/parse_duration.cue index 678e03b79bef7..3a37b4fef74f8 100644 --- a/docs/reference/remap/functions/parse_duration.cue +++ b/docs/reference/remap/functions/parse_duration.cue @@ -30,7 +30,7 @@ remap: functions: parse_duration: { internal_failure_reasons: [ "`value` is not a properly formatted duration", ] - return: ["float"] + return: types: ["float"] category: "Parse" description: #""" Parses the provided `value` representing a duration in the specified `unit`. diff --git a/docs/reference/remap/functions/parse_grok.cue b/docs/reference/remap/functions/parse_grok.cue index a5a407ef58e4a..0350794ce9d46 100644 --- a/docs/reference/remap/functions/parse_grok.cue +++ b/docs/reference/remap/functions/parse_grok.cue @@ -25,7 +25,7 @@ remap: functions: parse_grok: { internal_failure_reasons: [ "`value` fails to parse via the provided `pattern`", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses the provided `value` using the Rust [`grok` library](https://github.com/daschl/grok). diff --git a/docs/reference/remap/functions/parse_json.cue b/docs/reference/remap/functions/parse_json.cue index ccb5976dc0097..c23049830323c 100644 --- a/docs/reference/remap/functions/parse_json.cue +++ b/docs/reference/remap/functions/parse_json.cue @@ -12,7 +12,7 @@ remap: functions: parse_json: { internal_failure_reasons: [ "`value` is not a valid JSON formatted payload", ] - return: ["boolean", "integer", "float", "string", "map", "array", "null"] + return: types: ["boolean", "integer", "float", "string", "map", "array", "null"] category: "Parse" description: #""" Parses the provided `value` as JSON. diff --git a/docs/reference/remap/functions/parse_key_value.cue b/docs/reference/remap/functions/parse_key_value.cue index d070ac54a2d0f..a1f263a74ef47 100644 --- a/docs/reference/remap/functions/parse_key_value.cue +++ b/docs/reference/remap/functions/parse_key_value.cue @@ -26,7 +26,7 @@ remap: functions: parse_key_value: { internal_failure_reasons: [ "`value` is not a properly formatted key/value string", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses the provided `value` in key value format. Also known as [logfmt](\(urls.logfmt)). diff --git a/docs/reference/remap/functions/parse_regex.cue b/docs/reference/remap/functions/parse_regex.cue index 4de107f725bb2..5936422c9071f 100644 --- a/docs/reference/remap/functions/parse_regex.cue +++ b/docs/reference/remap/functions/parse_regex.cue @@ -18,14 +18,16 @@ remap: functions: parse_regex: { internal_failure_reasons: [ "`value` fails to parse via the provided `pattern`", ] - return: ["map"] + return: { + types: ["map"] + rules: [ + "Matches will return the capture groups corresponding to the leftmost matches in the text.", + "If no match is found an empty map is returned.", + ] + } category: "Parse" description: """ Parses the provided `value` via the provided Regex `pattern`. - - * Capture groups are supported. - * Matches will return the capture groups corresponding to the leftmost matches in the text. - * If no match is found an empty map is returned. """ notices: [ """ diff --git a/docs/reference/remap/functions/parse_regex_all.cue b/docs/reference/remap/functions/parse_regex_all.cue index 4858a10360794..71d2c450f4989 100644 --- a/docs/reference/remap/functions/parse_regex_all.cue +++ b/docs/reference/remap/functions/parse_regex_all.cue @@ -18,14 +18,16 @@ remap: functions: parse_regex_all: { internal_failure_reasons: [ "`value` fails to parse via the provided `pattern`", ] - return: ["array"] + return: { + types: ["array"] + rules: [ + "Matches will return all capture groups corresponding to the leftmost matches in the text.", + "If no match is found an empty map is returned.", + ] + } category: "Parse" description: """ Parses the provided `value` via the provided Regex `pattern`. - - * Capture groups are supported. - * Returns all capture groups corresponding to the leftmost matches in the text. - * If no match is found an empty map is returned. """ examples: [ { diff --git a/docs/reference/remap/functions/parse_syslog.cue b/docs/reference/remap/functions/parse_syslog.cue index d8dbb800b3396..867d49b1d9f0e 100644 --- a/docs/reference/remap/functions/parse_syslog.cue +++ b/docs/reference/remap/functions/parse_syslog.cue @@ -10,7 +10,7 @@ remap: functions: parse_syslog: { internal_failure_reasons: [ "`value` is not a properly formatted Syslog 5424 or 3164 formatted log", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses the provided `value` in Syslog format. diff --git a/docs/reference/remap/functions/parse_timestamp.cue b/docs/reference/remap/functions/parse_timestamp.cue index f97758e89bc44..305eacbe58a61 100644 --- a/docs/reference/remap/functions/parse_timestamp.cue +++ b/docs/reference/remap/functions/parse_timestamp.cue @@ -19,7 +19,7 @@ remap: functions: parse_timestamp: { internal_failure_reasons: [ "`value` fails to parse via the provided `format`", ] - return: ["timestamp"] + return: types: ["timestamp"] category: "Parse" description: #""" Parses the provided `value` via the provided `format`. diff --git a/docs/reference/remap/functions/parse_tokens.cue b/docs/reference/remap/functions/parse_tokens.cue index 921f52494e1e7..26e7a317c1dc3 100644 --- a/docs/reference/remap/functions/parse_tokens.cue +++ b/docs/reference/remap/functions/parse_tokens.cue @@ -12,7 +12,7 @@ remap: functions: parse_tokens: { internal_failure_reasons: [ "`value` is not a properly formatted tokenized string", ] - return: ["array"] + return: types: ["array"] category: "Parse" description: #""" Parses the provided `value` in token format. diff --git a/docs/reference/remap/functions/parse_url.cue b/docs/reference/remap/functions/parse_url.cue index 9b02835f6268a..4cee0ffbca3b9 100644 --- a/docs/reference/remap/functions/parse_url.cue +++ b/docs/reference/remap/functions/parse_url.cue @@ -12,7 +12,7 @@ remap: functions: parse_url: { internal_failure_reasons: [ "`value` is not a properly formatted URL", ] - return: ["map"] + return: types: ["map"] category: "Parse" description: #""" Parses the provided `value` in URL format. diff --git a/docs/reference/remap/functions/push.cue b/docs/reference/remap/functions/push.cue index f537ac5302b8d..afb932e09e0f7 100644 --- a/docs/reference/remap/functions/push.cue +++ b/docs/reference/remap/functions/push.cue @@ -16,7 +16,12 @@ remap: functions: push: { }, ] internal_failure_reasons: [] - return: ["array"] + return: { + types: ["array"] + rules: [ + "A new array is returned, the `value` is not modified in place.", + ] + } category: "Array" description: """ Adds the provided `item` to the end of the `value` array. diff --git a/docs/reference/remap/functions/redact.cue b/docs/reference/remap/functions/redact.cue index 0cb8421681c6c..6d228232a4b63 100644 --- a/docs/reference/remap/functions/redact.cue +++ b/docs/reference/remap/functions/redact.cue @@ -37,7 +37,7 @@ remap: functions: redact: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: """ Redacts sensitive data in the provided `value` via the specified `patterns`. diff --git a/docs/reference/remap/functions/replace.cue b/docs/reference/remap/functions/replace.cue index 327d0862d00b8..882b20e2e20a9 100644 --- a/docs/reference/remap/functions/replace.cue +++ b/docs/reference/remap/functions/replace.cue @@ -30,7 +30,7 @@ remap: functions: replace: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Replaces any matching patterns in the provided `value` via the provided `pattern`. diff --git a/docs/reference/remap/functions/round.cue b/docs/reference/remap/functions/round.cue index 734a324ba2f40..92d8c9c7f96c0 100644 --- a/docs/reference/remap/functions/round.cue +++ b/docs/reference/remap/functions/round.cue @@ -17,7 +17,12 @@ remap: functions: round: { }, ] internal_failure_reasons: [] - return: ["timestamp"] + return: { + types: ["integer", "float"] + rules: [ + "If `precision` is `0`, then an integer is returned, otherwise a float is returned.", + ] + } category: "Number" description: #""" Rounds the provided `value` to number to the specified `precision`. diff --git a/docs/reference/remap/functions/sha1.cue b/docs/reference/remap/functions/sha1.cue index 117bcaba4369c..2d6d86657ca70 100644 --- a/docs/reference/remap/functions/sha1.cue +++ b/docs/reference/remap/functions/sha1.cue @@ -10,7 +10,7 @@ remap: functions: sha1: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Hash" description: #""" Calculates a sha1 hash of the provided `value`. diff --git a/docs/reference/remap/functions/sha2.cue b/docs/reference/remap/functions/sha2.cue index 0d661db1897e4..4303408d3ebcc 100644 --- a/docs/reference/remap/functions/sha2.cue +++ b/docs/reference/remap/functions/sha2.cue @@ -9,24 +9,23 @@ remap: functions: sha2: { type: ["string"] }, { - name: "variant" - description: #""" - The variant of the algorithm to use. - The allowed variants are: - - SHA-224 - - SHA-256 - - SHA-384 - - SHA-512 - - SHA-512/224 - - SHA-512/256 - """# + name: "variant" + description: "The variant of the algorithm to use." + enum: { + "SHA-224": "SHA-224 algorithm" + "SHA-256": "SHA-256 algorithm" + "SHA-384": "SHA-384 algorithm" + "SHA-512": "SHA-512 algorithm" + "SHA-512/224": "SHA-512/224 algorithm" + "SHA-512/256": "SHA-512/256 algorithm" + } required: false default: "SHA-512/256" type: ["string"] }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Hash" description: #""" Calculates a sha2 hash of the provided `value`. diff --git a/docs/reference/remap/functions/sha3.cue b/docs/reference/remap/functions/sha3.cue index 896ae569b0be6..f62817dadde60 100644 --- a/docs/reference/remap/functions/sha3.cue +++ b/docs/reference/remap/functions/sha3.cue @@ -9,22 +9,21 @@ remap: functions: sha3: { type: ["string"] }, { - name: "variant" - description: #""" - The variant of the algorithm to use. - The allowed variants are: - - SHA3-224 - - SHA3-256 - - SHA3-384 - - SHA3-512 - """# + name: "variant" + description: "The variant of the algorithm to use." + enum: { + "SHA3-224": "SHA3-224 algorithm" + "SHA3-256": "SHA3-256 algorithm" + "SHA3-384": "SHA3-384 algorithm" + "SHA3-512": "SHA3-512 algorithm" + } required: false default: "SHA3-512" type: ["string"] }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Hash" description: #""" Calculates a sha3 hash of the provided `value`. diff --git a/docs/reference/remap/functions/slice.cue b/docs/reference/remap/functions/slice.cue index 417c449c3b8a4..1bf0a89abdae9 100644 --- a/docs/reference/remap/functions/slice.cue +++ b/docs/reference/remap/functions/slice.cue @@ -23,7 +23,7 @@ remap: functions: slice: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Returns a slice of the provided `value` between the `start` and `end` positions specified. diff --git a/docs/reference/remap/functions/split.cue b/docs/reference/remap/functions/split.cue index 681246844c1d7..916a62047661a 100644 --- a/docs/reference/remap/functions/split.cue +++ b/docs/reference/remap/functions/split.cue @@ -22,12 +22,15 @@ remap: functions: split: { }, ] internal_failure_reasons: [] - return: ["string"] + return: { + types: ["string"] + rules: [ + "If `limit` is specified, after `limit` has been reached, the remainder of the string is returned unsplit.", + ] + } category: "String" description: #""" Splits the given `value` via the provided `pattern`. - - If `limit` is specified, after `limit` has been reached, the remainder of the string is returned unsplit. """# examples: [ { diff --git a/docs/reference/remap/functions/starts_with.cue b/docs/reference/remap/functions/starts_with.cue index 39d5b87277a1c..b1eb768dc71dd 100644 --- a/docs/reference/remap/functions/starts_with.cue +++ b/docs/reference/remap/functions/starts_with.cue @@ -23,10 +23,10 @@ remap: functions: starts_with: { }, ] internal_failure_reasons: [] - return: ["boolean"] + return: types: ["boolean"] category: "String" description: #""" - Determines if a given `valuye` begins with the given `substring`. + Determines if a given `value` begins with the given `substring`. """# examples: [ { diff --git a/docs/reference/remap/functions/strip_ansi_escape_codes.cue b/docs/reference/remap/functions/strip_ansi_escape_codes.cue index 49da9d65af596..4783d4e29a472 100644 --- a/docs/reference/remap/functions/strip_ansi_escape_codes.cue +++ b/docs/reference/remap/functions/strip_ansi_escape_codes.cue @@ -10,7 +10,7 @@ remap: functions: strip_ansi_escape_codes: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Strips any [ANSI escape codes](\(urls.ansi_escape_codes)) from the provided `value`. diff --git a/docs/reference/remap/functions/strip_whitespace.cue b/docs/reference/remap/functions/strip_whitespace.cue index d298de8159824..42bbaad821ec6 100644 --- a/docs/reference/remap/functions/strip_whitespace.cue +++ b/docs/reference/remap/functions/strip_whitespace.cue @@ -10,7 +10,7 @@ remap: functions: strip_whitespace: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Strips the whitespace from the start and end of the provided `value`. diff --git a/docs/reference/remap/functions/to_bool.cue b/docs/reference/remap/functions/to_bool.cue index 5bf3157f808b5..9c19e63036604 100644 --- a/docs/reference/remap/functions/to_bool.cue +++ b/docs/reference/remap/functions/to_bool.cue @@ -10,20 +10,20 @@ remap: functions: to_bool: { internal_failure_reasons: [ "`value` is not a supported boolean representation", ] - return: ["float"] + return: { + types: ["boolean"] + rules: [ + #"If `value` is `"true"`, `"t"`, `"yes"`, `"y"` then `true` is returned."#, + #"If `value` is `"false"`, `"f"`, `"no"`, `"n"`, `"0"` then `false` is returned."#, + #"If `value` is `0.0` then `false` is returned, otherwise `true` is returned."#, + #"If `value` is `0` then `false` is returned, otherwise `true` is returned."#, + #"If `value` is `null` then `false` is returned."#, + #"If `value` is a boolean then it is passed through."#, + ] + } category: "Coerce" description: #""" Coerces the provided `value` into a `boolean`. - - The conversion rules vary by type: - - | Type | `true` values | `false` values | - |:----------|:--------------|:---------------| - | `string` | `"true"`, `"t"`, `"yes"`, `"y"` | `"false"`, `"f"`, `"no"`, `"n"`, `"0"` | - | `float` | == `0.0` | != `0.0` | - | `int` | == `0` | != `0` | - | `null` | | `null` | - | `boolean` | `true` | `false` | """# examples: [ { diff --git a/docs/reference/remap/functions/to_float.cue b/docs/reference/remap/functions/to_float.cue index aaa8288e63529..edcde7a12e4fa 100644 --- a/docs/reference/remap/functions/to_float.cue +++ b/docs/reference/remap/functions/to_float.cue @@ -10,10 +10,17 @@ remap: functions: to_float: { internal_failure_reasons: [ "`value` is not a supported float representation", ] - return: ["float"] + return: { + types: ["float"] + rules: [ + "If `value` is a string, it must be the string representation of an float or else an error is raised.", + "If `value` is a boolean, `0.0` will be returned for `false` and `1.0` will be returned for `true`.", + "", + ] + } category: "Coerce" description: #""" - Coerces the provided `values` into a `float`. + Coerces the provided `value` into a `float`. """# examples: [ { diff --git a/docs/reference/remap/functions/to_int.cue b/docs/reference/remap/functions/to_int.cue index e4391d591529b..1a999f9228e6e 100644 --- a/docs/reference/remap/functions/to_int.cue +++ b/docs/reference/remap/functions/to_int.cue @@ -1,23 +1,25 @@ remap: functions: to_int: { arguments: [ { - name: "value" + name: "value" description: """ The value to convert to an integer. - - * If a string, it must be the string representation of an integer or else an error - is raised. - * If a Boolean, returns `0` for `false` and `1` for `true`. - * If a timestamp, returns the [Unix timestamp](\(urls.unix_timestamp)) in seconds. """ - required: true + required: true type: ["integer", "float", "boolean", "string", "timestamp"] }, ] internal_failure_reasons: [ "`value` is not a supported integer representation", ] - return: ["integer"] + return: { + types: ["integer"] + rules: [ + "If `value` is a string, it must be the string representation of an integer or else an error is raised.", + "If `value` is a boolean, `0` will be returned for `false` and `1` will be returned for `true`.", + "If `value` is a timestamp, a [Unix timestamp](\(urls.unix_timestamp)) (in seconds) is returned.", + ] + } category: "Coerce" description: #""" Coerces the provided `value` into a `string`. diff --git a/docs/reference/remap/functions/to_string.cue b/docs/reference/remap/functions/to_string.cue index 056792b46af83..7f42ed6156ed7 100644 --- a/docs/reference/remap/functions/to_string.cue +++ b/docs/reference/remap/functions/to_string.cue @@ -10,7 +10,17 @@ remap: functions: to_string: { }, ] internal_failure_reasons: [] - return: ["string"] + return: { + types: ["string"] + rules: [ + #"If `value` is an integer then its string representation is returned."#, + #"If `value` is an float then its string representation is returned."#, + #"If `value` is an boolean then `"true"` or `"false"` is returned."#, + #"If `value` is an timestamp then its RFC3339 representation is returned."#, + #"If `value` is a map then it is encoded into JSON."#, + #"If `value` is a list then it is encoded into JSON."#, + ] + } category: "Coerce" description: #""" Coerces the provided `value` into a `string`. diff --git a/docs/reference/remap/functions/to_syslog_facility.cue b/docs/reference/remap/functions/to_syslog_facility.cue index 0ff6a97bf6763..758f12e4fdacb 100644 --- a/docs/reference/remap/functions/to_syslog_facility.cue +++ b/docs/reference/remap/functions/to_syslog_facility.cue @@ -10,9 +10,9 @@ remap: functions: to_syslog_facility: { }, ] internal_failure_reasons: [ - "`value` is not a valid Syslog facility code", + "`value` is not a valid Syslog [facility code](\(urls.syslog_facility)).", ] - return: ["string"] + return: types: ["string"] category: "Coerce" description: """ Coerces the provided `value`, a Syslog [facility code](\(urls.syslog_facility)), into its corresponding diff --git a/docs/reference/remap/functions/to_syslog_level.cue b/docs/reference/remap/functions/to_syslog_level.cue index e699ac6331750..ada4363aaa4fe 100644 --- a/docs/reference/remap/functions/to_syslog_level.cue +++ b/docs/reference/remap/functions/to_syslog_level.cue @@ -10,9 +10,9 @@ remap: functions: to_syslog_level: { }, ] internal_failure_reasons: [ - "`value` is not a valid Syslog level", + "`value` is not a valid Syslog [severity level](\(urls.syslog_levels)).", ] - return: ["string"] + return: types: ["string"] category: "Coerce" description: """ Coerces the provided `value`, a Syslog [severity level](\(urls.syslog_levels)), into its corresponding keyword, diff --git a/docs/reference/remap/functions/to_syslog_severity.cue b/docs/reference/remap/functions/to_syslog_severity.cue index 3d452e6d137d2..8d9ad7b8ce0c2 100644 --- a/docs/reference/remap/functions/to_syslog_severity.cue +++ b/docs/reference/remap/functions/to_syslog_severity.cue @@ -12,13 +12,16 @@ remap: functions: to_syslog_severity: { internal_failure_reasons: [ "`value` is not a valid Syslog level keyword", ] - return: ["integer"] + return: { + types: ["integer"] + rules: [ + "The now-deprecated keywords `panic`, `error`, and `warn` are converted to `0`, `3`, and `4` respectively.", + ] + } category: "Coerce" description: """ Coerces the provided `value`, a Syslog [log level keyword](\(urls.syslog_levels)), into an Syslog integer severity level (0 to 7). - - The now-deprecated keywords `panic`, `error`, and `warn` are converted to `0`, `3`, and `4` respectively. """ examples: [ diff --git a/docs/reference/remap/functions/to_timestamp.cue b/docs/reference/remap/functions/to_timestamp.cue index 7f842cd3acf14..6b37936d36f13 100644 --- a/docs/reference/remap/functions/to_timestamp.cue +++ b/docs/reference/remap/functions/to_timestamp.cue @@ -11,13 +11,16 @@ remap: functions: to_timestamp: { "When `value` is a `string`, it is not a valid timestamp format", "When `value` is an `int`, it is not within the Unix timestamp range", ] - return: ["timestamp"] + return: { + types: ["timestamp"] + rules: [ + "If `value` is a `string`, the timestamp is parsed in these formats.", + "If `value` is an `integer`, it assumed to be a Unix representation of the timestamp (the number of seconds after January 1st, 1970).", + ] + } category: "Coerce" description: #""" Coerces the provided `value` into a `timestamp`. - - * If `value` is a `string`, the timestamp is parsed in these formats. - * If `value` is an `integer`, it assumed to be a Unix representation of the timestamp (the number of seconds after January 1st, 1970). """# examples: [ { diff --git a/docs/reference/remap/functions/to_unix_timestamp.cue b/docs/reference/remap/functions/to_unix_timestamp.cue index 250e9cc928f2c..af592b36beb05 100644 --- a/docs/reference/remap/functions/to_unix_timestamp.cue +++ b/docs/reference/remap/functions/to_unix_timestamp.cue @@ -22,7 +22,7 @@ remap: functions: to_unix_timestamp: { }, ] internal_failure_reasons: [] - return: ["integer"] + return: types: ["integer"] category: "Coerce" description: """ Coerces the provided `value` into a [Unix timestamp](\(urls.unix_timestamp)). diff --git a/docs/reference/remap/functions/truncate.cue b/docs/reference/remap/functions/truncate.cue index cefaa11f41948..ed20764fd50be 100644 --- a/docs/reference/remap/functions/truncate.cue +++ b/docs/reference/remap/functions/truncate.cue @@ -22,13 +22,16 @@ remap: functions: truncate: { }, ] internal_failure_reasons: [] - return: ["string"] + return: { + types: ["string"] + rules: [ + "If `limit` is larger than the length of the string, the string is returned unchanged.", + "If `ellipsis` is `true`, then an ellipsis (...) will be appended to the string (beyond the specified limit).", + ] + } category: "String" description: #""" Truncates the provided `value` up to the provided `limit`. - - * If `limit` is larger than the length of the string, the string is returned unchanged. - * If `ellipsis` is `true`, then an ellipsis (...) will be appended to the string (beyond the specified limit). """# examples: [ { diff --git a/docs/reference/remap/functions/upcase.cue b/docs/reference/remap/functions/upcase.cue index e913f3538214b..e50ac0d22abc3 100644 --- a/docs/reference/remap/functions/upcase.cue +++ b/docs/reference/remap/functions/upcase.cue @@ -10,7 +10,7 @@ remap: functions: upcase: { }, ] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "String" description: #""" Returns a copy of `value` that is entirely uppercase. diff --git a/docs/reference/remap/functions/uuid_v4.cue b/docs/reference/remap/functions/uuid_v4.cue index 8967021757b9e..792776125d8f7 100644 --- a/docs/reference/remap/functions/uuid_v4.cue +++ b/docs/reference/remap/functions/uuid_v4.cue @@ -3,7 +3,7 @@ package metadata remap: functions: uuid_v4: { arguments: [] internal_failure_reasons: [] - return: ["string"] + return: types: ["string"] category: "Random" description: #""" Generates a random [UUIDv4](\(urls.uuidv4)) string.