Skip to content

Instantly share code, notes, and snippets.

@mandarjog
Last active March 28, 2022 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandarjog/24b37f1685c4b23ccdb8533e223c55b2 to your computer and use it in GitHub Desktop.
Save mandarjog/24b37f1685c4b23ccdb8533e223c55b2 to your computer and use it in GitHub Desktop.
filters:
OR:
- { attr.ip: 1.2.3.4/32 }
- { attr.ip: 1.2.3.5/32 }
- AND:
- { attr.region: us-west1 }
- { dept: eng }
@narayanangit
Copy link

Using a oneof that supports basic and full ast version -
We may not have to change the protobuf defintion if we use the oneof?

 message Selector {
  oneof ver {
    // Basic version is what we will support in phase 1
    Basic basic = 1;
    // Based on requirements, we can support full AST (The alternative method suggested by Mandar)
    FullAst fullast = 2
  }
}


message Basic {
  repeated MatchExpr expr = 1
}

message MatchExpr {
  map <str, str> match = 1
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment