internal static BlobMetrics DeserializeBlobMetrics(XElement element)
        {
            string version     = default;
            bool   enabled     = default;
            bool?  includeApis = default;
            BlobRetentionPolicy retentionPolicy = default;

            if (element.Element("Version") is XElement versionElement)
            {
                version = (string)versionElement;
            }
            if (element.Element("Enabled") is XElement enabledElement)
            {
                enabled = (bool)enabledElement;
            }
            if (element.Element("IncludeAPIs") is XElement includeAPIsElement)
            {
                includeApis = (bool?)includeAPIsElement;
            }
            if (element.Element("RetentionPolicy") is XElement retentionPolicyElement)
            {
                retentionPolicy = BlobRetentionPolicy.DeserializeBlobRetentionPolicy(retentionPolicyElement);
            }
            return(new BlobMetrics(version, enabled, includeApis, retentionPolicy));
        }
        internal static BlobAnalyticsLogging DeserializeBlobAnalyticsLogging(XElement element)
        {
            string version = default;
            bool   delete  = default;
            bool   read    = default;
            bool   write   = default;
            BlobRetentionPolicy retentionPolicy = default;

            if (element.Element("Version") is XElement versionElement)
            {
                version = (string)versionElement;
            }
            if (element.Element("Delete") is XElement deleteElement)
            {
                delete = (bool)deleteElement;
            }
            if (element.Element("Read") is XElement readElement)
            {
                read = (bool)readElement;
            }
            if (element.Element("Write") is XElement writeElement)
            {
                write = (bool)writeElement;
            }
            if (element.Element("RetentionPolicy") is XElement retentionPolicyElement)
            {
                retentionPolicy = BlobRetentionPolicy.DeserializeBlobRetentionPolicy(retentionPolicyElement);
            }
            return(new BlobAnalyticsLogging(version, delete, read, write, retentionPolicy));
        }
 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;
 }
예제 #4
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));
        }
예제 #5
0
        internal BlobAnalyticsLogging(
            string version,
            bool delete,
            bool read,
            bool write,
            BlobRetentionPolicy retentionPolicy)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            if (retentionPolicy == null)
            {
                throw new ArgumentNullException(nameof(retentionPolicy));
            }

            Version         = version;
            Delete          = delete;
            Read            = read;
            Write           = write;
            RetentionPolicy = retentionPolicy;
        }