/// <summary> /// Initializes a new instance of the <see cref="SecretsManagerCache"/> class. /// </summary> public SecretsManagerCache(IAmazonSecretsManager secretsManager, SecretCacheConfiguration config) { this.config = config; this.secretsManager = secretsManager; cacheItemPolicy = new MemoryCacheEntryOptions() { SlidingExpiration = TimeSpan.FromMilliseconds(this.config.CacheItemTTL) }; if (this.secretsManager is AmazonSecretsManagerClient sm) { sm.BeforeRequestEvent += this.ServiceClientBeforeRequestEvent; } }
/// <summary> /// Construct a new cached item for the secret. /// </summary> /// <param name="secretId"> The secret identifier. This identifier could be the full ARN or the friendly name for the secret. </param> /// <param name="client"> The AWS Secrets Manager client to use for requesting the secret. </param> /// <param name="config"> The secret cache configuration. </param> public SecretCacheObject(String secretId, IAmazonSecretsManager client, SecretCacheConfiguration config) { this.secretId = secretId; this.client = client; this.config = config; }
/// <summary> /// Initializes a new instance of the <see cref="SecretsManagerCache"/> class. /// </summary> public SecretsManagerCache(SecretCacheConfiguration config) : this(new AmazonSecretsManagerClient(), config) { }
public SecretCacheItem(String secretId, IAmazonSecretsManager client, SecretCacheConfiguration config) : base(secretId, client, config) { }
public SecretCacheVersion(String secretId, String versionId, IAmazonSecretsManager client, SecretCacheConfiguration config) : base(secretId, client, config) { this.versionId = versionId; this.hash = String.Format("%s %s", secretId, versionId).GetHashCode(); }
public SecretCacheVersion(String secretId, String versionId, IAmazonSecretsManager client, SecretCacheConfiguration config) : base(secretId, client, config) { this.versionId = versionId; this.hash = $"{secretId} {versionId}".GetHashCode(); }