diff --git a/v2/pkg/operators/common/dsl/dsl.go b/v2/pkg/operators/common/dsl/dsl.go index 59f47649..9a4ded30 100644 --- a/v2/pkg/operators/common/dsl/dsl.go +++ b/v2/pkg/operators/common/dsl/dsl.go @@ -496,6 +496,15 @@ func init() { "to_string": makeDslFunction(1, func(args ...interface{}) (interface{}, error) { return types.ToString(args[0]), nil }), + "hmacsha256": makeDslFunction(2, func(args ...interface{}) (interface{}, error) { + h := hmac.New(sha256.New, []byte(args[1].(string))) + h.Write([]byte(args[0].(string))) + return hex.EncodeToString(h.Sum(nil)), nil + }), + "time_format": makeDslFunction(1, func(args ...interface{}) (interface{}, error) { + t := time.Now() + return string(t.Format(args[0].(string))), nil + }), } dslFunctions = make(map[string]dslFunction, len(tempDslFunctions)) diff --git a/v2/pkg/operators/common/dsl/dsl_test.go b/v2/pkg/operators/common/dsl/dsl_test.go index c9895512..7ab4f2a3 100644 --- a/v2/pkg/operators/common/dsl/dsl_test.go +++ b/v2/pkg/operators/common/dsl/dsl_test.go @@ -224,6 +224,8 @@ func TestDslExpressions(t *testing.T) { `compare_versions('v1.1.1', '>v1.1.0')`: true, `compare_versions('v1.0.0', '>v0.0.1,v0.0.1', '