| | 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 RetentionPolicy : IXmlSerializable |
| | 15 | | { |
| | 16 | | void IXmlSerializable.Write(XmlWriter writer, string nameHint) |
| | 17 | | { |
| 12 | 18 | | writer.WriteStartElement(nameHint ?? "RetentionPolicy"); |
| 12 | 19 | | writer.WriteStartElement("Enabled"); |
| 12 | 20 | | writer.WriteValue(Enabled); |
| 12 | 21 | | writer.WriteEndElement(); |
| 12 | 22 | | if (Optional.IsDefined(Days)) |
| | 23 | | { |
| 4 | 24 | | writer.WriteStartElement("Days"); |
| 4 | 25 | | writer.WriteValue(Days.Value); |
| 4 | 26 | | writer.WriteEndElement(); |
| | 27 | | } |
| 12 | 28 | | writer.WriteEndElement(); |
| 12 | 29 | | } |
| | 30 | |
|
| | 31 | | internal static RetentionPolicy DeserializeRetentionPolicy(XElement element) |
| | 32 | | { |
| 72 | 33 | | bool enabled = default; |
| 72 | 34 | | int? days = default; |
| 72 | 35 | | if (element.Element("Enabled") is XElement enabledElement) |
| | 36 | | { |
| 72 | 37 | | enabled = (bool)enabledElement; |
| | 38 | | } |
| 72 | 39 | | if (element.Element("Days") is XElement daysElement) |
| | 40 | | { |
| 24 | 41 | | days = (int?)daysElement; |
| | 42 | | } |
| 72 | 43 | | return new RetentionPolicy(enabled, days); |
| | 44 | | } |
| | 45 | | } |
| | 46 | | } |