part #2
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace StellaOps.Cryptography.Kms;
|
||||
|
||||
/// <summary>
|
||||
@@ -7,8 +5,8 @@ namespace StellaOps.Cryptography.Kms;
|
||||
/// </summary>
|
||||
public sealed class AwsKmsOptions
|
||||
{
|
||||
private TimeSpan metadataCacheDuration = TimeSpan.FromMinutes(5);
|
||||
private TimeSpan publicKeyCacheDuration = TimeSpan.FromMinutes(10);
|
||||
private TimeSpan _metadataCacheDuration = TimeSpan.FromMinutes(5);
|
||||
private TimeSpan _publicKeyCacheDuration = TimeSpan.FromMinutes(10);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the AWS region identifier (e.g. <c>us-east-1</c>).
|
||||
@@ -30,8 +28,8 @@ public sealed class AwsKmsOptions
|
||||
/// </summary>
|
||||
public TimeSpan MetadataCacheDuration
|
||||
{
|
||||
get => metadataCacheDuration;
|
||||
set => metadataCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(5));
|
||||
get => _metadataCacheDuration;
|
||||
set => _metadataCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,16 +37,10 @@ public sealed class AwsKmsOptions
|
||||
/// </summary>
|
||||
public TimeSpan PublicKeyCacheDuration
|
||||
{
|
||||
get => publicKeyCacheDuration;
|
||||
set => publicKeyCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(10));
|
||||
get => _publicKeyCacheDuration;
|
||||
set => _publicKeyCacheDuration = EnsurePositive(value, TimeSpan.FromMinutes(10));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional factory that can provide a custom AWS facade. Primarily used for testing.
|
||||
/// </summary>
|
||||
public Func<IServiceProvider, IAwsKmsFacade>? FacadeFactory { get; set; }
|
||||
|
||||
private static TimeSpan EnsurePositive(TimeSpan value, TimeSpan @default)
|
||||
=> value <= TimeSpan.Zero ? @default : value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user