| | 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.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class ObjectReplicationPolicyFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 8 | 18 | | writer.WriteStartObject(); |
| 8 | 19 | | if (PrefixMatch != null) |
| | 20 | | { |
| 8 | 21 | | writer.WritePropertyName("prefixMatch"); |
| 8 | 22 | | writer.WriteStartArray(); |
| 64 | 23 | | foreach (var item in PrefixMatch) |
| | 24 | | { |
| 24 | 25 | | writer.WriteStringValue(item); |
| | 26 | | } |
| 8 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 8 | 29 | | if (MinCreationTime != null) |
| | 30 | | { |
| 8 | 31 | | writer.WritePropertyName("minCreationTime"); |
| 8 | 32 | | writer.WriteStringValue(MinCreationTime); |
| | 33 | | } |
| 8 | 34 | | writer.WriteEndObject(); |
| 8 | 35 | | } |
| | 36 | |
|
| | 37 | | internal static ObjectReplicationPolicyFilter DeserializeObjectReplicationPolicyFilter(JsonElement element) |
| | 38 | | { |
| 24 | 39 | | IList<string> prefixMatch = default; |
| 24 | 40 | | string minCreationTime = default; |
| 144 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 48 | 43 | | if (property.NameEquals("prefixMatch")) |
| | 44 | | { |
| 24 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 24 | 49 | | List<string> array = new List<string>(); |
| 192 | 50 | | foreach (var item in property.Value.EnumerateArray()) |
| | 51 | | { |
| 72 | 52 | | if (item.ValueKind == JsonValueKind.Null) |
| | 53 | | { |
| 0 | 54 | | array.Add(null); |
| | 55 | | } |
| | 56 | | else |
| | 57 | | { |
| 72 | 58 | | array.Add(item.GetString()); |
| | 59 | | } |
| | 60 | | } |
| 24 | 61 | | prefixMatch = array; |
| 24 | 62 | | continue; |
| | 63 | | } |
| 24 | 64 | | if (property.NameEquals("minCreationTime")) |
| | 65 | | { |
| 24 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 24 | 70 | | minCreationTime = property.Value.GetString(); |
| | 71 | | continue; |
| | 72 | | } |
| | 73 | | } |
| 24 | 74 | | return new ObjectReplicationPolicyFilter(prefixMatch, minCreationTime); |
| | 75 | | } |
| | 76 | | } |
| | 77 | | } |