- Added the
Type
field to theAgentCheck
andHealthCheck
structures - Added the possibility to specify more http request options and meta-data when registrating service checks.
It is now possible to specify the http Header(s) (
Headers
),Method
andBody
to be used for a given service check. A given service check might also now have an identifier (ID
),Name
and a description (Notes
) associated. - Fix issue #24 removing constructor's Obsolete attribute for HttpClient injection
- Fix issue #9 preventing use of the library with .NET Framework
- Upgrade to .NET 4.6.1 and .NET Core 2.0
- Add missing code documentation
- General cleanup
- Make unit tests run on .NET framework
- Added new Token, Policy and Role API Entry points to reflect the ACL changes made in Consul 1.4.0 and 1.5.0
- Aligned to Consul API 1.6.1
- The method of configuring the ConsulClient has been reworked. It now
uses
Action
s to configure the options inside itself - e.g.var client = new ConsulClient((cfg) => { cfg.Datacenter = "us-west-2"; }
See the fileConsul.Test/ClientTest.cs
and the test methodClient_Constructors()
for more examples. The old method will work but has been made Obsolete. - The
ExecuteAbortableLocked
method has been removed. - Requests to use the
X-Consul-Token
header instead of the?token=
query parameter. This may break use of ACLs with very old Consuls (< 0.6.0). Please file an issue if this breaks for you.
- Fixed up a few leaking tasks in Sessions, Locks and Semaphores, as well as properly waiting for the previously-leaked tasks to complete. Also made some tasks Long Running in the TPL sense.
- New APIs ported:
- Snapshot API. Requires >= Consul 0.7.1 to use.
- Keyring API. Requires >= Consul 0.7.2 to use.
- Agent Leave/Reload APIs. Requires >= Consul 0.7.2 to use.
- Added
TLSSkipVerify
andDeregisterCriticalServiceAfter
to the AgentServiceCheck class. Requires >= Consul 0.7.0 to use. - Added
Health.AggregatedStatus()
extension method to anyIEnumerable<HealthCheck>
to roll up a set of checks. Can be used with any version of Consul. - Renamed
CheckStatus
toHealthStatus
. This affects theAgentServiceCheck
andAgentCheck
classes. - Changed the
Health.HealthCheck
Status
field to be of typeHealthStatus
instead ofstring
.
- Added missing nuget info to project.json. Thanks @latop2604!
- Added a couple missing interfaces to IConsulClient. Thanks @chrishoffman!
- Cleaned up a few minor logic errors and made disposal of internally-used
CancellationTokenSources
a lot more explicit instead of leaking them.
- Revert inadvertent upgrade to .NET 4.5.1.
- Fixed a variety of bugs that could cause sessions to be destroyed if provided
to a Lock or Semaphore via a
LockOptions
orSemaphoreOptions
object.
- Ported in changes from the Consul Go API for 0.7.0. Most of these
require 0.7.0 servers/agents. The changes are:
- Atomic transactions for the KV store
- Only retry locks/semaphores on Consul errors, not on all errors
- Add the
Near
property to Prepared Queries - Add Query Templates to Prepared Queries, with regex filtering
- Change all requests to use the
X-Consul-Token
header instead of the?token=
query parameter. - Add the ability to deregister a service that has been critical for an arbitrary period of time.
- Signal WAN address translation and add the ability to look up the WAN and LAN addresses if address translation is being used.
- Added Operator API to allow Raft editing.
- Added the ability to set
LockOpts.LockRetryTime
. Thanks @pfrejlich!
- Add an optional CancellationToken parameter to every method that ends up doing an HTTP request. Some of these can create an unstable Consul state (e.g. allowing the release of a distribted Semaphore to be canceled) but in many cases they should only be used if the call can possibly fail and a secondary timeout is needed.
- Add .NET Core port and build process thanks to work by @akatz0813.
- Converted all Locks and Semaphores to be totally
async
thanks to work by @mjgoethe. - Entirely removed the method
ExecuteAbortableLocked
and all functionality around aborting a thread based on a Consul lock. - Reworked configuration of the
ConsulClient
to useAction<T>
to configure options.
- Correct the behavior of
LockTryOnce/SemaphoreTryOnce
so that it now properly waits one multiple of the WaitTime before exiting in case of it already being held.
- Disable Client Certificates on Mono since the certificate handler is not implemented at the Mono library level.
- Added missing CancellationToken overrides to allow long polling for
Catalog.Node()
andCatalog.Service()
.
- Fixed configuration reuse between multiple clients so multiple
ConsulClient
s that exist one after the other that both reference the same configuration do not spuriously dispose of part of theConsulClientConfiguration
.
- The
Newtonsoft.Json
DLL is now ILMerged into theConsul
DLL, so there should be no more issues with mismatched JSON.NET versions in user projects. Thanks @grounded042!
- Fix a bug where setting
ConsulClientConfiguration.WaitTime
would cause 400 Bad Request responses. Also convertedQueryOptions.WaitTime
to a nullable timespan to match theConsulClientConfiguration
property of the same name/purpose.
- Fix a bug where the StatusCode was not being set correctly on some result types.
- Port in Consul 0.6.4 API since 0.6.4 is now released, which was just an
update to
UpdateTTL
and a rename of some of the strings. - Moved all the helper objects (
TTLStatus
,CheckStatus.Passing
, etc.) to referencestatic readonly
instances to cut down on allocation and ease comparison. - Marked AbortableLock obselete since
Thread.Abort
doesn't exist in DNXCore and it's contrary to the Task philosophy to abort threads.
- Add missing
IDisposable
toIConsulClient
. - Made the setters for
CreateIndex
andModifyIndex
onACLEntry
,KVPair
andSessionEntry
public to allow for easier unit testing. - Ported the
EnableTagOverride
feature from https://github.com/hashicorp/consul/commit/afdeb2f1fc189c5a9e6440c27c1918e7b09c2cdc
- Added a
ConsulClient(ConsulClientConfiguration, HttpClient)
constructor that allows a user to pass in a custom HttpClient to set a custom proxy setting/timeout.
- Fixed double-encoding of
UpdateTTL
note
argument.
- Removed use of PushStreamContent to fix Mono problems.
- Added the ability to use Client Certificates to authenticate a client against
a Consul agent endpoint that is protected by some other service. See the
ClientCertificate
property ofConsulClientConfiguration
. Thanks @AndyRB! - Fixed a possible deadlock in the Session
RenewPeriodic
method.
- Implemented the IDisposable Pattern for the
ConsulClient
class.ConsulClient
objects should now haveDispose()
called on them to properly clean up. Thanks @TMaster! - Cleaned up the Prepared Queries endpoint stack.
- Fixed a timing bug in one of the client execute calls.
- Added Docker checks
- Added the ability for Semaphores and Locks to ride out brief periods of
failure using the
MonitorRetries
andMonitorRetryTime
fields inLockOptions
andSemaphoreOptions
classes. - Added the ability for Semaphores and Locks to have configurable
WaitTime
values, as well as to operate inTryOnce
mode, which means it attempts to acquire once and throws an exception if the acquisition was not successful. To use these, set theLockWaitTime
andLockTryOnce
fields on theLockOptions
class and theSemaphoreWaitTime
andSemaphoreTryOnce
fields on theSemaphoreOptions
class.
- Reduce the callstack and task overhead by returning the originating Task where possible. Thanks @TMaster!
- Rewrote entire API to be
async
. - Added Prepared Queries from Consul 0.6.0.
- Reworked the entire Client class to use
System.Net.HttpClient
as its underpinning rather thanWebRequest
/WebResponse
. - Moved all tests to Xunit.
- Converted all uses of
System.Web.HttpUtility.UrlPathEncode
toSystem.Uri.EscapeDataString
.
- Added coordinates API. WARNING: No check is done to see if the API is available. If used against a 0.5.2 agent, an exception will be thrown because the agent does not understand the coordinate URL.
- Fixed bug in tests for session renewal.
- Fixed a bug where the node name was not deserialized when using the
Catalog.Nodes()
endpoint. Thanks @lockwobr! - Fixed a bug where a zero timespan could not be specified for Lock Delays, TTLs or Check Intervals. Thanks @eugenyshchelkanov!
- Port in changes from hashicorp/consul master:
- Add TCP check type
- BEHAVIOR CHANGE: Changed Session.Renew() to now throw a SessionExpiredException when the session does not exist on the Consul server
- BEHAVIOR CHANGE: Changed all the KV write methods (Put, Delete,
DeleteTree, DeleteCAS, CAS, Release, Acquire) to throw an
InvalidKeyPairException if the key path or prefix begins with a
/
character.
- Fixed documentation typos.
- Convert all uses of
System.Web.HttpUtility.UrlEncode
and corresponding UrlDecode calls to
UrlPathEncode/Decode.
This is was because UrlEncode encodes spaces as a
+
symbol rather than the hex%20
as expected.
- Fix a NullReferenceException when the Consul connection is down and the WebException returned has an empty response.
- BREAKING CHANGE: Renamed
Client
class toConsulClient
andConfig
toConsulClientConfiguration
to reduce confusion. - Completed major rework of the Client class to remove unneeded type parameters from various internal calls
- Added interfaces to all the endpoint classes so that test mocking is possible.