From bf727b02ed1005dcd9b3ef44287c927b206d61f5 Mon Sep 17 00:00:00 2001 From: w1ano <83294629+w1ano@users.noreply.github.com> Date: Wed, 19 Jun 2024 05:18:40 -0500 Subject: [PATCH 1/2] Added to GetCARoots, added GetCARoots with QueryOptions parameter --- Consul/Agent.cs | 16 ++++++++++++++++ Consul/Interfaces/IAgentEndpoint.cs | 1 + 2 files changed, 17 insertions(+) diff --git a/Consul/Agent.cs b/Consul/Agent.cs index 7d57fd7df..9802af599 100644 --- a/Consul/Agent.cs +++ b/Consul/Agent.cs @@ -1164,11 +1164,27 @@ public async Task> GetServiceConfiguration(str return await _client.Get($"/v1/agent/service/{serviceId}", q).Execute(ct).ConfigureAwait(false); } + /// + /// GetCARoots returns root certificates in the cluster + /// + /// Cancellation Token + /// Root certificates public async Task> GetCARoots(CancellationToken ct = default) { return await _client.Get("v1/agent/connect/ca/roots", QueryOptions.Default).Execute(ct).ConfigureAwait(false); } + /// + /// GetCARoots returns root certificates in the cluster + /// + /// Query Options + /// Cancellation Token + /// Root certificates + public async Task> GetCARoots(QueryOptions q, CancellationToken ct = default) + { + return await _client.Get("v1/agent/connect/ca/roots", q).Execute(ct).ConfigureAwait(false); + } + /// /// Log streamer /// diff --git a/Consul/Interfaces/IAgentEndpoint.cs b/Consul/Interfaces/IAgentEndpoint.cs index bfbeba630..3408437da 100644 --- a/Consul/Interfaces/IAgentEndpoint.cs +++ b/Consul/Interfaces/IAgentEndpoint.cs @@ -64,6 +64,7 @@ public interface IAgentEndpoint Task> GetLocalServiceHealthByID(string serviceID, CancellationToken ct = default); Task> GetAgentMetrics(CancellationToken ct = default); Task> GetCARoots(CancellationToken ct = default); + Task> GetCARoots(QueryOptions q, CancellationToken ct = default); Task> GetAgentVersion(CancellationToken ct = default); Task Reload(CancellationToken ct = default); [Obsolete] From 07c9b31b561047622a6f085f1d059a7eddf70598 Mon Sep 17 00:00:00 2001 From: w1ano <83294629+w1ano@users.noreply.github.com> Date: Wed, 19 Jun 2024 06:57:31 -0500 Subject: [PATCH 2/2] Minor fix to GetCaRoots --- Consul/Agent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Consul/Agent.cs b/Consul/Agent.cs index 9802af599..caaaaa05f 100644 --- a/Consul/Agent.cs +++ b/Consul/Agent.cs @@ -1171,7 +1171,7 @@ public async Task> GetServiceConfiguration(str /// Root certificates public async Task> GetCARoots(CancellationToken ct = default) { - return await _client.Get("v1/agent/connect/ca/roots", QueryOptions.Default).Execute(ct).ConfigureAwait(false); + return await GetCARoots(QueryOptions.Default, ct).ConfigureAwait(false); } ///