| | | 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.Resources.Models |
| | | 13 | | { |
| | | 14 | | public partial class ManagedServiceIdentity : IUtf8JsonSerializable |
| | | 15 | | { |
| | | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 17 | | { |
| | 24 | 18 | | writer.WriteStartObject(); |
| | 24 | 19 | | if (Type != null) |
| | | 20 | | { |
| | 24 | 21 | | writer.WritePropertyName("type"); |
| | 24 | 22 | | writer.WriteStringValue(Type); |
| | | 23 | | } |
| | 24 | 24 | | if (UserAssignedIdentities != null) |
| | | 25 | | { |
| | 24 | 26 | | writer.WritePropertyName("userAssignedIdentities"); |
| | 24 | 27 | | writer.WriteStartObject(); |
| | 96 | 28 | | foreach (var item in UserAssignedIdentities) |
| | | 29 | | { |
| | 24 | 30 | | writer.WritePropertyName(item.Key); |
| | 24 | 31 | | writer.WriteObjectValue(item.Value); |
| | | 32 | | } |
| | 24 | 33 | | writer.WriteEndObject(); |
| | | 34 | | } |
| | 24 | 35 | | writer.WriteEndObject(); |
| | 24 | 36 | | } |
| | | 37 | | |
| | | 38 | | internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) |
| | | 39 | | { |
| | 74 | 40 | | string type = default; |
| | 74 | 41 | | IDictionary<string, UserAssignedIdentity> userAssignedIdentities = default; |
| | 592 | 42 | | foreach (var property in element.EnumerateObject()) |
| | | 43 | | { |
| | 222 | 44 | | if (property.NameEquals("type")) |
| | | 45 | | { |
| | 74 | 46 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 47 | | { |
| | | 48 | | continue; |
| | | 49 | | } |
| | 74 | 50 | | type = property.Value.GetString(); |
| | 74 | 51 | | continue; |
| | | 52 | | } |
| | 148 | 53 | | if (property.NameEquals("userAssignedIdentities")) |
| | | 54 | | { |
| | 74 | 55 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 56 | | { |
| | | 57 | | continue; |
| | | 58 | | } |
| | 74 | 59 | | Dictionary<string, UserAssignedIdentity> dictionary = new Dictionary<string, UserAssignedIdentity>() |
| | 296 | 60 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 61 | | { |
| | 74 | 62 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 63 | | { |
| | 0 | 64 | | dictionary.Add(property0.Name, null); |
| | | 65 | | } |
| | | 66 | | else |
| | | 67 | | { |
| | 74 | 68 | | dictionary.Add(property0.Name, UserAssignedIdentity.DeserializeUserAssignedIdentity(property |
| | | 69 | | } |
| | | 70 | | } |
| | 74 | 71 | | userAssignedIdentities = dictionary; |
| | | 72 | | continue; |
| | | 73 | | } |
| | | 74 | | } |
| | 74 | 75 | | return new ManagedServiceIdentity(type, userAssignedIdentities); |
| | | 76 | | } |
| | | 77 | | } |
| | | 78 | | } |