| | 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.Network.Models |
| | 13 | | { |
| | 14 | | public partial class ManagedServiceIdentity : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (PrincipalId != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("principalId"); |
| 0 | 22 | | writer.WriteStringValue(PrincipalId); |
| | 23 | | } |
| 0 | 24 | | if (TenantId != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("tenantId"); |
| 0 | 27 | | writer.WriteStringValue(TenantId); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type.Value.ToSerialString()); |
| | 33 | | } |
| 0 | 34 | | if (UserAssignedIdentities != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("userAssignedIdentities"); |
| 0 | 37 | | writer.WriteStartObject(); |
| 0 | 38 | | foreach (var item in UserAssignedIdentities) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName(item.Key); |
| 0 | 41 | | writer.WriteObjectValue(item.Value); |
| | 42 | | } |
| 0 | 43 | | writer.WriteEndObject(); |
| | 44 | | } |
| 0 | 45 | | writer.WriteEndObject(); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) |
| | 49 | | { |
| 0 | 50 | | string principalId = default; |
| 0 | 51 | | string tenantId = default; |
| 0 | 52 | | ResourceIdentityType? type = default; |
| 0 | 53 | | IDictionary<string, Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditional |
| 0 | 54 | | foreach (var property in element.EnumerateObject()) |
| | 55 | | { |
| 0 | 56 | | if (property.NameEquals("principalId")) |
| | 57 | | { |
| 0 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | principalId = property.Value.GetString(); |
| 0 | 63 | | continue; |
| | 64 | | } |
| 0 | 65 | | if (property.NameEquals("tenantId")) |
| | 66 | | { |
| 0 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 0 | 71 | | tenantId = property.Value.GetString(); |
| 0 | 72 | | continue; |
| | 73 | | } |
| 0 | 74 | | if (property.NameEquals("type")) |
| | 75 | | { |
| 0 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 0 | 80 | | type = property.Value.GetString().ToResourceIdentityType(); |
| 0 | 81 | | continue; |
| | 82 | | } |
| 0 | 83 | | if (property.NameEquals("userAssignedIdentities")) |
| | 84 | | { |
| 0 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | Dictionary<string, Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdd |
| 0 | 90 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 91 | | { |
| 0 | 92 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 93 | | { |
| 0 | 94 | | dictionary.Add(property0.Name, null); |
| | 95 | | } |
| | 96 | | else |
| | 97 | | { |
| 0 | 98 | | dictionary.Add(property0.Name, Components1Jq1T4ISchemasManagedserviceidentityPropertiesUsera |
| | 99 | | } |
| | 100 | | } |
| 0 | 101 | | userAssignedIdentities = dictionary; |
| | 102 | | continue; |
| | 103 | | } |
| | 104 | | } |
| 0 | 105 | | return new ManagedServiceIdentity(principalId, tenantId, type, userAssignedIdentities); |
| | 106 | | } |
| | 107 | | } |
| | 108 | | } |