lib/consul/async/consul_template.rb in consul-templaterb-1.26.3 vs lib/consul/async/consul_template.rb in consul-templaterb-1.27.0
- old
+ new
@@ -159,9 +159,21 @@
query_params[:dc] = dc if dc
query_params[:passing] = passing if passing
create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
end
+ # https://www.consul.io/api-docs/health#list-checks-in-state
+ # Supported in Consul 1.7+
+ def checks_in_state(check_state, dc: nil, agent: nil)
+ valid_checks_states = %w[any critical passing warning]
+ raise "checks_in_state('#{check_state}'...) must be one of #{valid_checks_states}" unless valid_checks_states.include?(check_state)
+
+ path = "/v1/health/state/#{check_state}"
+ query_params = {}
+ query_params[:dc] = dc if dc
+ create_if_missing(path, query_params, agent: agent) { ConsulTemplateChecks.new(ConsulEndpoint.new(consul_conf, path, true, query_params, '[]', agent)) }
+ end
+
# https://www.consul.io/api/catalog.html#list-nodes
def nodes(dc: nil, agent: nil)
path = '/v1/catalog/nodes'
query_params = {}
query_params[:dc] = dc if dc