Commit Graph

603 Commits

Author SHA1 Message Date
James Phillips c629773b40
Makes the all segments query explict, and the default for `consul members`. 2017-09-05 12:22:20 -07:00
Kyle Havlovitz 777cf7b017
Change segment list endpoint in docs/client api 2017-09-01 12:40:07 -07:00
Kyle Havlovitz 5cc4b32a5d
Organize segments for a cleaner split between enterprise and OSS 2017-08-31 17:39:46 -07:00
Kyle Havlovitz d9fc2b3d75
Update coord display in ui to account for segments 2017-08-30 11:58:29 -07:00
Kyle Havlovitz 107d7f6c5a
Add rpc_listener option to segment config 2017-08-30 11:58:29 -07:00
James Phillips 6a6eadd8c7
Adds open source side of network segments (feature is Enterprise-only). 2017-08-30 11:58:29 -07:00
Illirgway 46915108e7 Fix bug with unused (replaced with "") CONSUL_HTTP_AUTH in some places
example: https://github.com/hashicorp/consul/blob/master/watch/plan.go#L26

	conf := consulapi.DefaultConfig()
	conf.Address = address
	conf.Datacenter = p.Datacenter
	conf.Token = p.Token                             # <-- replace Token from DefaultConfig/CONSUL_HTTP_AUTH with ""
	client, err := consulapi.NewClient(conf)

how to reproduce bug:
0. consul -> localhost:8500 with more than 0 service checks
1. deny all for anonymous token
2. create appropriate acl <token> for watch checks (agent:read + node:read,service:read)
3. bash:
CONSUL_HTTP_AUTH=<token> consul watch -http-addr=localhost:8500 -type=checks # --> return []
consul watch -http-addr=localhost:8500 -type=checks -token=<token> # -> return { .... right json result .... }
2017-08-16 01:51:18 +03:00
James Phillips a2bb506cea
Adds a guard to make sure that empty log lines don't close consul monitor.
Fixes #3253.
2017-08-08 16:05:29 -07:00
Kyle Havlovitz 879651a4ea
Update api structs for metrics endpoint 2017-08-08 12:33:59 -07:00
Kyle Havlovitz 975ded2714
Add support for labels/filters from go-metrics 2017-08-08 01:45:10 -07:00
James Phillips 803ed9a245 Adds secure introduction for the ACL replication token. (#3357)
Adds secure introduction for the ACL replication token, as well as a separate enable config for ACL replication.
2017-08-03 15:39:31 -07:00
James Phillips c31b56a03e Adds a new /v1/acl/bootstrap API (#3349) 2017-08-02 17:05:18 -07:00
James Phillips 6e794ea1b3 Adds support for agent-side ACL token management via API instead of config files. (#3324)
* Adds token store and removes all runtime use of config for ACL tokens.
* Adds a new API for changing agent tokens on the fly.
2017-07-26 11:03:43 -07:00
Kyle Havlovitz 1ffd2ec05b
Add UpgradeVersionTag to autopilot config 2017-07-18 13:35:41 -07:00
James Phillips 788dd255a1 Adds new config to make script checks opt-in, updates documentation. (#3284) 2017-07-17 11:20:35 -07:00
James Phillips f5188dfe8c Expands and rework context support in the API client. (#3273) 2017-07-14 17:30:08 -07:00
James Bardin 96ae8c1231 accept recv-only channels for cancellations (#3271)
Cancellation channels are often derived from a Context, which
returns a directional `<-chan struct{}` from Done(). In order to use
this with parts of of the consul API, one is required to create a new
channel and dispatch a separate goroutine to watch for context
cancellation and close the new channel.

Changing the signature for the methods that take cancellation channels
will allow easier integration with existing uses of Context. Since the
cancellation pattern only reads from these channels, there should be no
backwards incompatibility with existing codebases, and most of the
methods already accept only the correct type.
2017-07-14 16:31:44 -07:00
Frank Schroeder 88efbb0cc1 api: fix TestAPI_CatalogNodes test 2017-07-07 09:22:34 +02:00
Frank Schroeder 9a99069aad agent: fix failing test from localState decoupling
Would be nice to know what changed though.
2017-07-07 09:22:34 +02:00
Frank Schroeder 6a1ab1a2e0 api: refactor: unify naming of API tests 2017-07-07 09:22:34 +02:00
Frank Schroeder 97b7578ccd api: refactor: prefix all API tests with API_ 2017-07-07 09:22:34 +02:00
Preetha Appan 82bf05c888 Fix socket file handle leaks from old blocking queries upon consul reload. This fixes issue #3018 2017-06-26 15:52:03 -05:00
Frank Schröder e206ab5cb6 agent: support custom header and method for http checks (#3106)
This patch adds support for custom headers and
method for HTTP checks.

Fixes #2474
Fixes #2657
Fixes #3106
2017-06-07 01:11:56 +02:00
James Phillips 6239c4aa50 Merge pull request #3077 from jwasinger/issue-2850
Prevent Session.Destroy from leaving open TCP connections
2017-06-02 21:43:55 -07:00
Jared Wasinger 7d006ba4ed Prevent Session.Destroy from leaving open TCP connections 2017-05-25 20:51:27 -07:00
Kyle Havlovitz 6092d2c2cc
Don't overwrite Transport's TLS config if it's been set 2017-05-24 13:45:19 -07:00
Kyle Havlovitz 32068f7025 Remove superfluous default HttpClient check in NewClient 2017-05-24 11:40:21 -07:00
Frank Schroeder 995c8d7086 test: make test less flaky 2017-05-12 22:12:47 +02:00
Frank Schroeder eedf0f3ac5 test: add helper for ioutil.TempDir/TempFile
This creates a simplified helper for temporary directories and files.
All path names are prefixed with the name of the current test.
All files and directories are stored either in /tmp/consul-test
or /tmp if the former could not be created.

Using the system temp dir breaks some tests on macOS where the unix
socket path becomes too long.
2017-05-12 22:12:47 +02:00
Frank Schroeder 15590a8446 test: include test name in temp file/dir
This helps identifying hanging tests by looking
at the process list.
2017-05-12 22:12:47 +02:00
James Phillips bccf493262
Fixes vet errors. 2017-05-09 06:48:52 -07:00
James Phillips 7007c89870
retry: Removes the description parameter. 2017-05-05 17:07:03 +02:00
Frank Schroeder 9435cadeee
test: Refactor WaitForResult tests with retry
Refactor tests that use testutil.WaitForResult to use retry.

Since this requires refactoring the test functions in general this patch
also shows the use of the github.com/pascaldekloe/goe/verify library
which provides a good mechanism for comparing nested data structures.
Instead of just converting the tests from testutil.WaitForResult to
retry the tests that performing a nested comparison of data structures
are converted to the verify library at the same time.
2017-05-05 17:07:02 +02:00
Kyle Havlovitz b5ed2ba536 Add separate option for verifying incoming HTTPS traffic (#2974)
* Add separate option for verifying incoming HTTPS traffic
2017-04-28 16:15:55 -07:00
Frank Schroeder 2bf668b658 api: Add ServiceTags to Health state endpoint (#153)
This patch adds the ServiceTags to the /v1/health/state/<state>
endpoint.

Fixes #153
2017-04-28 15:00:08 -07:00
James Phillips dfef029641 Merge pull request #2947 from bogdanov1609/added_ACLReplication
API: Add ACLReplication
2017-04-25 16:50:52 -07:00
James Phillips 742362fad1 Tweaks ACL replication struct name. 2017-04-25 16:32:09 -07:00
James Phillips a59f503c13 Tweaks ACL replication status struct name. 2017-04-25 16:31:20 -07:00
Frank Schroeder 9de4555c0c golint: Untangle if blocks with return in else 2017-04-25 09:26:13 -07:00
Ivan Bogdanov 822cf7ec20 API: Add ACLReplication 2017-04-25 00:39:50 +03:00
Frank Schröder 5f0a967507 Issue #2905: Add check-not-exists to TXN endpoint
This patch adds support for asserting that a given
key does not exist in the KV store.

Fixes #2905
2017-04-20 17:50:52 -07:00
Kyle Havlovitz bd9b0b34b2 Make the API client's httpClient more pluggable (#2926) 2017-04-18 16:39:23 -07:00
Frank Schröder 892fa89399 Add datacenter to catalog node API (#2917)
This patch stores the datacenter of a node in memdb
and exposes it via the API in all places where a Node
structure is returned.

 * /catalog/nodes
 * /catalog/node/:node
 * /catalog/service/:service
 * /health/service/:service
 * /query/:uuid/execute
2017-04-18 05:02:24 -07:00
Kyle Havlovitz cdd8b5b880
Add tls client options to api/cli 2017-04-14 13:37:29 -07:00
Brian Shumate 9d87883c85
API: Add struct fields, fixes #2882
- Add CreateIndex and ModifyIndex to AgentService
- Add CreateIndex and ModifyIndex to Node
2017-04-13 11:36:19 -04:00
James Phillips 76fdd5f392
Moves operator sub-functions into their own files. 2017-03-30 12:35:50 -07:00
Kyle Havlovitz a2058d23ef
Add CLI/API endpoints for removing peer by ID 2017-03-30 10:13:32 -07:00
Seth Vargo 2efa3bdff8
Use new APIs 2017-03-23 18:48:13 -04:00
Kyle Havlovitz 37ea20cb44
Add advanced autopilot features 2017-03-22 15:25:16 -07:00
James Phillips 77fa58bd23
Tweaks the agent leave test to patch an occasional local failure. 2017-03-22 09:56:53 -07:00
James Phillips ab1b643630
Adds missing area API. 2017-03-21 23:11:15 -07:00
James Phillips d68bd9cca0
Cleans up based on review feedback. 2017-03-20 16:23:40 -07:00
James Phillips 74dddf6695
Tweaks the join response to be more useful. 2017-03-16 21:01:03 -07:00
James Phillips 2d659a2c4d
Adds public API for the network area endpoints. 2017-03-16 16:42:19 -07:00
James Phillips 82b6fbd844
Adds router into RPC paths with work in progress on coordinates. 2017-03-16 16:42:18 -07:00
Kyle Havlovitz bc0494e396
Reorganized cluster health check loop and logic 2017-03-15 18:27:17 -07:00
Kyle Havlovitz c40279e012
Fix an issue with changing server IDs and add a few UX enhancements around autopilot features 2017-03-15 16:09:55 -07:00
Kyle Havlovitz 8130f9b1c1
Cleaned up and reorganized some autopilot-related code 2017-03-09 18:21:40 -08:00
Kyle Havlovitz 8bcab6c6d7
Add autopilot server health tracking
This adds two goroutines to perform autopilot tasks on the leader - one
to monitor the health of servers and another to periodically clean up
dead servers with a limit on removal count. Also adds a new http endpoint,
`/v1/operator/autopilot/health`, for querying this information through an
operator RPC endpoint.
2017-03-06 16:00:10 -08:00
Kyle Havlovitz 23c492a74e
Rename DeadServerCleanup and make wording adjustments 2017-02-28 14:45:21 -08:00
Kyle Havlovitz 6168911200
Added operator autopilot subcommands 2017-02-24 15:54:49 -08:00
Kyle Havlovitz c9ddee1a79
Add CAS capability to autopilot config endpoint 2017-02-24 13:08:49 -08:00
Kyle Havlovitz 7d514a7ef6
Add docs and api client methods for autopilot config 2017-02-23 21:00:15 -08:00
Jeff Mitchell 726590367f Update unix dial functions to use DialContext with new go-cleanhttp 2017-02-10 21:11:21 -05:00
Kyle Havlovitz 35d99a81ac
Update docs and give better error for unknown client scheme 2017-02-10 19:55:54 -05:00
Kyle Havlovitz 91e960832f
Allow prefixing -http-addr with http/https schemes 2017-02-10 18:25:46 -05:00
Kyle Havlovitz a64c5e69a3
Cleanup and formatting adjustments 2017-02-09 20:49:17 -05:00
Kyle Havlovitz d3b24d2d12
Convert keyring command to use base.Command 2017-02-08 18:25:47 -05:00
James Phillips aef0a68201
Lets the leave unit test proceed even after an EOF. 2017-01-26 22:22:18 -08:00
Kyle Havlovitz cc271aa436
Merge branch 'master' into f-prepared-query-nodemeta 2017-01-23 20:17:48 -05:00
Kyle Havlovitz 3cd054e81f
Add tests for node meta in prepared queries and update docs 2017-01-23 19:17:30 -05:00
James Phillips 55cd1d975c
Adds catalog support for node IDs. 2017-01-18 14:26:42 -08:00
James Phillips 96bff003b7
Adds basic support for node IDs. 2017-01-17 22:47:59 -08:00
Kyle Havlovitz e37f25dc02
Add node metadata filtering to remaining health/catalog endpoints 2017-01-13 20:08:43 -05:00
Kyle Havlovitz 2d03978139
Fix formatting 2017-01-11 20:44:22 -05:00
Kyle Havlovitz 15f008b3e3
Update client api and docs for node metadata 2017-01-11 19:28:58 -05:00
James Phillips 99a5ae2737
Bans anonymous queries that aren't tied to a session.
This gets us coverage of PQ creation under the existing service
policy or the soon-to-be-added session policy.
2016-12-12 14:52:27 -08:00
James Phillips 08c648f976 Merge pull request #2531 from alicebob/txntypes
fix KVOp types
2016-12-01 07:41:10 -08:00
Kyle Havlovitz dd05afb32e Add reload/leave http endpoints (#2516) 2016-11-30 13:29:42 -05:00
Seth Vargo 9f652c2690
Return the correct type 2016-11-29 21:17:00 -05:00
Seth Vargo 90f80056dd Merge pull request #2544 from hashicorp/sethvargo/best_status
Add an API method for determining the best status
2016-11-29 19:07:52 -05:00
James Phillips d97eb758c6 Merge pull request #2530 from coffeehc/master
adapt to server's checker field TLSSkipVerify type
2016-11-29 16:00:21 -08:00
Seth Vargo 2542c92b59
Do not log 2016-11-29 18:55:34 -05:00
Seth Vargo 1c55429a38
Add an API method for determining the best status
Given a list of HealthChecks, this determines the "best" status for the
collective group. This is useful for nodes and services, which may have
multiple checks associated with them.
2016-11-29 18:41:46 -05:00
Kyle Havlovitz 475408633a Add QueryOptions to api package's monitor 2016-11-28 18:36:26 -05:00
Kyle Havlovitz d91854f3b0 Add monitor http endpoint 2016-11-28 18:36:26 -05:00
Harmen f31f5f5962 fix KVOp types 2016-11-24 20:43:41 +01:00
James Phillips 7dc41b1c1f
Runs `go fmt`. 2016-11-22 17:49:48 -08:00
Kyle Havlovitz 66dea6951a Fix keyring doc method wording 2016-11-22 20:10:43 -05:00
Kyle Havlovitz 79f339b5dc Combine keyring endpoints into one 2016-11-22 20:10:43 -05:00
Kyle Havlovitz 2d37a07476 Add keyring http endpoints 2016-11-22 20:10:43 -05:00
coffee 1187daa15b adapt to server's checker field TLSSkipVerify type 2016-11-21 18:02:38 +08:00
James Phillips 5a643c6e3f Merge pull request #2366 from aksentyev/master
api client: CatalogService added fields CreateIndex, ModifyIndex
2016-11-17 16:38:39 -08:00
James Phillips b17907f06a Moves index fields to the bottom of the structure. 2016-11-17 16:38:30 -08:00
James Phillips fde94fb537
Adds notes field to API.
Closes #2336.
2016-11-17 16:33:50 -08:00
James Phillips b672fea37b Merge pull request #2238 from hasyimibhar/master
Remove duplicated environment variables
2016-11-17 16:18:02 -08:00
Kyle Havlovitz 07eeef6f1f Trim leading slash on key to avoid redirect (golang/go#4800) (#2476) 2016-11-04 21:55:10 -07:00
Kyle McCullough 697ea0f8eb Add setting to skip ssl certificate verification for HTTP checks (#1984)
* http check: add setting to skip ssl certificate verification

* update http check documentation

* fix typo in documentation

* Add TLSSkipVerify to agent api
2016-11-03 13:17:30 -07:00
Mike Cowgill ace3b46432 Delete prepared query using WriteOptions (#2417) 2016-11-03 15:54:07 -04:00
Kyle Havlovitz d5ee327fea More flaky unit test fixes (#2449)
* More flaky unit test fixes
* Raise some test timeouts that were too low
2016-10-31 09:59:20 -07:00
James Phillips bc29610124 Adds support for snapshots and restores. (#2396)
* Updates Raft library to get new snapshot/restore API.

* Basic backup and restore working, but need some cleanup.

* Breaks out a snapshot module and adds a SHA256 integrity check.

* Adds snapshot ACL and fills in some missing comments.

* Require a consistent read for snapshots.

* Make sure snapshot works if ACLs aren't enabled.

* Adds a bit of package documentation.

* Returns an empty response from restore to avoid EOF errors.

* Adds API client support for snapshots.

* Makes internal file names match on-disk file snapshots.

* Adds DC and token coverage for snapshot API test.

* Adds missing documentation.

* Adds a unit test for the snapshot client endpoint.

* Moves the connection pool out of the client for easier testing.

* Fixes an incidental issue in the prepared query unit test.

I realized I had two servers in bootstrap mode so this wasn't a good setup.

* Adds a half close to the TCP stream and fixes panic on error.

* Adds client and endpoint tests for snapshots.

* Moves the pool back into the snapshot RPC client.

* Adds a TLS test and fixes half-closes for TLS connections.

* Tweaks some comments.

* Adds a low-level snapshot test.

This is independent of Consul so we can pull this out into a library
later if we want to.

* Cleans up snapshot and archive and completes archive tests.

* Sends a clear error for snapshot operations in dev mode.

Snapshots require the Raft snapshots to be readable, which isn't supported
in dev mode. Send a clear error instead of a deep-down Raft one.

* Adds docs for the snapshot endpoint.

* Adds a stale mode and index feedback for snapshot saves.

This gives folks a way to extract data even if the cluster has no
leader.

* Changes the internal format of a snapshot from zip to tgz.

* Pulls in Raft fix to cancel inflight before a restore.

* Pulls in new Raft restore interface.

* Adds metadata to snapshot saves and a verify function.

* Adds basic save and restore snapshot CLI commands.

* Gets rid of tarball extensions and adds restore message.

* Fixes an incidental bad link in the KV docs.

* Adds documentation for the snapshot CLI commands.

* Scuttle any request body when a snapshot is saved.

* Fixes archive unit test error message check.

* Allows for nil output writers in snapshot RPC handlers.

* Renames hash list Decode to DecodeAndVerify.

* Closes the client connection for snapshot ops.

* Lowers timeout for restore ops.

* Updates Raft vendor to get new Restore signature and integrates with Consul.

* Bounces the leader's internal state when we do a restore.
2016-10-25 19:20:24 -07:00
Kyle Havlovitz 114ee0755a Fix race condition in TestClient_WatchList and TestClient_WatchGet 2016-10-25 17:48:11 -07:00
James Phillips 14c90e9aa6 Merge pull request #2382 from zaunerc/master
Add info about return values for function Get().
2016-10-20 09:40:58 -07:00
James Phillips 0f35f08b6a Adds comment about SessionOpts. 2016-10-05 17:53:27 -07:00
James Phillips dc60027e6d Merge pull request #2372 from HotelsDotCom/flexible-lock-sessions
More flexible Session configuration when using api.Lock
2016-10-05 17:52:12 -07:00
Christoph Zauner 79287ef280 Add info about return values for function Get(). 2016-10-03 08:24:04 +00:00
Maxim Ivanov d45b0cc68c More flexible Session configuration when using api.Lock 2016-09-29 14:07:54 +01:00
aksentyev 8d69db7a89 CreateIndex, ModifyIndex added for CatalogService 2016-09-28 00:40:25 +03:00
Seth Vargo b8d055dcad
Fix typo 2016-09-26 16:06:56 -07:00
Seth Vargo 7843f284e0
Rename session name to session ID 2016-09-26 16:06:55 -07:00
Seth Vargo 81a28ffd38
Update ModifyIndex comment 2016-09-26 16:06:55 -07:00
Seth Vargo 50424694fc
Add documentation to KVPair
Based on discussions with @slackpad, some of the values in the KVPair are
ReadOnly. This commit updates the docs to reflect that.
2016-09-26 16:06:52 -07:00
James Phillips 5e4db081f7
Removes Raft types from public API interface.
This will cause a lot of breakage because we've currently vendored a
branch of the Raft library.
2016-08-30 14:59:16 -07:00
James Phillips 6be1e07fec
Makes the Raft configuration API easier to consume. 2016-08-30 11:30:56 -07:00
James Phillips 209f003b12
Fixes a stale comment. 2016-08-30 00:10:46 -07:00
James Phillips 1b7a16b7d3
Adds new consul operator endpoint, CLI, and ACL and some basic Raft commands. 2016-08-30 00:02:50 -07:00
James Phillips 0bdbdf1ba8 Merge pull request #2226 from abhinavdahiya/rm-health-unknown
Fixes #1775; Removes 'unknown' state
2016-08-17 17:51:04 -07:00
James Phillips db9a72dde1
Merge branch 'master' into f-deregister-critical 2016-08-16 12:53:21 -07:00
James Phillips bc333335be
Adds an `X-Consul-Translate-Addresses` to signal translation is enabled. 2016-08-16 11:31:41 -07:00
James Phillips 742fcf7a24
Adds missing TaggedAddress structures to API client. 2016-08-16 10:30:30 -07:00
James Phillips f517f9ed0d
Fixes a typo and adds an admonition about only being in Consul 0.7+. 2016-08-16 09:27:20 -07:00
James Phillips b4f981c837
Adds ability to deregister a service based on critical check state longer than a timeout. 2016-08-16 01:00:26 -07:00
Hasyimi Bahrudin 818d2f1d64 Add api environment variables as constants for consistency 2016-08-03 14:40:31 +08:00
Hasyimi Bahrudin b2ad8114fe Remove redundant hardcoded environment variables
The following hardcoded environment variables are removed:

* CONSUL_RPC_ADDR
* CONSUL_HTTP_ADDR
2016-08-03 14:40:26 +08:00
Jeff Mitchell c878aba90c Use header to send Consul token rather than query param. 2016-08-02 16:54:59 -04:00
Abhinav Dahiya 9dc52449e3 Fixes #1775; Removes 'unknown' state
Signed-off-by: Abhinav Dahiya <abhinavdtu2012@gmail.com>
2016-07-30 19:33:14 +05:30
Ryan Uber 6deb17d069 api: add query templates 2016-07-02 16:05:41 -07:00
Ryan Uber d768de2ed4 api: add Near parameter to PQ's 2016-07-01 16:41:46 -07:00
James Phillips a11f32a1da Adds a get-tree verb to KV transaction operations. 2016-05-13 16:57:39 -07:00
James Phillips 2649a6336e Adds a read-only optimized path for transactions. 2016-05-13 00:34:05 -07:00
James Phillips 88b1c7d054 Makes get fail a transaction if the key doesn't exist. 2016-05-11 14:18:31 -07:00
James Phillips 3d35acaa90 De-nests the KV output structure (removes DirEnt member). 2016-05-11 13:48:03 -07:00
James Phillips 04a13ec3d7 Switches to "KV" instead of "KV" for the KV operations. 2016-05-11 10:58:27 -07:00
James Phillips dc662f7e35 Refactors TxnRequest/TxnResponse into a form that will allow non-KV ops.
This isn't needed/used yet, but it's a good hook to get in there so we
can add more atomic operations in the future. The Go API hides this detail
so that feels like a KV-specific API. The implications on the REST API are
pretty minimal.
2016-05-11 01:39:10 -07:00
James Phillips d980cbcd9d Moves txn code into a new endpoint, not specific to KV. 2016-05-10 21:58:02 -07:00
James Phillips c1db39fe85 Adds type for API ops and an example transaction. 2016-05-10 13:36:48 -07:00
James Phillips 471160d8f0 Performs basic plumbing of KVS transactions through all the layers. 2016-05-09 22:15:49 -07:00
Sean Chittenden 0f45d1b76d Correct a small typo 2016-04-23 20:18:19 -07:00
Sean Chittenden 5bc4a2c2ab consul/ uses structs.Health*, the api uses api.Health* 2016-04-23 16:06:58 -07:00
Sean Chittenden 65f9017c63 Update Check API to use constants
Use constants where appropriate to advocate their use.  Also add a deprecation notice re: `updateTTL`.
2016-04-23 16:01:59 -07:00
James Phillips 98140b4cf0 Merge pull request #1876 from hashicorp/f-tls-helper
Adds TLS config helper to API client.
2016-03-24 11:34:24 -07:00
James Phillips c64f9c13d9 Improves the comment for the Address field. 2016-03-24 11:33:44 -07:00
Diptanu Choudhury ad085de7b7 Added some constants in the api for check health statuses 2016-03-24 11:26:07 -07:00
James Phillips 512cb6ebf7 Adds TLS config helper to API client. 2016-03-24 11:24:18 -07:00
James Phillips 1cf1664392 Switches default for API client to pooled connections. 2016-03-10 12:29:50 -08:00
James Phillips a126240a12 Adds support for new PUT API for checks. 2016-03-04 15:18:25 -08:00
James Phillips 551a4fc031 Adds support for EnableTagOverride to the API client. 2016-02-16 11:45:29 -08:00
Seth Vargo dc9131a732 Use HTTPS + www. where appropriate 2016-01-13 17:44:01 -05:00
James Phillips dd4610e917 Factors server error checking into a new function. 2016-01-06 11:35:16 -08:00
James Phillips cab27440e1 Makes the API behave better with small wait values. 2016-01-06 11:05:11 -08:00
James Phillips 6dd0835319 Makes the timeout behavior more intuitive.
Previously, it would try once "up to" the timeout, but in practice it would
just fall through. This modifies the behavior to block until the timeout has
been reached.
2016-01-06 09:40:20 -08:00
James Phillips 169825ed90 Adds the ability for semaphore monitors to ride out brief periods of 500 errors. 2016-01-05 18:22:36 -08:00
James Phillips 3348cf4c0b Adds "try" support to locks and semaphores. 2016-01-05 18:22:36 -08:00
James Phillips 09478b68ed Builds the insecure SSL transport off the clean default transport. 2015-12-17 12:15:18 -08:00
Jeff Mitchell e363c023d7 Revert "Adds client and transport pooling in the API so we don't leak connections." 2015-12-17 10:56:50 -05:00
James Phillips 79aabd0b9e Makes the insecure transport work like the default one. 2015-12-17 06:48:18 -08:00
James Phillips c981bdef8c Adds client and transport pooling in the API so we don't leak connections. 2015-12-16 22:27:07 -08:00
James Phillips 48f9210761 Adds a unit test for lock monitor retries. 2015-11-30 20:16:40 -08:00
James Phillips fcd0cb7a11 Adds custom retry time for lock monitors. 2015-11-30 20:16:22 -08:00
James Phillips 2f3d109b18 Adds a retry capability to lock monitors in the API client. 2015-11-30 17:09:41 -08:00
James Phillips 24611b0732 Updates API docs for version 0.6.0. 2015-11-28 20:04:29 -08:00
Craig Wickesser 1a1a91eb86 Fix version support
Updated the version that the library supports.
2015-11-23 13:03:38 -05:00
James Phillips 23536f2b97 Adds Docker checks support to client API.
Also changed `DockerContainerId` to `DockerContainerID`, and updated the agent
API docs to reflect their support for Docker checks.
2015-11-18 07:40:02 -08:00
James Phillips bc60491890 Removes a useless empty import and fixes some stale comments. 2015-11-17 08:29:20 -08:00
James Phillips 6e4954283a Switches to helpers for prepared query API wrappers. 2015-11-16 23:12:44 -08:00
James Phillips 20ae2e2ce3 Adds API client support for prepared queries. 2015-11-15 17:06:00 -08:00
James Phillips dc1c22f895 Adds support for coordinates to client API. 2015-10-23 15:23:01 -07:00
Mikhail Dyakov 3867392ae5 Handle error in api README example 2015-10-23 21:20:01 +02:00
Jeff Mitchell 9267f956a2 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 06bb9d5f36 Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
James Phillips e4b89bfa9f Fixes a typo. 2015-10-15 14:59:09 -07:00
James Phillips 32e2439f93 Fixes index management for KVS. 2015-10-15 14:59:09 -07:00
Jeff Mitchell 9cddc187b5 Don't use http.DefaultClient
Two of the changes are in tests; the one of consequence is in the API.
As explained in #1308 this can cause conflicts with downstream programs.

Fixes #1308.
2015-10-15 17:49:35 -04:00
James Phillips 570272e459 Merge pull request #1041 from rboyer/api-fix-session-renew
Fix Session.Renew to care about 404s properly
2015-09-25 13:15:54 -07:00
Dale Wijnand c5168e1263 Fix a bunch of typos. 2015-09-15 13:22:08 +01:00
R.B. Boyer 8d5f1528c5 Correct the Session.Renew{,Periodic} to handle session expiration better 2015-09-14 08:52:32 -05:00
Anthony Scalisi 8d733b7fca remove various typos 2015-09-11 12:29:54 -07:00
Peter Fern 86edd7169c Add TCP check type
Adds the ability to simply check whether a TCP socket accepts
connections to determine if it is healthy.  This is a light-weight -
though less comprehensive than scripting - method of checking network
service health.

The check parameter `tcp` should be set to the `address:port`
combination for the service to be tested.  Supports both IPv6 and IPv4,
in the case of a hostname that resolves to both, connections will be
attempted via both protocol versions, with the first successful
connection returning a successful check result.

Example check:

```json
{
  "check": {
    "id": "ssh",
    "name": "SSH (TCP)",
    "tcp": "example.com:22",
    "interval": "10s"
  }
}
```
2015-07-24 14:06:05 +10:00
Robert Gogolok 9bc620feba api: run ACL tests by default 2015-06-13 23:51:30 +02:00
James Phillips 6e5c66a8be Fixes a broken unit test introduced by #834. 2015-06-09 12:01:20 -07:00
Armon Dadgar b9bd6110e2 Merge pull request #1008 from highlyunavailable/master
Check to see why a lock acquisition failed
2015-06-09 07:59:28 -04:00
Ryan Uber 4d8b4abcc5 Merge pull request #834 from apoydence/master
Returns an error for a key with a '/'
2015-06-05 15:23:57 -07:00
Tiru Srikantha 0184227828 Check to see why a lock acquisition failed 2015-06-05 13:23:23 -07:00
highlyunavailable 536db1fb9f Remove unused DefaultSemaphoreRetryTime
Fixes #932

DefaultSemaphoreRetryTime is actually unused, unlike DefaultLockRetryTime.
2015-05-15 08:25:02 -07:00
Armon Dadgar d18d82885f api: improve test reliability 2015-05-12 12:10:25 -07:00
Ryan Uber 3ce3c663ad Fix tests after merge 2015-05-11 18:53:09 -07:00
Armon Dadgar f797130228 Fixing merge conflict 2015-05-11 16:48:10 -07:00
Armon Dadgar eda7c1fdfc Merge pull request #912 from rojojo23/renew-periodic
modify RenewPeriodic to retry failed Renew until TTL elapses
2015-05-08 11:38:51 -07:00
Ryan Uber 234466b412 api: run tests in parallel 2015-05-08 10:27:24 -07:00
Robert Johnson d934906905 modify RenewPeriodic to retry failed Renews until TTL elapses 2015-05-06 16:40:45 -07:00
Armon Dadgar 9ca81565a5 api: Fixing test compilation issue 2015-05-04 15:27:22 -07:00
Armon Dadgar 63bd33ff0b Merge pull request #861 from fraenkel/reclaim_lock
Reclaim locks
2015-05-04 15:23:29 -07:00
Michael Fraenkel 093b23d0c3 Reclaim locks
- When attempting to lock with the same session that already owns the lock,
  Lock() will re-acquire the lock.
2015-04-29 10:10:24 -07:00
Ryan Mills 370853d7ff Allow specifying a status field in the agent/service/register and agent/check/register endpoints.
This status must be one of the valid check statuses: 'passing', 'warning', 'critical', 'unknown'.
If the status field is not present or the empty string, the default of 'critical' is used.
2015-04-12 02:00:31 +00:00
Andrew Poydence 3f6a912af6 Returns an error for a key with a '/' 2015-03-31 21:08:06 -06:00
Ryan Uber 73a2799b0d testutil: Use HTTPAddr 2015-03-19 17:03:07 -07:00
Ryan Uber 64c1b1b446 testutil: exposing the API address from the test server 2015-03-19 17:03:06 -07:00
Ryan Uber 0af4bd8b23 testutil: initial pass at moving test server harness into testutil 2015-03-19 17:03:06 -07:00
Seth Vargo 51a6ecd826 Read select environment variables when generating the default configuration 2015-03-18 11:12:10 -04:00
Chris Grieger bd0c864495 Add 'ServiceAddress' field to 'CatalogService's truct 2015-03-04 10:29:57 +01:00
Ryan Uber 73eae757cf api: remove unneeded static config 2015-02-24 09:50:35 -08:00
Armon Dadgar 6f48e58014 api: Refactoring into shared write logic 2015-02-18 15:15:02 -08:00
Armon Dadgar 69d8b46fa5 api: Refactoring into shared query logic 2015-02-18 15:15:02 -08:00
Ryan Uber c248d5badd api: allow timeout field to be specified for checks 2015-02-05 23:34:30 -08:00
Nicholas Capo 25d2faf43b api/agent: Support HTTP service checks in client api 2015-02-03 20:13:55 +00:00
Armon Dadgar f4543ffc78 CHANGELOG update, gofmt 2015-01-22 13:42:22 -08:00
Armon Dadgar e5e519df4b Merge pull request #625 from hashicorp/f-maintcmd
New "maint" command
2015-01-22 11:56:49 -08:00
Dr. Stefan Schimanski b46d20727b Add test case for service Address field 2015-01-22 11:50:20 +01:00
Dr. Stefan Schimanski 1ef12ae24b Add agent service Address field to the api
The Address field was introduced in #570. This patch extends this to the api.
2015-01-22 10:26:27 +01:00
Ryan Uber d10529c233 api: support reason flag for maintenance mode 2015-01-21 13:02:47 -08:00
Ryan Uber 420d4d0ba4 api: finish up maintenance tests 2015-01-21 11:08:57 -08:00
Ryan Uber 98d47d2b9a api: add node/service maintenance mode functions 2015-01-21 10:51:43 -08:00
Ryan Uber a9069b5993 api: support multiple checks during service/check registration 2015-01-20 21:48:45 -08:00
Armon Dadgar a9819e71a8 Fixing merge conflict 2015-01-20 13:01:13 -08:00
Armon Dadgar de199d1fd6 api: Fixing some comments 2015-01-20 12:58:09 -08:00
Armon Dadgar 707b232274 api: Refactor to share session renew code 2015-01-19 16:53:47 -10:00
Armon Dadgar bed066dda9 api: Detect conflicting existing values for lock/semaphore 2015-01-19 15:32:19 -10:00
Armon Dadgar 1a6b160641 api: Make channels receive only 2015-01-19 14:37:36 -10:00
Ryan Uber 5137388d43 Merge pull request #608 from imkira/fixBodyLeak
fixed: body not closed for non HTTP 200 responses
2015-01-19 09:33:06 -08:00
Mário Freitas 90b74ee4e2 fixed: requireOK should close Body on error 2015-01-19 11:53:21 +09:00
Mário Freitas 2db0a65a74 Revert "fixed: body not closed for non HTTP 200 responses"
This reverts commit dafa61ad10d67d1992201f8499ef681e01de8a09.
2015-01-19 11:51:51 +09:00
Ryan Uber 7c6455e1ba api: simple test for unix socket connectivity 2015-01-16 10:56:47 -08:00
Ryan Uber 705801ccca agent: fixing up tests 2015-01-16 09:58:37 -08:00
Mário Freitas 18c4d6ea9e fixed: body not closed for non HTTP 200 responses 2015-01-16 18:54:55 +09:00
Ryan Uber ad19c0afc2 agent: beginning refactor 2015-01-16 00:45:03 -08:00
Jeff Mitchell 9bd66c70e5 Ensure a socket is created for permissions adjustment tests and fix some
items pointed out in the code review

This code is copyright 2014 Akamai Technologies, Inc. <opensource@akamai.com>
2015-01-15 14:33:44 +00:00
Jeff Mitchell 5cd607b89a Unix socket-based HTTP API test functionality. As a consequence this
also required making some hardcoded values into more generic
functionality, which is generally a good thing. I verified that each
test function that I modified still passed.:

This code is copyright 2014 Akamai Technologies, Inc. <opensource@akamai.com>
2015-01-14 19:49:37 +00:00
Jeff Mitchell 400eadd671 RPC and HTTP interfaces fully generically-sockified so Unix is supported.
Client works for RPC; will honor CONSUL_RPC_ADDR. HTTP works via consul/api;
honors CONSUL_HTTP_ADDR.

The format of a Unix socket in configuration data is:
"unix://[/path/to/socket];[username or uid];[gid];[mode]"

Obviously, the user must have appropriate permissions to create the socket
file in the given path and assign the requested uid/gid. Also note that Go does
not support gid lookups from group name, so gid must be numeric. See
https://codereview.appspot.com/101310044

When connecting from the client, the format is just the first part of the
above line:
"unix://[/path/to/socket]"

This code is copyright 2014 Akamai Technologies, Inc. <opensource@akamai.com>
2015-01-14 19:31:21 +00:00
Armon Dadgar af186ac54a api: Adding Destroy to cleanup a semaphore 2015-01-13 14:18:28 -08:00
Armon Dadgar a12883a5be api: Adding Destroy to cleanup a lock 2015-01-13 14:01:50 -08:00
Armon Dadgar 18ebb1a8e9 api: Add support for DeleteCAS 2015-01-13 13:57:48 -08:00
Armon Dadgar 6da4761221 Merge pull request #600 from hashicorp/f-api-semaphore
Adding Semaphore support to API
2015-01-13 11:59:22 -08:00
Armon Dadgar 2baa97dde5 api: Changing default semaphore key 2015-01-13 11:51:12 -08:00
Armon Dadgar 229ee483cb api: More reliable session check 2015-01-13 11:50:57 -08:00
Armon Dadgar 02566d0a02 api: Enable debug output from Consul for tests 2015-01-13 11:50:09 -08:00
Ryan Uber 15d7b7e948 api: make node health test more reliable 2015-01-13 11:25:32 -08:00
Armon Dadgar 25bda51af3 api: More semaphore tests 2015-01-12 18:18:32 -08:00
Armon Dadgar 755525e424 api: Adding semaphore tests and fixes 2015-01-12 18:13:52 -08:00
Armon Dadgar 161633eee4 api: First pass at semaphore 2015-01-12 17:43:54 -08:00
Armon Dadgar 654a292c89 api: Minor cleanups in lock 2015-01-12 17:43:13 -08:00
Armon Dadgar 625e45e21e Merge pull request #594 from hashicorp/f-api-lock
api: Adding Lock helpers for leader election
2015-01-12 15:47:35 -08:00
Armon Dadgar c597f191e3 api: Fixing typo 2015-01-12 15:46:40 -08:00
Armon Dadgar 02c2cc6e08 api: Fixing typos 2015-01-09 17:42:24 -08:00
Armon Dadgar 4e66d5407d api: Adding Lock helpers for leader election 2015-01-09 17:35:17 -08:00
Ryan Uber ab7896256f api: test for a known leader as well as index > 0 2015-01-09 16:39:35 -08:00
Ryan Uber 3ff137ed54 api: improve reliability of catalog endpoint tests 2015-01-07 18:29:42 -08:00
Armon Dadgar 102816ac7f api: Adding constants for session behaviors 2015-01-07 14:01:27 -08:00
Ryan Uber c9b230d25f Import HTTP basic auth patch from armon/consul-api#16 2015-01-07 13:01:44 -08:00
Ryan Uber e108162020 api: improve test reliability 2015-01-06 16:51:28 -08:00
Ryan Uber 9beeb6c81b api: use WaitForResult() to improve health tests 2015-01-06 16:18:50 -08:00
Ryan Uber 77f041b41f api: run consul instance on testing ports 2015-01-06 16:18:29 -08:00
Ryan Uber 1faf1110aa api: add harnessing for tests
This is necessary as consul-api's tests require a real consul instance
to be running. We can't directly import an agent to fire up an instance,
due to the way this would create an import cycle. These tests instead
will start a consul instance using the binary in $PATH (if it exists).
2015-01-06 15:52:06 -08:00
Ryan Uber 5172b21ee8 api: initial import from armon/consul-api 2015-01-06 10:40:00 -08:00