Skip to content

Commit 47da8ec

Browse files
committed
[r] to file-scoped namespaces
1 parent 0ca7d63 commit 47da8ec

File tree

24 files changed

+837
-861
lines changed

24 files changed

+837
-861
lines changed
Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
11
using System;
22

3-
namespace Etcd.Microsoft.Extensions.Configuration.Auth
3+
namespace Etcd.Microsoft.Extensions.Configuration.Auth;
4+
5+
/// <summary>
6+
/// Provides credentials
7+
/// </summary>
8+
/// <seealso cref="ICredentials" />
9+
public class Credentials : ICredentials
410
{
511
/// <summary>
6-
/// Provides credentials
12+
/// Initializes a new instance of the <see cref="Credentials"/> class.
713
/// </summary>
8-
/// <seealso cref="ICredentials" />
9-
public class Credentials : ICredentials
14+
/// <param name="userName">Name of the user.</param>
15+
/// <param name="password">The password.</param>
16+
/// <exception cref="ArgumentException">
17+
/// Value cannot be null or empty. - userName
18+
/// or
19+
/// Value cannot be null or empty. - password
20+
/// </exception>
21+
public Credentials(string userName, string password)
1022
{
11-
/// <summary>
12-
/// Initializes a new instance of the <see cref="Credentials"/> class.
13-
/// </summary>
14-
/// <param name="userName">Name of the user.</param>
15-
/// <param name="password">The password.</param>
16-
/// <exception cref="ArgumentException">
17-
/// Value cannot be null or empty. - userName
18-
/// or
19-
/// Value cannot be null or empty. - password
20-
/// </exception>
21-
public Credentials(string userName, string password)
22-
{
23-
if (string.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", nameof(userName));
24-
if (string.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", nameof(password));
23+
if (string.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", nameof(userName));
24+
if (string.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", nameof(password));
2525

26-
UserName = userName;
27-
Password = password;
28-
}
26+
UserName = userName;
27+
Password = password;
28+
}
2929

30-
/// <summary>
31-
/// Gets the name of the user.
32-
/// </summary>
33-
/// <value>
34-
/// The name of the user.
35-
/// </value>
36-
public string UserName { get; }
30+
/// <summary>
31+
/// Gets the name of the user.
32+
/// </summary>
33+
/// <value>
34+
/// The name of the user.
35+
/// </value>
36+
public string UserName { get; }
3737

38-
/// <summary>
39-
/// Gets the password.
40-
/// </summary>
41-
/// <value>
42-
/// The password.
43-
/// </value>
44-
public string Password { get; }
45-
}
38+
/// <summary>
39+
/// Gets the password.
40+
/// </summary>
41+
/// <value>
42+
/// The password.
43+
/// </value>
44+
public string Password { get; }
4645
}
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
namespace Etcd.Microsoft.Extensions.Configuration.Auth
1+
namespace Etcd.Microsoft.Extensions.Configuration.Auth;
2+
3+
/// <summary>
4+
/// Represents credentials
5+
/// </summary>
6+
public interface ICredentials
27
{
38
/// <summary>
4-
/// Represents credentials
9+
/// Gets the name of the user.
510
/// </summary>
6-
public interface ICredentials
7-
{
8-
/// <summary>
9-
/// Gets the name of the user.
10-
/// </summary>
11-
/// <value>
12-
/// The name of the user.
13-
/// </value>
14-
string UserName { get; }
11+
/// <value>
12+
/// The name of the user.
13+
/// </value>
14+
string UserName { get; }
1515

16-
/// <summary>
17-
/// Gets the password.
18-
/// </summary>
19-
/// <value>
20-
/// The password.
21-
/// </value>
22-
string Password { get; }
23-
}
16+
/// <summary>
17+
/// Gets the password.
18+
/// </summary>
19+
/// <value>
20+
/// The password.
21+
/// </value>
22+
string Password { get; }
2423
}

src/Etcd.Microsoft.Extensions.Configuration/Client/EtcdClientFactory.cs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,45 @@
33
using dotnet_etcd.interfaces;
44
using Etcd.Microsoft.Extensions.Configuration.Settings;
55

6-
namespace Etcd.Microsoft.Extensions.Configuration.Client
6+
namespace Etcd.Microsoft.Extensions.Configuration.Client;
7+
8+
/// <summary>
9+
/// Provides etcd client factory
10+
/// </summary>
11+
public class EtcdClientFactory : IEtcdClientFactory
712
{
813
/// <summary>
9-
/// Provides etcd client factory
14+
/// Initializes a new instance of the <see cref="EtcdClientFactory" /> class.
1015
/// </summary>
11-
public class EtcdClientFactory : IEtcdClientFactory
16+
/// <param name="settings">The settings.</param>
17+
/// <exception cref="ArgumentNullException">settings</exception>
18+
public EtcdClientFactory(IEtcdSettings? settings = null)
1219
{
13-
/// <summary>
14-
/// Initializes a new instance of the <see cref="EtcdClientFactory" /> class.
15-
/// </summary>
16-
/// <param name="settings">The settings.</param>
17-
/// <exception cref="ArgumentNullException">settings</exception>
18-
public EtcdClientFactory(IEtcdSettings? settings = null)
19-
{
20-
var environmentSetting = EnvironmentSettingsFactory.Create();
20+
var environmentSetting = EnvironmentSettingsFactory.Create();
2121

22-
Settings = new EtcdSettings(settings?.ConnectionString ?? environmentSetting.ConnectionString,
23-
settings?.CertificateData ?? environmentSetting.CertificateData);
24-
}
22+
Settings = new EtcdSettings(settings?.ConnectionString ?? environmentSetting.ConnectionString,
23+
settings?.CertificateData ?? environmentSetting.CertificateData);
24+
}
2525

26-
/// <summary>
27-
/// Gets the settings.
28-
/// </summary>
29-
/// <value>
30-
/// The settings.
31-
/// </value>
32-
public IEtcdSettings Settings { get; }
26+
/// <summary>
27+
/// Gets the settings.
28+
/// </summary>
29+
/// <value>
30+
/// The settings.
31+
/// </value>
32+
public IEtcdSettings Settings { get; }
3333

34-
/// <summary>
35-
/// Creates the etcd client instance.
36-
/// </summary>
37-
/// <returns></returns>
38-
public IEtcdClient Create()
39-
{
40-
if (string.IsNullOrEmpty(Settings.ConnectionString))
41-
throw new EtcdConfigurationException("Connection string is missing, should be passed in AddEtcd parameters or set in environment variables.");
34+
/// <summary>
35+
/// Creates the etcd client instance.
36+
/// </summary>
37+
/// <returns></returns>
38+
public IEtcdClient Create()
39+
{
40+
if (string.IsNullOrEmpty(Settings.ConnectionString))
41+
throw new EtcdConfigurationException("Connection string is missing, should be passed in AddEtcd parameters or set in environment variables.");
4242

43-
return Settings.ConnectionString!.StartsWith("https")
44-
? new EtcdClient(Settings.ConnectionString, caCert: Settings.CertificateData ?? throw new EtcdConfigurationException("Certificate data is missing, should be passed in AddEtcd parameters or set in environment variables."))
45-
: new EtcdClient(Settings.ConnectionString);
46-
}
43+
return Settings.ConnectionString!.StartsWith("https")
44+
? new EtcdClient(Settings.ConnectionString, caCert: Settings.CertificateData ?? throw new EtcdConfigurationException("Certificate data is missing, should be passed in AddEtcd parameters or set in environment variables."))
45+
: new EtcdClient(Settings.ConnectionString);
4746
}
4847
}

0 commit comments

Comments
 (0)