| | 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 GenericResourceAutoGenerated : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (ManagedBy != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("managedBy"); |
| 0 | 22 | | writer.WriteStringValue(ManagedBy); |
| | 23 | | } |
| 0 | 24 | | if (Sku != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("sku"); |
| 0 | 27 | | writer.WriteObjectValue(Sku); |
| | 28 | | } |
| 0 | 29 | | if (Identity != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("identity"); |
| 0 | 32 | | writer.WriteObjectValue(Identity); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | if (Name != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("name"); |
| 0 | 42 | | writer.WriteStringValue(Name); |
| | 43 | | } |
| 0 | 44 | | if (Type != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("type"); |
| 0 | 47 | | writer.WriteStringValue(Type); |
| | 48 | | } |
| 0 | 49 | | if (Location != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("location"); |
| 0 | 52 | | writer.WriteStringValue(Location); |
| | 53 | | } |
| 0 | 54 | | if (Tags != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("tags"); |
| 0 | 57 | | writer.WriteStartObject(); |
| 0 | 58 | | foreach (var item in Tags) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName(item.Key); |
| 0 | 61 | | writer.WriteStringValue(item.Value); |
| | 62 | | } |
| 0 | 63 | | writer.WriteEndObject(); |
| | 64 | | } |
| 0 | 65 | | writer.WriteEndObject(); |
| 0 | 66 | | } |
| | 67 | |
|
| | 68 | | internal static GenericResourceAutoGenerated DeserializeGenericResourceAutoGenerated(JsonElement element) |
| | 69 | | { |
| 0 | 70 | | string managedBy = default; |
| 0 | 71 | | SkuAutoGenerated sku = default; |
| 0 | 72 | | IdentityAutoGenerated2 identity = default; |
| 0 | 73 | | string id = default; |
| 0 | 74 | | string name = default; |
| 0 | 75 | | string type = default; |
| 0 | 76 | | string location = default; |
| 0 | 77 | | IDictionary<string, string> tags = default; |
| 0 | 78 | | foreach (var property in element.EnumerateObject()) |
| | 79 | | { |
| 0 | 80 | | if (property.NameEquals("managedBy")) |
| | 81 | | { |
| 0 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | managedBy = property.Value.GetString(); |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("sku")) |
| | 90 | | { |
| 0 | 91 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); |
| 0 | 96 | | continue; |
| | 97 | | } |
| 0 | 98 | | if (property.NameEquals("identity")) |
| | 99 | | { |
| 0 | 100 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 101 | | { |
| | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); |
| 0 | 105 | | continue; |
| | 106 | | } |
| 0 | 107 | | if (property.NameEquals("id")) |
| | 108 | | { |
| 0 | 109 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | id = property.Value.GetString(); |
| 0 | 114 | | continue; |
| | 115 | | } |
| 0 | 116 | | if (property.NameEquals("name")) |
| | 117 | | { |
| 0 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | name = property.Value.GetString(); |
| 0 | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | if (property.NameEquals("type")) |
| | 126 | | { |
| 0 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | type = property.Value.GetString(); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property.NameEquals("location")) |
| | 135 | | { |
| 0 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | location = property.Value.GetString(); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("tags")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 150 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 151 | | { |
| 0 | 152 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| 0 | 154 | | dictionary.Add(property0.Name, null); |
| | 155 | | } |
| | 156 | | else |
| | 157 | | { |
| 0 | 158 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 159 | | } |
| | 160 | | } |
| 0 | 161 | | tags = dictionary; |
| | 162 | | continue; |
| | 163 | | } |
| | 164 | | } |
| 0 | 165 | | return new GenericResourceAutoGenerated(id, name, type, location, tags, managedBy, sku, identity); |
| | 166 | | } |
| | 167 | | } |
| | 168 | | } |