| | 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.KeyVault.Models |
| | 13 | | { |
| | 14 | | public partial class Resource : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WriteEndObject(); |
| 0 | 20 | | } |
| | 21 | |
|
| | 22 | | internal static Resource DeserializeResource(JsonElement element) |
| | 23 | | { |
| 0 | 24 | | Optional<string> id = default; |
| 0 | 25 | | Optional<string> name = default; |
| 0 | 26 | | Optional<string> type = default; |
| 0 | 27 | | Optional<string> location = default; |
| 0 | 28 | | Optional<IReadOnlyDictionary<string, string>> tags = default; |
| 0 | 29 | | foreach (var property in element.EnumerateObject()) |
| | 30 | | { |
| 0 | 31 | | if (property.NameEquals("id")) |
| | 32 | | { |
| 0 | 33 | | id = property.Value.GetString(); |
| 0 | 34 | | continue; |
| | 35 | | } |
| 0 | 36 | | if (property.NameEquals("name")) |
| | 37 | | { |
| 0 | 38 | | name = property.Value.GetString(); |
| 0 | 39 | | continue; |
| | 40 | | } |
| 0 | 41 | | if (property.NameEquals("type")) |
| | 42 | | { |
| 0 | 43 | | type = property.Value.GetString(); |
| 0 | 44 | | continue; |
| | 45 | | } |
| 0 | 46 | | if (property.NameEquals("location")) |
| | 47 | | { |
| 0 | 48 | | location = property.Value.GetString(); |
| 0 | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | if (property.NameEquals("tags")) |
| | 52 | | { |
| 0 | 53 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 54 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 55 | | { |
| 0 | 56 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 57 | | } |
| 0 | 58 | | tags = dictionary; |
| | 59 | | continue; |
| | 60 | | } |
| | 61 | | } |
| 0 | 62 | | return new Resource(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); |
| | 63 | | } |
| | 64 | | } |
| | 65 | | } |