open-consul/agent/consul
Matt Keeler ac78c23021
Implement data filtering of some endpoints (#5579)
Fixes: #4222 

# Data Filtering

This PR will implement filtering for the following endpoints:

## Supported HTTP Endpoints

- `/agent/checks`
- `/agent/services`
- `/catalog/nodes`
- `/catalog/service/:service`
- `/catalog/connect/:service`
- `/catalog/node/:node`
- `/health/node/:node`
- `/health/checks/:service`
- `/health/service/:service`
- `/health/connect/:service`
- `/health/state/:state`
- `/internal/ui/nodes`
- `/internal/ui/services`

More can be added going forward and any endpoint which is used to list some data is a good candidate.

## Usage

When using the HTTP API a `filter` query parameter can be used to pass a filter expression to Consul. Filter Expressions take the general form of:

```
<selector> == <value>
<selector> != <value>
<value> in <selector>
<value> not in <selector>
<selector> contains <value>
<selector> not contains <value>
<selector> is empty
<selector> is not empty
not <other expression>
<expression 1> and <expression 2>
<expression 1> or <expression 2>
```

Normal boolean logic and precedence is supported. All of the actual filtering and evaluation logic is coming from the [go-bexpr](https://github.com/hashicorp/go-bexpr) library

## Other changes

Adding the `Internal.ServiceDump` RPC endpoint. This will allow the UI to filter services better.
2019-04-16 12:00:15 -04:00
..
autopilot autopilot: don't follow the normal server removal rules for nonvoters 2018-08-14 14:24:51 -07:00
fsm Cleaned up some error handling/comments around config entries 2019-04-02 15:42:12 -07:00
prepared_query Allow ignoring checks by ID when defining a PreparedQuery. Fixes #3727. 2018-04-10 14:04:16 +01:00
state Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
acl.go acl: reduce complexity of token resolution process with alternative singleflighting (#5480) 2019-03-14 09:35:34 -05:00
acl_client.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
acl_endpoint.go fix typos reported by golangci-lint:misspell (#5434) 2019-03-06 11:13:28 -06:00
acl_endpoint_legacy.go acl: add stub hooks to support some plumbing in enterprise (#4951) 2018-11-13 15:35:54 -06:00
acl_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
acl_replication.go Fixes for CVE-2019-8336 2019-03-04 19:13:24 +00:00
acl_replication_legacy.go ACL Token Persistence and Reloading (#5328) 2019-02-27 14:28:31 -05:00
acl_replication_legacy_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
acl_replication_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
acl_server.go ACL Token Persistence and Reloading (#5328) 2019-02-27 14:28:31 -05:00
acl_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
autopilot.go Remove deprecated metric names 2018-05-08 16:23:15 -07:00
autopilot_oss.go Fix vet error 2017-12-18 18:04:42 -08:00
autopilot_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
catalog_endpoint.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
catalog_endpoint_test.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
client.go agent: enable reloading of tls config (#5419) 2019-03-13 10:29:06 +01:00
client_serf.go Call RemoveServer for reap events (#5317) 2019-03-04 09:19:35 -05:00
client_test.go Merge pull request #5376 from hashicorp/fix-tests 2019-04-04 17:09:32 -04:00
config.go agent: enable reloading of tls config (#5419) 2019-03-13 10:29:06 +01:00
connect_ca_endpoint.go fix typos reported by golangci-lint:misspell (#5434) 2019-03-06 11:13:28 -06:00
connect_ca_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
consul_ca_delegate.go Move connect CA provider to separate package 2018-06-14 09:42:15 -07:00
coordinate_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
coordinate_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
enterprise_client_oss.go Allow for easy enterprise/oss coexistence 2018-05-24 10:36:42 -04:00
enterprise_server_oss.go oss: add the enterprise server stub for intention replication check 2019-01-18 17:32:10 -08:00
filter.go txn: add ACL enforcement/validation to new txn ops 2018-12-12 10:04:10 -08:00
filter_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
flood.go Add segment addr field to tags for LAN flood joiner 2017-08-30 11:58:29 -07:00
health_endpoint.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
health_endpoint_test.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
helper_test.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
intention_endpoint.go connect: Forward intention RPCs if this isn't the primary 2019-01-22 11:29:21 -08:00
intention_endpoint_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
internal_endpoint.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
internal_endpoint_test.go Implement data filtering of some endpoints (#5579) 2019-04-16 12:00:15 -04:00
issue_test.go Moves the FSM into its own package. 2017-11-29 18:36:53 -08:00
kvs_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
kvs_endpoint_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
leader.go Fixes for CVE-2019-8336 2019-03-04 19:13:24 +00:00
leader_oss.go re-add Connect multi-dc config changes 2018-10-19 08:41:03 -07:00
leader_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
merge.go Takes the skip out of the client check. 2017-09-06 17:05:40 -07:00
merge_test.go Skips unique node ID check for old versions of Consul. 2017-09-05 22:57:29 -07:00
operator_autopilot_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
operator_autopilot_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
operator_endpoint.go pkg refactor 2017-06-10 18:52:45 +02:00
operator_raft_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
operator_raft_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
prepared_query_endpoint.go Improve Connect with Prepared Queries (#5291) 2019-02-04 09:36:51 -05:00
prepared_query_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
raft_rpc.go agent: move conn pool for muxed connections into separate pkg 2017-06-21 05:42:39 +02:00
rpc.go fix typos reported by golangci-lint:misspell (#5434) 2019-03-06 11:13:28 -06:00
rpc_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
rtt.go Added Coordinate.Node rpc endpoint and client api method 2017-10-26 19:16:40 -07:00
rtt_test.go Fix more unstable tests in agent and command 2018-09-12 14:49:27 +01:00
segment_oss.go Remove deprecated metric names 2018-05-08 16:23:15 -07:00
serf_test.go pkg refactor 2017-06-10 18:52:45 +02:00
server.go agent: enable reloading of tls config (#5419) 2019-03-13 10:29:06 +01:00
server_lookup.go More cleanup from code review 2017-08-30 12:31:36 -05:00
server_lookup_test.go More cleanup from code review 2017-08-30 12:31:36 -05:00
server_oss.go connect: tame thundering herd of CSRs on CA rotation (#5228) 2019-01-22 17:19:36 +00:00
server_serf.go Call RemoveServer for reap events (#5317) 2019-03-04 09:19:35 -05:00
server_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
session_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
session_endpoint_test.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
session_timers.go address review comments 2017-07-07 09:22:34 +02:00
session_timers_test.go rpc: refactor sessionTimers and fix racy tests 2017-07-07 09:22:34 +02:00
session_ttl.go Remove deprecated metric names 2018-05-08 16:23:15 -07:00
session_ttl_test.go Merge pull request #5376 from hashicorp/fix-tests 2019-04-04 17:09:32 -04:00
snapshot_endpoint.go New ACLs (#4791) 2018-10-19 12:04:07 -04:00
snapshot_endpoint_test.go Move internal/ to sdk/ (#5568) 2019-03-27 08:54:56 -04:00
stats_fetcher.go Fix stats fetcher healthcheck RPCs not being independent 2018-08-14 14:23:52 -07:00
stats_fetcher_test.go Fix more unstable tests in agent and command 2018-09-12 14:49:27 +01:00
status_endpoint.go Move autopilot to a standalone package 2017-12-11 16:45:33 -08:00
status_endpoint_test.go Fixed another list of unstable unit tests in travis (#4915) 2018-11-20 11:27:26 +00:00
txn_endpoint.go fix typos reported by golangci-lint:misspell (#5434) 2019-03-06 11:13:28 -06:00
txn_endpoint_test.go txn: add tests for RPC endpoint 2018-12-12 10:04:10 -08:00
util.go Remaining ACL Unit Tests (#4852) 2018-10-31 13:00:46 -07:00
util_test.go pkg refactor 2017-06-10 18:52:45 +02:00