syntax = "proto3";

package envoy.extensions.string_matcher.lua.v3;

import "envoy/config/core/v3/base.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.string_matcher.lua.v3";
option java_outer_classname = "LuaProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/string_matcher/lua/v3;luav3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Lua StringMatcher]
// A Lua StringMatcher allows executing a Lua script to determine if a string is a match. The configured source
// code must define a function named `envoy_match`. If the function returns true, the string is considered a match.
// Any other result, including an execution error, is considered a non-match.
//
// Example:
//
// .. code-block:: yaml
//
//   source_code:
//     inline_string: |
//       function envoy_match(str)
//           -- Do something.
//           return true
//       end
//
// [#extension: envoy.string_matcher.lua]

message Lua {
  // The Lua code that Envoy will execute
  config.core.v3.DataSource source_code = 1 [(validate.rules).message = {required: true}];
}
