internal ManagedServiceIdentity(Guid?principalId, Guid?tenantId, ManagedServiceIdentityType type, IDictionary <string, UserAssignedIdentity> userAssignedIdentities) { PrincipalId = principalId; TenantId = tenantId; Type = type; UserAssignedIdentities = userAssignedIdentities; }
internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element) { Optional <Guid> principalId = default; Optional <Guid> tenantId = default; ManagedServiceIdentityType type = default; Optional <IDictionary <string, UserAssignedIdentity> > userAssignedIdentities = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("principalId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } principalId = property.Value.GetGuid(); continue; } if (property.NameEquals("tenantId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } tenantId = property.Value.GetGuid(); continue; } if (property.NameEquals("type")) { type = new ManagedServiceIdentityType(property.Value.GetString()); continue; } if (property.NameEquals("userAssignedIdentities")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, UserAssignedIdentity> dictionary = new Dictionary <string, UserAssignedIdentity>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, JsonSerializer.Deserialize <UserAssignedIdentity>(property0.Value.ToString())); } userAssignedIdentities = dictionary; continue; } } return(new ManagedServiceIdentity(Optional.ToNullable(principalId), Optional.ToNullable(tenantId), type, Optional.ToDictionary(userAssignedIdentities))); }
public ManagedServiceIdentity(ManagedServiceIdentityType type) { Type = type; UserAssignedIdentities = new ChangeTrackingDictionary <string, UserAssignedIdentity>(); }