public override bool TryCreate(
            string providerName,
            IConfigurationSection providerSection,
            Dictionary <string, string> egressProperties,
            out ConfiguredEgressProvider provider)
        {
            var options = providerSection.Get <FileSystemEgressProviderOptions>();

            if (!TryValidateOptions(options, providerName))
            {
                provider = null;
                return(false);
            }

            provider = new Provider(options, _loggerFactory);
            return(true);
        }
Exemplo n.º 2
0
        public override bool TryCreate(
            string providerName,
            IConfigurationSection providerSection,
            Dictionary <string, string> egressProperties,
            out ConfiguredEgressProvider provider)
        {
            var options = providerSection.Get <ConfigurationOptions>();

            // If account key was not provided but the name was provided,
            // lookup the account key property value from EgressOptions.Properties
            if (string.IsNullOrEmpty(options.AccountKey) &&
                !string.IsNullOrEmpty(options.AccountKeyName))
            {
                if (TryGetPropertyValue(providerName, egressProperties, options.AccountKeyName, out string key))
                {
                    options.AccountKey = key;
                }
            }

            // If shared access signature (SAS) was not provided but the name was provided,
            // lookup the SAS property value from EgressOptions.Properties
            if (string.IsNullOrEmpty(options.SharedAccessSignature) &&
                !string.IsNullOrEmpty(options.SharedAccessSignatureName))
            {
                if (TryGetPropertyValue(providerName, egressProperties, options.SharedAccessSignatureName, out string signature))
                {
                    options.SharedAccessSignature = signature;
                }
            }

            if (!TryValidateOptions(options, providerName))
            {
                provider = null;
                return(false);
            }

            provider = new Provider(options, _loggerFactory);
            return(true);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Attempts to create a <see cref="ConfiguredEgressProvider"/> from the provided <paramref name="providerSection"/>
 /// and <paramref name="egressProperties"/>.
 /// </summary>
 /// <param name="providerName">The name of the egress provider.</param>
 /// <param name="providerSection">The configuration section containing the provider options.</param>
 /// <param name="egressProperties">The mapping of egress properties.</param>
 /// <param name="provider">The created <see cref="ConfiguredEgressProvider"/>.</param>
 /// <returns>True if the provider was created; otherwise, false.</returns>
 public abstract bool TryCreate(
     string providerName,
     IConfigurationSection providerSection,
     Dictionary <string, string> egressProperties,
     out ConfiguredEgressProvider provider);