LogoLogo
Contact Us
  • Finout Documentation
  • Get Started with Finout
    • Introduction to Finout's Suite of Features
    • Onboarding New Users to Your Finout Account
    • Single Sign-On (SSO) Setup
    • Enterprise Discount Program (EDP)
    • Cost and Usage Types
      • FairShare Cost
      • List Cost
  • Integrations
    • Cloud Services
      • Connect to AWS
      • Connect to Azure
      • Connect to Oracle
      • Connect to GCP
    • Third Party
      • Connect to Confluent
      • Connect to Databricks
      • Connect to Snowflake
      • Connect to Jira
      • Connect to Datadog
        • Datadog API Cost Calculation
        • Datadog Integration Levels
        • Datadog Usage Attribution Tags (UAT)
      • Connect to Microsoft Teams
      • Connect to ServiceNow
      • Custom Cost Centers
      • Credentials Vault
    • Telemetry
      • S3 Telemetry Integration
      • Setting Up a Datadog - Finout Metrics Integration (Export)
      • MegaBill Telemetry
    • Kubernetes
      • Connect to Kubernetes Prometheus
      • Kubernetes - How Finout Calculates K8s Costs
      • Kubernetes MegaBill
      • Kubernetes Budgeting
      • Kubernetes Anomaly Detection
      • Kubernetes Custom Dashboards
      • Kubernetes Predefined Dashboards
      • Ensure Compatibility of Your Kubernetes Monitoring with Finout
  • User Guide
    • Inform
      • MegaBill
      • Custom Drilldown
      • Custom Cost Input
      • Virtual Tags
        • Relational Virtual Tags
      • Shared Cost Reallocation
        • How to Use Shared Cost Reallocation
      • FinOps Dashboards
      • Financial Plans
      • Data Explorer
    • Optimize
      • My Commitments
      • Commitments Log
      • Anomalies
      • CostGuard
        • CostGuard - Scans
        • Connect CostGuard for AWS
        • Connect CostGuard for GCP
    • Operate
      • Reports
      • Tag Governance
  • Configuration
    • Finout API
      • Generate an API Token
      • Filter Object Definition
      • Cost API
      • Query Language API
      • Virtual Tags API
      • CostGuard API
      • Endpoint API
      • Virtual Tag Metadata API
    • Role-Based Access Control (RBAC)
      • Role Permissions
      • Managing Roles
        • Creating a Custom Role
        • Permissions List
        • Managing a Role and its Permissions
      • Managing Users
        • Inviting a User
        • Edit a User's Roles
      • Data Access Control
      • Groups
        • Create a New Group
        • Edit Group Data Access
        • Delete a group
        • Edit Group Users and SAML Groups
      • RBAC FAQs
    • Endpoints
      • Slack Notification Endpoint
  • Common Features
    • List of Common Features
      • ACL Permissions
      • Saved Views
Powered by GitBook

Still need help? Please feel free to reach out to our team at support@finout.io.

On this page
  • Filter operator object definition
  • Supported Operators
  • Example rule configuration
  • Example rules and filter conditions

Was this helpful?

Export as PDF
  1. Configuration
  2. Finout API

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:

  1. Simple Conditions Without Logical Operators:

    • Use direct condition keys for single-condition requirements.

      Example JSON:

      {
        "to": "Asaf",
        "filters": {
          "costCenter": "AWS",
          "key": "aws_account_name",
          "displayName": "Account Name",
          "operator": "oneOf",
          "value": [
            "004a533177",
            "0371d7d3bf"
          ]
        }
  2. 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:

      {
        "filters": {
          "AND": [
            {
              "OR": [
                {
                  "costCenter": "AWS",
                  "key": "condition1",
                  "operator": "equals",
                  "value": "value1"
                },
                {
                  "costCenter": "AWS",
                  "key": "condition2",
                  "operator": "equals",
                  "value": "value2"
                }
              ]
            },
            {
              "costCenter": "AWS",
              "key": "condition3",
              "operator": "equals",
              "value": "value3"
            }
          ]
        }
      }

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

{
  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "accountId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "name": "Test",
  "rules": [
    {
      "to": "Finout",
      "filters": {
        "AND": [
          {
            "costCenter": "AWS",
            "key": "aws_account_name",
            "displayName": "Account Name",
            "operator": "oneOf",
            "value": ["Finout"]
          },
          {
            "costCenter": "AWS",
            "key": "f_operation",
            "displayName": "API Operation",
            "operator": "oneOf",
            "value": ["AAAA"]
          },
          {
            "costCenter": "Virtual Tags",
            "key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            "displayName": "Cost per Customer",
            "operator": "oneOf",
            "value": ["Abra"]
          }
        ]
      }
    },
    {
      "to": "Finout-Subaccount",
      "filters": {
        "costCenter": "AWS",
        "key": "aws_account_name",
        "displayName": "Account Name",
        "operator": "oneOf",
        "value": ["Finout-Subaccount"]
      }
    },
    {
      "to": "AWS",
      "filters": {
        "costCenter": "Global",
        "key": "cost_center_type",
        "displayName": "Cost Center",
        "operator": "oneOf",
        "value": ["AWS"]
      }
    }
  ],
  "category": "Project",
  "createdBy": "User",
  "updatedBy": "User",
  "createdAt": "Wed Mar 13 2024 15:40:46 GMT+0000 (Greenwich Mean Time)",
  "updatedAt": "Thu Mar 21 2024 10:49:17 GMT+0000 (Greenwich Mean Time)",
  "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "defaultValue": "Untagged"
}

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

{
  "requestId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "accountId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "name": "exampleName",
  "rules": [
    {
      "to": "Tag1",
      "filters": {
        "AND": [
          {
            "OR": [
              {
                "costCenter": "Center1",
                "key": "service_key",
                "displayName": "Service Name",
                "operator": "oneOf",
                "value": [
                  "ServiceA",
                  "ServiceB",
                  "ServiceC"
                ]
              },
              {
                "costCenter": "Center1",
                "key": "account_name_key",
                "displayName": "Account Name",
                "operator": "oneOf",
                "value": [
                  "AccountX",
                  "AccountY"
                ]
              }
            ]
          },
          {
            "costCenter": "Center1",
            "key": "service_key",
            "displayName": "Service Name",
            "operator": "oneOf",
            "value": [
              "ServiceA",
              "ServiceB"
            ]
          }
        ]
      }
    },
    {
      "to": "Tag2",
      "filters": {
        "costCenter": "Center2",
        "key": "account_name_key",
        "displayName": "Account Name",
        "operator": "oneOf",
        "value": [
          "AccountZ",
          "AccountW"
        ]
      }
    }
  ],
  "createdBy": "CreatorName",
  "updatedBy": "UpdaterName",
  "createdAt": "Date and Time",
  "updatedAt": "Date and Time",
  "id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "defaultValue": "DefaultTag"
}

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.

PreviousGenerate an API TokenNextCost API

Last updated 1 month ago

Was this helpful?

Use to get a list of the available keys.

Finout’s Query Language API