api: add query templates

This commit is contained in:
Ryan Uber 2016-07-02 16:05:41 -07:00
parent 5302660c59
commit 6deb17d069
1 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,17 @@ type ServiceQuery struct {
Tags []string 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. // PrepatedQueryDefinition defines a complete prepared query.
type PreparedQueryDefinition struct { type PreparedQueryDefinition struct {
// ID is this UUID-based ID for the query, always generated by Consul. // 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 // DNS has options that control how the results of this query are
// served over DNS. // served over DNS.
DNS QueryDNSOptions 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. // PreparedQueryExecuteResponse has the results of executing a query.