Example #1
0
 internal StorageServiceProperties(LoggingSettings logging, RequestMetrics hourMetrics, RequestMetrics minuteMetrics, IList <CorsRule> cors)
 {
     Logging       = logging;
     HourMetrics   = hourMetrics;
     MinuteMetrics = minuteMetrics;
     Cors          = cors;
 }
Example #2
0
        internal static StorageServiceProperties DeserializeStorageServiceProperties(XElement element)
        {
            LoggingSettings  logging       = default;
            RequestMetrics   hourMetrics   = default;
            RequestMetrics   minuteMetrics = default;
            IList <CorsRule> cors          = default;

            if (element.Element("Logging") is XElement loggingElement)
            {
                logging = LoggingSettings.DeserializeLoggingSettings(loggingElement);
            }
            if (element.Element("HourMetrics") is XElement hourMetricsElement)
            {
                hourMetrics = RequestMetrics.DeserializeRequestMetrics(hourMetricsElement);
            }
            if (element.Element("MinuteMetrics") is XElement minuteMetricsElement)
            {
                minuteMetrics = RequestMetrics.DeserializeRequestMetrics(minuteMetricsElement);
            }
            if (element.Element("Cors") is XElement corsElement)
            {
                var array = new List <CorsRule>();
                foreach (var e in corsElement.Elements("CorsRule"))
                {
                    array.Add(CorsRule.DeserializeCorsRule(e));
                }
                cors = array;
            }
            return(new StorageServiceProperties(logging, hourMetrics, minuteMetrics, cors));
        }