| | 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 UserAssignedIdentity : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 24 | 17 | | writer.WriteStartObject(); |
| 24 | 18 | | if (PrincipalId != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("principalId"); |
| 0 | 21 | | writer.WriteStringValue(PrincipalId); |
| | 22 | | } |
| 24 | 23 | | if (ClientId != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("clientId"); |
| 0 | 26 | | writer.WriteStringValue(ClientId); |
| | 27 | | } |
| 24 | 28 | | writer.WriteEndObject(); |
| 24 | 29 | | } |
| | 30 | |
|
| | 31 | | internal static UserAssignedIdentity DeserializeUserAssignedIdentity(JsonElement element) |
| | 32 | | { |
| 74 | 33 | | string principalId = default; |
| 74 | 34 | | string clientId = default; |
| 444 | 35 | | foreach (var property in element.EnumerateObject()) |
| | 36 | | { |
| 148 | 37 | | if (property.NameEquals("principalId")) |
| | 38 | | { |
| 74 | 39 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 40 | | { |
| | 41 | | continue; |
| | 42 | | } |
| 74 | 43 | | principalId = property.Value.GetString(); |
| 74 | 44 | | continue; |
| | 45 | | } |
| 74 | 46 | | if (property.NameEquals("clientId")) |
| | 47 | | { |
| 74 | 48 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 49 | | { |
| | 50 | | continue; |
| | 51 | | } |
| 74 | 52 | | clientId = property.Value.GetString(); |
| | 53 | | continue; |
| | 54 | | } |
| | 55 | | } |
| 74 | 56 | | return new UserAssignedIdentity(principalId, clientId); |
| | 57 | | } |
| | 58 | | } |
| | 59 | | } |