From 52f1784e45b670878551cd56956b66b227898380 Mon Sep 17 00:00:00 2001 From: Josh Liburdi Date: Mon, 18 Dec 2023 04:58:32 +0000 Subject: [PATCH] build(config): Update libsonnet --- build/config/substation.libsonnet | 5 +++-- .../build/config/condition/meta/if_all_else/config.jsonnet | 4 ++-- .../build/config/transform/aggregate/sample/config.jsonnet | 6 +++--- examples/build/config/transform/array/group/config.jsonnet | 2 +- .../config/transform/meta/crash_program/config.jsonnet | 2 +- .../config/transform/meta/retry_with_backoff/config.jsonnet | 4 ++-- .../aws/kinesis/firehose/config/processor/config.jsonnet | 2 +- .../lambda/microservice/config/microservice/config.jsonnet | 2 +- .../aws/sqs/microservice/config/frontend/config.jsonnet | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/build/config/substation.libsonnet b/build/config/substation.libsonnet index ef547e8f..5583ad0f 100644 --- a/build/config/substation.libsonnet +++ b/build/config/substation.libsonnet @@ -45,7 +45,7 @@ or(settings={}): { local default = { object: $.config.object, - operand: null, + value: null, }, type: 'number_bitwise_or', @@ -54,7 +54,7 @@ xor(settings={}): { local default = { object: $.config.object, - operand: null, + value: null, }, type: 'number_bitwise_xor', @@ -761,6 +761,7 @@ local default = { object: $.config.object, pattern: null, + count: 0, }, type: 'string_capture', diff --git a/examples/build/config/condition/meta/if_all_else/config.jsonnet b/examples/build/config/condition/meta/if_all_else/config.jsonnet index c30d564c..72c5ef56 100644 --- a/examples/build/config/condition/meta/if_all_else/config.jsonnet +++ b/examples/build/config/condition/meta/if_all_else/config.jsonnet @@ -6,7 +6,7 @@ local sub = import '../../../../../../build/config/substation.libsonnet'; local domain_match = sub.cnd.all( // After running the example, try changing this to "any" or "none" and see // what happens. - sub.cnd.meta.for_each(settings={ type: 'all', inspector: sub.cnd.str.ends_with(settings={ string: '@brex.com' }) }), + sub.cnd.meta.for_each(settings={ type: 'all', inspector: sub.cnd.str.ends_with(settings={ value: '@brex.com' }) }), ); { @@ -17,7 +17,7 @@ local domain_match = sub.cnd.all( // to summarize an array of values. For this example, the decision // is represented as a boolean value and printed to stdout. sub.tf.meta.switch( - settings={ switch: [ + settings={ cases: [ { condition: domain_match, transform: sub.tf.obj.insert(settings={ object: { set_key: 'meta result' }, value: true }), diff --git a/examples/build/config/transform/aggregate/sample/config.jsonnet b/examples/build/config/transform/aggregate/sample/config.jsonnet index 4b036a9d..e3506af4 100644 --- a/examples/build/config/transform/aggregate/sample/config.jsonnet +++ b/examples/build/config/transform/aggregate/sample/config.jsonnet @@ -14,13 +14,13 @@ local sub = import '../../../../../../build/config/substation.libsonnet'; ), // A strict sample rate can be enforced by dropping any events that // contain the `sample` key, but do not have a length of 10. - sub.tf.meta.switch(settings={ switch: [ + sub.tf.meta.switch(settings={ cases: [ { - condition: sub.cnd.any(sub.cnd.num.len.eq(settings={ object: { key: 'sample' }, length: 10 })), + condition: sub.cnd.any(sub.cnd.num.len.eq(settings={ object: { key: 'sample' }, value: 10 })), transform: sub.tf.object.copy(settings={ object: { key: 'sample.0' } }), }, { - condition: sub.cnd.any(sub.cnd.num.len.gt(settings={ object: { key: 'sample' }, length: 0 })), + condition: sub.cnd.any(sub.cnd.num.len.gt(settings={ object: { key: 'sample' }, value: 0 })), transform: sub.tf.util.drop(), }, ] }), diff --git a/examples/build/config/transform/array/group/config.jsonnet b/examples/build/config/transform/array/group/config.jsonnet index 5024f870..65032ebb 100644 --- a/examples/build/config/transform/array/group/config.jsonnet +++ b/examples/build/config/transform/array/group/config.jsonnet @@ -22,7 +22,7 @@ local files_key = 'files'; // [[name1, name2], [type1, type2], [size1, size2], [extension1, extension2]] sub.tf.meta.for_each(settings={ object: { key: 'file_names', set_key: sub.helpers.key.append_array(files_key) }, - transform: sub.tf.string.match.find(settings={ pattern: '\\.([^\\.]+)$' }), + transform: sub.tf.string.capture(settings={ pattern: '\\.([^\\.]+)$' }), }), sub.tf.send.stdout(), // The array of arrays is transformed into an array of objects based on diff --git a/examples/build/config/transform/meta/crash_program/config.jsonnet b/examples/build/config/transform/meta/crash_program/config.jsonnet index d8f9c851..1ad00479 100644 --- a/examples/build/config/transform/meta/crash_program/config.jsonnet +++ b/examples/build/config/transform/meta/crash_program/config.jsonnet @@ -17,7 +17,7 @@ local key = 'c'; // If there is no output from the transform, then an error is thrown to crash the program. sub.tf.meta.switch(settings={ switch: [ { - condition: sub.cnd.any(sub.cnd.num.len.eq(settings={ object: { key: key }, length: 0 })), + condition: sub.cnd.any(sub.cnd.num.len.eq(settings={ object: { key: key }, value: 0 })), transform: sub.tf.util.err(settings={ message: 'transform produced no output' }), }, { transform: sub.tf.send.stdout() }, diff --git a/examples/build/config/transform/meta/retry_with_backoff/config.jsonnet b/examples/build/config/transform/meta/retry_with_backoff/config.jsonnet index 632a7995..38cc7b5f 100644 --- a/examples/build/config/transform/meta/retry_with_backoff/config.jsonnet +++ b/examples/build/config/transform/meta/retry_with_backoff/config.jsonnet @@ -6,7 +6,7 @@ local sub = import '../../../../../../build/config/substation.libsonnet'; // `key` is the target of the transform that may not produce an output and is // checked to determine if the transform was successful. local key = 'c'; -local key_is_empty = sub.cnd.num.len.eq(settings={ object: { key: key }, length: 0 }); +local key_is_empty = sub.cnd.num.len.eq(settings={ object: { key: key }, value: 0 }); local cnd = sub.cnd.all([ key_is_empty, @@ -39,7 +39,7 @@ local retries = ['0s', '1s', '2s', '4s']; ] + [ // If there is no output after all retry attempts, then an error is thrown to crash the program. // This is the same technique from the build/config/transform/meta/crash_program example. - sub.tf.meta.switch(settings={ switch: [ + sub.tf.meta.switch(settings={ cases: [ { condition: sub.cnd.any(key_is_empty), transform: sub.tf.util.err(settings={ diff --git a/examples/build/terraform/aws/kinesis/firehose/config/processor/config.jsonnet b/examples/build/terraform/aws/kinesis/firehose/config/processor/config.jsonnet index 961ae261..4b8b75a1 100644 --- a/examples/build/terraform/aws/kinesis/firehose/config/processor/config.jsonnet +++ b/examples/build/terraform/aws/kinesis/firehose/config/processor/config.jsonnet @@ -8,7 +8,7 @@ local sub = import '../../../../../../../../build/config/substation.libsonnet'; ), // Appending a newline is required so that the S3 object is line delimited. sub.tf.string.append( - settings={ string: '\n' } + settings={ suffix: '\n' } ), ], } diff --git a/examples/build/terraform/aws/lambda/microservice/config/microservice/config.jsonnet b/examples/build/terraform/aws/lambda/microservice/config/microservice/config.jsonnet index 17c8dd74..12f55988 100644 --- a/examples/build/terraform/aws/lambda/microservice/config/microservice/config.jsonnet +++ b/examples/build/terraform/aws/lambda/microservice/config/microservice/config.jsonnet @@ -6,7 +6,7 @@ local sub = import '../../../../../../../../build/config/substation.libsonnet'; sub.pattern.tf.conditional( condition=sub.cnd.all([ sub.cnd.number.length.greater_than( - settings={ object: { key: 'body' }, length: 0 } + settings={ object: { key: 'body' }, value: 0 } ), ]), transform=sub.tf.object.copy( diff --git a/examples/build/terraform/aws/sqs/microservice/config/frontend/config.jsonnet b/examples/build/terraform/aws/sqs/microservice/config/frontend/config.jsonnet index c185b629..8d48be04 100644 --- a/examples/build/terraform/aws/sqs/microservice/config/frontend/config.jsonnet +++ b/examples/build/terraform/aws/sqs/microservice/config/frontend/config.jsonnet @@ -9,7 +9,7 @@ local sub = import '../../../../../../../../build/config/substation.libsonnet'; ), condition=sub.condition.all([ sub.condition.number.length.greater_than( - settings={ object: { key: 'body' }, length: 0 } + settings={ object: { key: 'body' }, value: 0 } ), ]), ),