Example #1
0
        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);
        }
Example #2
0
        public async Task <string> GetSecretValue(SecretReference reference)
        {
            SecretValue value = await GetSecret(reference);

            return(value?.Value);
        }