| | 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.Xml; |
| | 9 | | using System.Xml.Linq; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Data.Tables.Models |
| | 13 | | { |
| | 14 | | public partial class TableMetrics : IXmlSerializable |
| | 15 | | { |
| | 16 | | void IXmlSerializable.Write(XmlWriter writer, string nameHint) |
| | 17 | | { |
| 8 | 18 | | writer.WriteStartElement(nameHint ?? "Metrics"); |
| 8 | 19 | | if (Optional.IsDefined(Version)) |
| | 20 | | { |
| 8 | 21 | | writer.WriteStartElement("Version"); |
| 8 | 22 | | writer.WriteValue(Version); |
| 8 | 23 | | writer.WriteEndElement(); |
| | 24 | | } |
| 8 | 25 | | writer.WriteStartElement("Enabled"); |
| 8 | 26 | | writer.WriteValue(Enabled); |
| 8 | 27 | | writer.WriteEndElement(); |
| 8 | 28 | | if (Optional.IsDefined(IncludeApis)) |
| | 29 | | { |
| 4 | 30 | | writer.WriteStartElement("IncludeAPIs"); |
| 4 | 31 | | writer.WriteValue(IncludeApis.Value); |
| 4 | 32 | | writer.WriteEndElement(); |
| | 33 | | } |
| 8 | 34 | | if (Optional.IsDefined(RetentionPolicy)) |
| | 35 | | { |
| 8 | 36 | | writer.WriteObjectValue(RetentionPolicy, "RetentionPolicy"); |
| | 37 | | } |
| 8 | 38 | | writer.WriteEndElement(); |
| 8 | 39 | | } |
| | 40 | |
|
| | 41 | | internal static TableMetrics DeserializeTableMetrics(XElement element) |
| | 42 | | { |
| 48 | 43 | | string version = default; |
| 48 | 44 | | bool enabled = default; |
| 48 | 45 | | bool? includeApis = default; |
| 48 | 46 | | RetentionPolicy retentionPolicy = default; |
| 48 | 47 | | if (element.Element("Version") is XElement versionElement) |
| | 48 | | { |
| 48 | 49 | | version = (string)versionElement; |
| | 50 | | } |
| 48 | 51 | | if (element.Element("Enabled") is XElement enabledElement) |
| | 52 | | { |
| 48 | 53 | | enabled = (bool)enabledElement; |
| | 54 | | } |
| 48 | 55 | | if (element.Element("IncludeAPIs") is XElement includeAPIsElement) |
| | 56 | | { |
| 24 | 57 | | includeApis = (bool?)includeAPIsElement; |
| | 58 | | } |
| 48 | 59 | | if (element.Element("RetentionPolicy") is XElement retentionPolicyElement) |
| | 60 | | { |
| 48 | 61 | | retentionPolicy = RetentionPolicy.DeserializeRetentionPolicy(retentionPolicyElement); |
| | 62 | | } |
| 48 | 63 | | return new TableMetrics(version, enabled, includeApis, retentionPolicy); |
| | 64 | | } |
| | 65 | | } |
| | 66 | | } |