Filter Object Definition
In the Finout Virtual Tags API documentation, the structure of the filters object can be explained by starting with simpler usage and then detailing more complex scenarios:
Simple Conditions Without Logical Operators:
Use direct condition keys for single-condition requirements.
Example JSON:
Complex Conditions with Nested Logical Operators:
AND and OR keys represent logical operators for grouping multiple conditions.
You can nest multiple layers of AND and OR for intricate conditional logic.
Example JSON:
Filter operator object definition
Field
Type
Description
Example Value
costCenter
string
The cost center associated with the filter.
"AWS" , "GCP", "Kubernetes" , "Snowflake" , "Virtual Tags" , "Datadog" , "Azure" , "Custom Cost"
operator
string
The comparison operator to apply for the filter (e.g., "oneOf", "equal", "greaterThan").
"oneOf"
value
array
An array of values to use the operator against.
["Amazon Web Services EMEA KFIR"]
key
string
The key in Finout filters.
For non-unique keys or specific keys (finrichment), a transform function is applied as follows:
finrichment is returned as f_
plus the Kubernetes key and the node/pod label is returned as nl_<key>/pl_<key>
“1233442423423”
“finrichment_usage_type” -> “f_usage_type”
Note: "displayName" is retrieved in the GET API call. This parameter should not be sent in the POST/PUT API calls.
Supported Operators
The following operators can be used in the rule definitions to specify filtering conditions:
oneOf: Matches the resource value if it is equal to any of the specified values.
notOneOf: Matches the resource value if it is not equal to any of the specified values.
is: Matches the resource value if it is exactly equal to the specified value.
isNot: Matches the resource value if it is not equal to the specified value.
contains: Matches the resource value if it contains the specified substring.
notContains: Matches the resource value if it does not contain the specified substring.
exists: Matches the resource value if it exists (not null or empty).
notExists: Matches the resource value if it does not exist (null or empty).
Example rule configuration
In the example above, the rule engine is configured with two rules. The first rule filters resources with costCenter equal to "virtualTag" and type equal to "virtual_tag" using the oneOf operator, matching the values "Aged", "AllArid", "BidBare", "Calm", or "Coal". The matching resources are then directed to the "Application" destination.
The second rule filters resources with costCenter equal to "virtualTag" and type equal to "virtual_tag" using the contains operator, matching the value "Jet". The matching resources are directed to the "Backend" destination.
Example rules and filter conditions
In the provided example, the third rule illustrates complex conditional logic using both "AND" and "OR" operators. This rule's filter conditions demonstrate the logic: "(condition 1 AND condition 2) OR (condition 1 AND condition 3)". This showcases how multiple conditions can be intricately grouped within "AND" or "OR" relationships, allowing for the creation of sophisticated filtering logic for virtual tags. This example serves to show the versatility and depth of the filtering system in handling diverse and complex tagging scenarios.
Last updated