From 499537addf045a871db16290e98ead9057ba3a1a Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Sat, 2 Jul 2016 16:05:41 -0700 Subject: [PATCH] api: add query templates --- api/prepared_query.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/prepared_query.go b/api/prepared_query.go index ddc3097a79..63e741e050 100644 --- a/api/prepared_query.go +++ b/api/prepared_query.go @@ -45,6 +45,17 @@ type ServiceQuery struct { Tags []string } +// QueryTemplate carries the arguments for creating a templated query. +type QueryTemplate struct { + // Type specifies the type of the query template. Currently only + // "name_prefix_match" is supported. This field is required. + Type string + + // Regexp allows specifying a regex pattern to match against the name + // of the query being executed. + Regexp string +} + // PrepatedQueryDefinition defines a complete prepared query. type PreparedQueryDefinition struct { // ID is this UUID-based ID for the query, always generated by Consul. @@ -72,6 +83,11 @@ type PreparedQueryDefinition struct { // DNS has options that control how the results of this query are // served over DNS. DNS QueryDNSOptions + + // Template is used to pass through the arguments for creating a + // prepared query with an attached template. If a template is given, + // interpolations are possible in other struct fields. + Template QueryTemplate } // PreparedQueryExecuteResponse has the results of executing a query.