| | 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; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class TagProperty : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Tag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("tag"); |
| 0 | 22 | | writer.WriteStringValue(Tag); |
| | 23 | | } |
| 0 | 24 | | if (Timestamp != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("timestamp"); |
| 0 | 27 | | writer.WriteStringValue(Timestamp.Value, "O"); |
| | 28 | | } |
| 0 | 29 | | if (ObjectIdentifier != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("objectIdentifier"); |
| 0 | 32 | | writer.WriteStringValue(ObjectIdentifier); |
| | 33 | | } |
| 0 | 34 | | if (TenantId != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("tenantId"); |
| 0 | 37 | | writer.WriteStringValue(TenantId); |
| | 38 | | } |
| 0 | 39 | | if (Upn != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("upn"); |
| 0 | 42 | | writer.WriteStringValue(Upn); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndObject(); |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static TagProperty DeserializeTagProperty(JsonElement element) |
| | 48 | | { |
| 12 | 49 | | string tag = default; |
| 12 | 50 | | DateTimeOffset? timestamp = default; |
| 12 | 51 | | string objectIdentifier = default; |
| 12 | 52 | | string tenantId = default; |
| 12 | 53 | | string upn = default; |
| 120 | 54 | | foreach (var property in element.EnumerateObject()) |
| | 55 | | { |
| 48 | 56 | | if (property.NameEquals("tag")) |
| | 57 | | { |
| 12 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 12 | 62 | | tag = property.Value.GetString(); |
| 12 | 63 | | continue; |
| | 64 | | } |
| 36 | 65 | | if (property.NameEquals("timestamp")) |
| | 66 | | { |
| 12 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 12 | 71 | | timestamp = property.Value.GetDateTimeOffset("O"); |
| 12 | 72 | | continue; |
| | 73 | | } |
| 24 | 74 | | if (property.NameEquals("objectIdentifier")) |
| | 75 | | { |
| 12 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 12 | 80 | | objectIdentifier = property.Value.GetString(); |
| 12 | 81 | | continue; |
| | 82 | | } |
| 12 | 83 | | if (property.NameEquals("tenantId")) |
| | 84 | | { |
| 12 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 12 | 89 | | tenantId = property.Value.GetString(); |
| 12 | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | if (property.NameEquals("upn")) |
| | 93 | | { |
| 0 | 94 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 95 | | { |
| | 96 | | continue; |
| | 97 | | } |
| 0 | 98 | | upn = property.Value.GetString(); |
| | 99 | | continue; |
| | 100 | | } |
| | 101 | | } |
| 12 | 102 | | return new TagProperty(tag, timestamp, objectIdentifier, tenantId, upn); |
| | 103 | | } |
| | 104 | | } |
| | 105 | | } |