internal BlobServiceProperties(BlobAnalyticsLogging logging, BlobMetrics hourMetrics, BlobMetrics minuteMetrics, IList <BlobCorsRule> cors, string defaultServiceVersion, BlobRetentionPolicy deleteRetentionPolicy, BlobStaticWebsite staticWebsite)
 {
     Logging               = logging;
     HourMetrics           = hourMetrics;
     MinuteMetrics         = minuteMetrics;
     Cors                  = cors;
     DefaultServiceVersion = defaultServiceVersion;
     DeleteRetentionPolicy = deleteRetentionPolicy;
     StaticWebsite         = staticWebsite;
 }
Example #2
0
        internal static BlobServiceProperties DeserializeBlobServiceProperties(XElement element)
        {
            BlobAnalyticsLogging logging               = default;
            BlobMetrics          hourMetrics           = default;
            BlobMetrics          minuteMetrics         = default;
            string defaultServiceVersion               = default;
            BlobRetentionPolicy  deleteRetentionPolicy = default;
            BlobStaticWebsite    staticWebsite         = default;
            IList <BlobCorsRule> cors = default;

            if (element.Element("Logging") is XElement loggingElement)
            {
                logging = BlobAnalyticsLogging.DeserializeBlobAnalyticsLogging(loggingElement);
            }
            if (element.Element("HourMetrics") is XElement hourMetricsElement)
            {
                hourMetrics = BlobMetrics.DeserializeBlobMetrics(hourMetricsElement);
            }
            if (element.Element("MinuteMetrics") is XElement minuteMetricsElement)
            {
                minuteMetrics = BlobMetrics.DeserializeBlobMetrics(minuteMetricsElement);
            }
            if (element.Element("DefaultServiceVersion") is XElement defaultServiceVersionElement)
            {
                defaultServiceVersion = (string)defaultServiceVersionElement;
            }
            if (element.Element("DeleteRetentionPolicy") is XElement deleteRetentionPolicyElement)
            {
                deleteRetentionPolicy = BlobRetentionPolicy.DeserializeBlobRetentionPolicy(deleteRetentionPolicyElement);
            }
            if (element.Element("StaticWebsite") is XElement staticWebsiteElement)
            {
                staticWebsite = BlobStaticWebsite.DeserializeBlobStaticWebsite(staticWebsiteElement);
            }
            if (element.Element("Cors") is XElement corsElement)
            {
                var array = new List <BlobCorsRule>();
                foreach (var e in corsElement.Elements("CorsRule"))
                {
                    array.Add(BlobCorsRule.DeserializeBlobCorsRule(e));
                }
                cors = array;
            }
            return(new BlobServiceProperties(logging, hourMetrics, minuteMetrics, cors, defaultServiceVersion, deleteRetentionPolicy, staticWebsite));
        }