public RotationContext(string name, IReadOnlyDictionary <string, string> values, StorageLocationType.Bound storage, IReadOnlyDictionary <string, StorageLocationType.Bound> references) { _storage = storage; _references = references; SecretName = name; _values = values.ToDictionary(p => p.Key, p => p.Value); }
public async Task <SecretValue> GetSecret(SecretReference reference) { SecretValue value; if (string.IsNullOrEmpty(reference.Location)) { value = await _storage.GetSecretValueAsync(reference.Name); } else { StorageLocationType.Bound storage = _references.GetValueOrDefault(reference.Location); if (storage == null) { throw new InvalidOperationException($"The storage reference {reference.Location} could not be found."); } value = await storage.GetSecretValueAsync(reference.Name); } return(value); }