Class: Google::Apis::TrafficdirectorV3::RegexMatcher

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/trafficdirector_v3/classes.rb,
lib/google/apis/trafficdirector_v3/representations.rb,
lib/google/apis/trafficdirector_v3/representations.rb

Overview

A regex matcher designed for safety when used with untrusted input.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ RegexMatcher

Returns a new instance of RegexMatcher.



1266
1267
1268
# File 'lib/google/apis/trafficdirector_v3/classes.rb', line 1266

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#google_re2Google::Apis::TrafficdirectorV3::GoogleRe2

Google's RE2_ regex engine. The regex string must adhere to the documented syntax_. The engine is designed to complete execution in linear time as well as limit the amount of memory used. Envoy supports program size checking via runtime. The runtime keys re2.max_program_size.error_level and re2. max_program_size.warn_level can be set to integers as the maximum program size or complexity that a compiled regex can have before an exception is thrown or a warning is logged, respectively. re2.max_program_size. error_level defaults to 100, and re2.max_program_size.warn_level has no default if unset (will not check/log a warning). Envoy emits two stats for tracking the program size of regexes: the histogram re2.program_size, which records the program size, and the counter re2.exceeded_warn_level, which is incremented each time the program size exceeds the warn level threshold. Corresponds to the JSON property googleRe2



1258
1259
1260
# File 'lib/google/apis/trafficdirector_v3/classes.rb', line 1258

def google_re2
  @google_re2
end

#regexString

The regex match string. The string must be supported by the configured engine. The regex is matched against the full string, not as a partial match. Corresponds to the JSON property regex

Returns:

  • (String)


1264
1265
1266
# File 'lib/google/apis/trafficdirector_v3/classes.rb', line 1264

def regex
  @regex
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1271
1272
1273
1274
# File 'lib/google/apis/trafficdirector_v3/classes.rb', line 1271

def update!(**args)
  @google_re2 = args[:google_re2] if args.key?(:google_re2)
  @regex = args[:regex] if args.key?(:regex)
end