| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Xml; |
| | 10 | | using System.Xml.Linq; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.Data.Tables.Models |
| | 14 | | { |
| | 15 | | public partial class TableServiceProperties : IXmlSerializable |
| | 16 | | { |
| | 17 | | void IXmlSerializable.Write(XmlWriter writer, string nameHint) |
| | 18 | | { |
| 4 | 19 | | writer.WriteStartElement(nameHint ?? "StorageServiceProperties"); |
| 4 | 20 | | if (Optional.IsDefined(Logging)) |
| | 21 | | { |
| 4 | 22 | | writer.WriteObjectValue(Logging, "Logging"); |
| | 23 | | } |
| 4 | 24 | | if (Optional.IsDefined(HourMetrics)) |
| | 25 | | { |
| 4 | 26 | | writer.WriteObjectValue(HourMetrics, "HourMetrics"); |
| | 27 | | } |
| 4 | 28 | | if (Optional.IsDefined(MinuteMetrics)) |
| | 29 | | { |
| 4 | 30 | | writer.WriteObjectValue(MinuteMetrics, "MinuteMetrics"); |
| | 31 | | } |
| 4 | 32 | | if (Optional.IsCollectionDefined(Cors)) |
| | 33 | | { |
| 4 | 34 | | writer.WriteStartElement("Cors"); |
| 0 | 35 | | foreach (var item in Cors) |
| | 36 | | { |
| 0 | 37 | | writer.WriteObjectValue(item, "CorsRule"); |
| | 38 | | } |
| 4 | 39 | | writer.WriteEndElement(); |
| | 40 | | } |
| 4 | 41 | | writer.WriteEndElement(); |
| 4 | 42 | | } |
| | 43 | |
|
| | 44 | | internal static TableServiceProperties DeserializeTableServiceProperties(XElement element) |
| | 45 | | { |
| 24 | 46 | | TableAnalyticsLoggingSettings logging = default; |
| 24 | 47 | | TableMetrics hourMetrics = default; |
| 24 | 48 | | TableMetrics minuteMetrics = default; |
| 24 | 49 | | IList<TableCorsRule> cors = default; |
| 24 | 50 | | if (element.Element("Logging") is XElement loggingElement) |
| | 51 | | { |
| 24 | 52 | | logging = TableAnalyticsLoggingSettings.DeserializeTableAnalyticsLoggingSettings(loggingElement); |
| | 53 | | } |
| 24 | 54 | | if (element.Element("HourMetrics") is XElement hourMetricsElement) |
| | 55 | | { |
| 24 | 56 | | hourMetrics = TableMetrics.DeserializeTableMetrics(hourMetricsElement); |
| | 57 | | } |
| 24 | 58 | | if (element.Element("MinuteMetrics") is XElement minuteMetricsElement) |
| | 59 | | { |
| 24 | 60 | | minuteMetrics = TableMetrics.DeserializeTableMetrics(minuteMetricsElement); |
| | 61 | | } |
| 24 | 62 | | if (element.Element("Cors") is XElement corsElement) |
| | 63 | | { |
| 24 | 64 | | var array = new List<TableCorsRule>(); |
| 0 | 65 | | foreach (var e in corsElement.Elements("CorsRule")) |
| | 66 | | { |
| 0 | 67 | | array.Add(TableCorsRule.DeserializeTableCorsRule(e)); |
| | 68 | | } |
| 24 | 69 | | cors = array; |
| | 70 | | } |
| 24 | 71 | | return new TableServiceProperties(logging, hourMetrics, minuteMetrics, cors); |
| | 72 | | } |
| | 73 | | } |
| | 74 | | } |