| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Storage.Models |
| | 12 | | { |
| | 13 | | public partial class Identity : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (PrincipalId != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("principalId"); |
| 0 | 21 | | writer.WriteStringValue(PrincipalId); |
| | 22 | | } |
| 0 | 23 | | if (TenantId != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("tenantId"); |
| 0 | 26 | | writer.WriteStringValue(TenantId); |
| | 27 | | } |
| 0 | 28 | | writer.WritePropertyName("type"); |
| 0 | 29 | | writer.WriteStringValue(Type); |
| 0 | 30 | | writer.WriteEndObject(); |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | internal static Identity DeserializeIdentity(JsonElement element) |
| | 34 | | { |
| 24 | 35 | | string principalId = default; |
| 24 | 36 | | string tenantId = default; |
| 24 | 37 | | string type = default; |
| 192 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 72 | 40 | | if (property.NameEquals("principalId")) |
| | 41 | | { |
| 24 | 42 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 43 | | { |
| | 44 | | continue; |
| | 45 | | } |
| 24 | 46 | | principalId = property.Value.GetString(); |
| 24 | 47 | | continue; |
| | 48 | | } |
| 48 | 49 | | if (property.NameEquals("tenantId")) |
| | 50 | | { |
| 24 | 51 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 52 | | { |
| | 53 | | continue; |
| | 54 | | } |
| 24 | 55 | | tenantId = property.Value.GetString(); |
| 24 | 56 | | continue; |
| | 57 | | } |
| 24 | 58 | | if (property.NameEquals("type")) |
| | 59 | | { |
| 24 | 60 | | type = property.Value.GetString(); |
| | 61 | | continue; |
| | 62 | | } |
| | 63 | | } |
| 24 | 64 | | return new Identity(principalId, tenantId, type); |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |