From 99c99382d819df4bbed1841d5d88c57465b623df Mon Sep 17 00:00:00 2001 From: Shawn Abshire Date: Sun, 21 Jan 2024 11:54:50 -0600 Subject: [PATCH] feat(cloudbuilder): Add UsePersistedStoragePath configuration to the final step of the builder to configure where to store tokens. --- Client/Api/Builder/ICamundaCloudClientBuilder.cs | 7 +++++++ .../Api/Builder/ICamundaCloudTokenProviderBuilder.cs | 2 +- Client/Impl/Builder/CamundaCloudClientBuilder.cs | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Client/Api/Builder/ICamundaCloudClientBuilder.cs b/Client/Api/Builder/ICamundaCloudClientBuilder.cs index d7f7ba4a..de4fa5c9 100644 --- a/Client/Api/Builder/ICamundaCloudClientBuilder.cs +++ b/Client/Api/Builder/ICamundaCloudClientBuilder.cs @@ -76,6 +76,13 @@ public interface ICamundaCloudClientBuilderFinalStep /// the next step in building a ICamundaCloudClient ICamundaCloudClientBuilderFinalStep UseAuthServer(string url); + /// + /// Sets the given path to store credentials on disk. + /// + /// the path where to store the credentials. + /// the fluent ICamundaCloudClientBuilderFinalStep. + ICamundaCloudClientBuilderFinalStep UsePersistedStoragePath(string path); + /// /// The IZeebeClient, which is setup entirely to talk with the defined Camunda Cloud cluster. /// diff --git a/Client/Api/Builder/ICamundaCloudTokenProviderBuilder.cs b/Client/Api/Builder/ICamundaCloudTokenProviderBuilder.cs index d623b237..6b460d7e 100644 --- a/Client/Api/Builder/ICamundaCloudTokenProviderBuilder.cs +++ b/Client/Api/Builder/ICamundaCloudTokenProviderBuilder.cs @@ -63,7 +63,7 @@ public interface ICamundaCloudTokenProviderBuilderFinalStep /// Use given path to store credentials on disk. /// /// Per default credentials are stored in the home directory. - /// The path were to store the credentials. + /// The path where to store the credentials. /// The final step in building a CamundaCloudTokenProvider. ICamundaCloudTokenProviderBuilderFinalStep UsePath(string path); diff --git a/Client/Impl/Builder/CamundaCloudClientBuilder.cs b/Client/Impl/Builder/CamundaCloudClientBuilder.cs index 8f551333..f0990f39 100644 --- a/Client/Impl/Builder/CamundaCloudClientBuilder.cs +++ b/Client/Impl/Builder/CamundaCloudClientBuilder.cs @@ -75,6 +75,18 @@ public ICamundaCloudClientBuilderFinalStep UseAuthServer(string url) return this; } + public ICamundaCloudClientBuilderFinalStep UsePersistedStoragePath(string path) + { + if (path is null) + { + // use default + return this; + } + + camundaCloudTokenProviderBuilder.UsePath(path); + return this; + } + private string GetFromEnv(string key) { char[] charsToTrim = { ' ', '\'' };