Class ConfigServerConfigurationProvider
A Spring Cloud Config Server based
Inheritance
Implements
Namespace: Steeltoe.Extensions.Configuration.ConfigServer
Assembly: Steeltoe.Extensions.Configuration.ConfigServerBase.dll
Syntax
public class ConfigServerConfigurationProvider : ConfigurationProvider
Constructors
| Edit this page View SourceConfigServerConfigurationProvider(ILoggerFactory)
Initializes a new instance of the ConfigServerConfigurationProvider class with default configuration settings. ConfigServerClientSettings
Declaration
public ConfigServerConfigurationProvider(ILoggerFactory logFactory = null)
Parameters
Type | Name | Description |
---|---|---|
ILoggerFactory | logFactory | optional logging factory |
ConfigServerConfigurationProvider(ConfigServerClientSettings, HttpClient, ILoggerFactory)
Initializes a new instance of the ConfigServerConfigurationProvider class.
Declaration
public ConfigServerConfigurationProvider(ConfigServerClientSettings settings, HttpClient httpClient, ILoggerFactory logFactory = null)
Parameters
Type | Name | Description |
---|---|---|
ConfigServerClientSettings | settings | the configuration settings the provider uses when accessing the server. |
HttpClient | httpClient | a HttpClient the provider uses to make requests of the server. |
ILoggerFactory | logFactory | optional logging factory |
ConfigServerConfigurationProvider(ConfigServerClientSettings, ILoggerFactory)
Initializes a new instance of the ConfigServerConfigurationProvider class.
Declaration
public ConfigServerConfigurationProvider(ConfigServerClientSettings settings, ILoggerFactory logFactory = null)
Parameters
Type | Name | Description |
---|---|---|
ConfigServerClientSettings | settings | the configuration settings the provider uses when accessing the server. |
ILoggerFactory | logFactory | optional logging factory |
ConfigServerConfigurationProvider(ConfigServerConfigurationSource)
Initializes a new instance of the ConfigServerConfigurationProvider class from a ConfigServerConfigurationSource
Declaration
public ConfigServerConfigurationProvider(ConfigServerConfigurationSource source)
Parameters
Type | Name | Description |
---|---|---|
ConfigServerConfigurationSource | source | the ConfigServerConfigurationSource the provider uses when accessing the server. |
ConfigServerConfigurationProvider(ConfigServerConfigurationSource, HttpClient)
Initializes a new instance of the ConfigServerConfigurationProvider class from a ConfigServerConfigurationSource
Declaration
public ConfigServerConfigurationProvider(ConfigServerConfigurationSource source, HttpClient httpClient)
Parameters
Type | Name | Description |
---|---|---|
ConfigServerConfigurationSource | source | the ConfigServerConfigurationSource the provider uses when accessing the server. |
HttpClient | httpClient | the httpClient to use |
Fields
| Edit this page View Source_configuration
Declaration
protected IConfiguration _configuration
Field Value
Type | Description |
---|---|
IConfiguration |
_httpClient
Declaration
protected HttpClient _httpClient
Field Value
Type | Description |
---|---|
HttpClient |
_logger
Declaration
protected ILogger _logger
Field Value
Type | Description |
---|---|
ILogger |
_loggerFactory
Declaration
protected ILoggerFactory _loggerFactory
Field Value
Type | Description |
---|---|
ILoggerFactory |
_settings
Declaration
protected ConfigServerClientSettings _settings
Field Value
Type | Description |
---|---|
ConfigServerClientSettings |
PREFIX
The prefix (
Declaration
public const string PREFIX = null
Field Value
Type | Description |
---|---|
System.String |
STATE_HEADER
Declaration
public const string STATE_HEADER = null
Field Value
Type | Description |
---|---|
System.String |
TOKEN_HEADER
Declaration
public const string TOKEN_HEADER = null
Field Value
Type | Description |
---|---|
System.String |
Properties
| Edit this page View SourceSettings
Gets the configuration settings the provider uses when accessing the server.
Declaration
public virtual ConfigServerClientSettings Settings { get; }
Property Value
Type | Description |
---|---|
ConfigServerClientSettings |
Methods
| Edit this page View SourceAddConfigServerClientSettings()
Adds the client settings for the Configuration Server to the Data dictionary
Declaration
protected virtual void AddConfigServerClientSettings()
AddConfigServerClientSettings(IDictionary<String, String>)
Adds the client settings for the Configuration Server to the data dictionary
Declaration
protected virtual void AddConfigServerClientSettings(IDictionary<string, string> data)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<System.String, System.String> | data |
AddPropertySource(PropertySource)
Adds values from a PropertySource to the Configurtation Data dictionary managed by this provider
Declaration
protected virtual void AddPropertySource(PropertySource source)
Parameters
Type | Name | Description |
---|---|---|
PropertySource | source | a property source to add |
AddPropertySource(PropertySource, IDictionary<String, String>)
Adds values from a PropertySource to the provided dictionary.
Declaration
protected void AddPropertySource(PropertySource source, IDictionary<string, string> data)
Parameters
Type | Name | Description |
---|---|---|
PropertySource | source | a property source to add |
IDictionary<System.String, System.String> | data | the dictionary to add the property source to |
Build(IConfigurationBuilder)
Declaration
public virtual IConfigurationProvider Build(IConfigurationBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationBuilder | builder |
Returns
Type | Description |
---|---|
IConfigurationProvider |
ConvertArrayKey(String)
Declaration
protected virtual string ConvertArrayKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.String |
ConvertKey(String)
Declaration
protected virtual string ConvertKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.String |
ConvertValue(Object)
Declaration
protected virtual string ConvertValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.String |
Deserialize(Stream)
Deserialize the response from the Configuration Server
Declaration
protected virtual ConfigEnvironment Deserialize(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | the stream representing the response from the Configuration Server |
Returns
Type | Description |
---|---|
ConfigEnvironment | The ConfigEnvironment object representing the response from the server |
FetchAccessToken()
Conduct the OAuth2 client_credentials grant flow returning a task that can be used to obtain the results
Declaration
protected string FetchAccessToken()
Returns
Type | Description |
---|---|
System.String | The task object representing asynchronous operation |
GetConfigServerUri(String)
Create the Uri that will be used in accessing the Configuration Server
Declaration
protected virtual string GetConfigServerUri(string label)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | a label to add |
Returns
Type | Description |
---|---|
System.String | The request URI for the Configuration Server |
GetConfigServerUri(String, String)
Create the Uri that will be used in accessing the Configuration Server
Declaration
protected virtual string GetConfigServerUri(string baseRawUri, string label)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseRawUri | base server uri to use |
System.String | label | a label to add |
Returns
Type | Description |
---|---|
System.String | The request URI for the Configuration Server |
GetEncoded(String, String)
Encode the username password for a http request
Declaration
protected string GetEncoded(string user, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | user | the username |
System.String | password | the password |
Returns
Type | Description |
---|---|
System.String | Encoded user + password |
GetHttpClient(ConfigServerClientSettings)
Creates an appropriatly configured HttpClient that will be used in communicating with the Spring Cloud Configuration Server
Declaration
protected static HttpClient GetHttpClient(ConfigServerClientSettings settings)
Parameters
Type | Name | Description |
---|---|---|
ConfigServerClientSettings | settings | the settings used in configuring the HttpClient |
Returns
Type | Description |
---|---|
HttpClient | The HttpClient used by the provider |
GetRequestMessage(String)
Create the HttpRequestMessage that will be used in accessing the Spring Cloud Configuration server
Declaration
protected virtual HttpRequestMessage GetRequestMessage(string requestUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestUri | the Uri used when accessing the server |
Returns
Type | Description |
---|---|
HttpRequestMessage | The HttpRequestMessage built from the path |
GetRequestMessage(String, String, String)
Create the HttpRequestMessage that will be used in accessing the Spring Cloud Configuration server
Declaration
protected virtual HttpRequestMessage GetRequestMessage(string requestUri, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestUri | the Uri used when accessing the server |
System.String | username | username to use if required |
System.String | password | password to use if required |
Returns
Type | Description |
---|---|
HttpRequestMessage | The HttpRequestMessage built from the path |
GetValutRenewMessage(String)
Declaration
protected virtual HttpRequestMessage GetValutRenewMessage(string requestUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestUri |
Returns
Type | Description |
---|---|
HttpRequestMessage |
GetVaultRenewMessage(String)
Declaration
protected virtual HttpRequestMessage GetVaultRenewMessage(string requestUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestUri |
Returns
Type | Description |
---|---|
HttpRequestMessage |
GetVaultRenewUri()
Declaration
protected virtual string GetVaultRenewUri()
Returns
Type | Description |
---|---|
System.String |
IsDiscoveryFirstEnabled()
Declaration
protected bool IsDiscoveryFirstEnabled()
Returns
Type | Description |
---|---|
System.Boolean |
Load()
Loads configuration data from the Spring Cloud Configuration Server as specified by the Settings
Declaration
public override void Load()
RefreshVaultTokenAsync(Object)
Declaration
protected async void RefreshVaultTokenAsync(object state)
Parameters
Type | Name | Description |
---|---|---|
System.Object | state |
RemoteLoadAsync(String)
Asynchronously calls the Spring Cloud Configuration Server using the provided Uri and returning a a task that can be used to obtain the results
Declaration
protected virtual async Task<ConfigEnvironment> RemoteLoadAsync(string requestUri)
Parameters
Type | Name | Description |
---|---|---|
System.String | requestUri | the Uri used in accessing the Spring Cloud Configuration Server |
Returns
Type | Description |
---|---|
Task<ConfigEnvironment> | The task object representing the asynchronous operation |
RemoteLoadAsync(String[], String)
Declaration
protected async Task<ConfigEnvironment> RemoteLoadAsync(string[] requestUris, string label)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | requestUris | |
System.String | label |
Returns
Type | Description |
---|---|
Task<ConfigEnvironment> |
RenewToken(String)
Declaration
protected virtual void RenewToken(string token)
Parameters
Type | Name | Description |
---|---|---|
System.String | token |
Split(String)
Declaration
protected virtual string[] Split(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
Returns
Type | Description |
---|---|
System.String[] |