Class: Google::Apis::TrafficdirectorV2::StructMatcher
- Inherits:
-
Object
- Object
- Google::Apis::TrafficdirectorV2::StructMatcher
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- generated/google/apis/trafficdirector_v2/classes.rb,
generated/google/apis/trafficdirector_v2/representations.rb,
generated/google/apis/trafficdirector_v2/representations.rb
Overview
StructMatcher provides a general interface to check if a given value is
matched in google.protobuf.Struct. It uses path
to retrieve the value from
the struct and then check if it's matched to the specified value. For example,
for the following Struct: .. code-block:: yaml fields: a: struct_value: fields:
b: struct_value: fields: c: string_value: pro t: list_value: values: -
string_value: m - string_value: n The following MetadataMatcher is matched as
the path [a, b, c] will retrieve a string value "pro" from the Metadata which
is matched to the specified prefix match. .. code-block:: yaml path: - key: a -
key: b - key: c value: string_match: prefix: pr The following StructMatcher
is matched as the code will match one of the string values in the list at the
path [a, t]. .. code-block:: yaml path: - key: a - key: t value: list_match:
one_of: string_match: exact: m An example use of StructMatcher is to match
metadata in envoy.v*.core.Node.
Instance Attribute Summary collapse
-
#path ⇒ Array<Google::Apis::TrafficdirectorV2::PathSegment>
The path to retrieve the Value from the Struct.
-
#value ⇒ Google::Apis::TrafficdirectorV2::ValueMatcher
Specifies the way to match a ProtobufWkt::Value.
Instance Method Summary collapse
-
#initialize(**args) ⇒ StructMatcher
constructor
A new instance of StructMatcher.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ StructMatcher
Returns a new instance of StructMatcher.
1248 1249 1250 |
# File 'generated/google/apis/trafficdirector_v2/classes.rb', line 1248 def initialize(**args) update!(**args) end |
Instance Attribute Details
#path ⇒ Array<Google::Apis::TrafficdirectorV2::PathSegment>
The path to retrieve the Value from the Struct.
Corresponds to the JSON property path
1239 1240 1241 |
# File 'generated/google/apis/trafficdirector_v2/classes.rb', line 1239 def path @path end |
#value ⇒ Google::Apis::TrafficdirectorV2::ValueMatcher
Specifies the way to match a ProtobufWkt::Value. Primitive values and
ListValue are supported. StructValue is not supported and is always not
matched. [#next-free-field: 7]
Corresponds to the JSON property value
1246 1247 1248 |
# File 'generated/google/apis/trafficdirector_v2/classes.rb', line 1246 def value @value end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
1253 1254 1255 1256 |
# File 'generated/google/apis/trafficdirector_v2/classes.rb', line 1253 def update!(**args) @path = args[:path] if args.key?(:path) @value = args[:value] if args.key?(:value) end |