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