Skip to content

Commit

Permalink
api: add query templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanuber committed Jul 2, 2016
1 parent 5425fda commit 499537a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api/prepared_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 499537a

Please sign in to comment.