| | 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; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Compute.Models |
| | 14 | | { |
| | 15 | | public partial class GalleryApplication : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 16 | 19 | | writer.WriteStartObject(); |
| 16 | 20 | | if (Id != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("id"); |
| 0 | 23 | | writer.WriteStringValue(Id); |
| | 24 | | } |
| 16 | 25 | | if (Name != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("name"); |
| 0 | 28 | | writer.WriteStringValue(Name); |
| | 29 | | } |
| 16 | 30 | | if (Type != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("type"); |
| 0 | 33 | | writer.WriteStringValue(Type); |
| | 34 | | } |
| 16 | 35 | | writer.WritePropertyName("location"); |
| 16 | 36 | | writer.WriteStringValue(Location); |
| 16 | 37 | | if (Tags != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("tags"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | foreach (var item in Tags) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName(item.Key); |
| 0 | 44 | | writer.WriteStringValue(item.Value); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndObject(); |
| | 47 | | } |
| 16 | 48 | | writer.WritePropertyName("properties"); |
| 16 | 49 | | writer.WriteStartObject(); |
| 16 | 50 | | if (Description != null) |
| | 51 | | { |
| 16 | 52 | | writer.WritePropertyName("description"); |
| 16 | 53 | | writer.WriteStringValue(Description); |
| | 54 | | } |
| 16 | 55 | | if (Eula != null) |
| | 56 | | { |
| 16 | 57 | | writer.WritePropertyName("eula"); |
| 16 | 58 | | writer.WriteStringValue(Eula); |
| | 59 | | } |
| 16 | 60 | | if (PrivacyStatementUri != null) |
| | 61 | | { |
| 16 | 62 | | writer.WritePropertyName("privacyStatementUri"); |
| 16 | 63 | | writer.WriteStringValue(PrivacyStatementUri); |
| | 64 | | } |
| 16 | 65 | | if (ReleaseNoteUri != null) |
| | 66 | | { |
| 16 | 67 | | writer.WritePropertyName("releaseNoteUri"); |
| 16 | 68 | | writer.WriteStringValue(ReleaseNoteUri); |
| | 69 | | } |
| 16 | 70 | | if (EndOfLifeDate != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("endOfLifeDate"); |
| 0 | 73 | | writer.WriteStringValue(EndOfLifeDate.Value, "O"); |
| | 74 | | } |
| 16 | 75 | | if (SupportedOSType != null) |
| | 76 | | { |
| 16 | 77 | | writer.WritePropertyName("supportedOSType"); |
| 16 | 78 | | writer.WriteStringValue(SupportedOSType.Value.ToSerialString()); |
| | 79 | | } |
| 16 | 80 | | writer.WriteEndObject(); |
| 16 | 81 | | writer.WriteEndObject(); |
| 16 | 82 | | } |
| | 83 | |
|
| | 84 | | internal static GalleryApplication DeserializeGalleryApplication(JsonElement element) |
| | 85 | | { |
| 16 | 86 | | string id = default; |
| 16 | 87 | | string name = default; |
| 16 | 88 | | string type = default; |
| 16 | 89 | | string location = default; |
| 16 | 90 | | IDictionary<string, string> tags = default; |
| 16 | 91 | | string description = default; |
| 16 | 92 | | string eula = default; |
| 16 | 93 | | string privacyStatementUri = default; |
| 16 | 94 | | string releaseNoteUri = default; |
| 16 | 95 | | DateTimeOffset? endOfLifeDate = default; |
| 16 | 96 | | OperatingSystemTypes? supportedOSType = default; |
| 192 | 97 | | foreach (var property in element.EnumerateObject()) |
| | 98 | | { |
| 80 | 99 | | if (property.NameEquals("id")) |
| | 100 | | { |
| 16 | 101 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 102 | | { |
| | 103 | | continue; |
| | 104 | | } |
| 16 | 105 | | id = property.Value.GetString(); |
| 16 | 106 | | continue; |
| | 107 | | } |
| 64 | 108 | | if (property.NameEquals("name")) |
| | 109 | | { |
| 16 | 110 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 111 | | { |
| | 112 | | continue; |
| | 113 | | } |
| 16 | 114 | | name = property.Value.GetString(); |
| 16 | 115 | | continue; |
| | 116 | | } |
| 48 | 117 | | if (property.NameEquals("type")) |
| | 118 | | { |
| 16 | 119 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 120 | | { |
| | 121 | | continue; |
| | 122 | | } |
| 16 | 123 | | type = property.Value.GetString(); |
| 16 | 124 | | continue; |
| | 125 | | } |
| 32 | 126 | | if (property.NameEquals("location")) |
| | 127 | | { |
| 16 | 128 | | location = property.Value.GetString(); |
| 16 | 129 | | continue; |
| | 130 | | } |
| 16 | 131 | | if (property.NameEquals("tags")) |
| | 132 | | { |
| 0 | 133 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 138 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 139 | | { |
| 0 | 140 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 141 | | { |
| 0 | 142 | | dictionary.Add(property0.Name, null); |
| | 143 | | } |
| | 144 | | else |
| | 145 | | { |
| 0 | 146 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 147 | | } |
| | 148 | | } |
| 0 | 149 | | tags = dictionary; |
| 0 | 150 | | continue; |
| | 151 | | } |
| 16 | 152 | | if (property.NameEquals("properties")) |
| | 153 | | { |
| 192 | 154 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 155 | | { |
| 80 | 156 | | if (property0.NameEquals("description")) |
| | 157 | | { |
| 16 | 158 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 16 | 162 | | description = property0.Value.GetString(); |
| 16 | 163 | | continue; |
| | 164 | | } |
| 64 | 165 | | if (property0.NameEquals("eula")) |
| | 166 | | { |
| 16 | 167 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 16 | 171 | | eula = property0.Value.GetString(); |
| 16 | 172 | | continue; |
| | 173 | | } |
| 48 | 174 | | if (property0.NameEquals("privacyStatementUri")) |
| | 175 | | { |
| 16 | 176 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 16 | 180 | | privacyStatementUri = property0.Value.GetString(); |
| 16 | 181 | | continue; |
| | 182 | | } |
| 32 | 183 | | if (property0.NameEquals("releaseNoteUri")) |
| | 184 | | { |
| 16 | 185 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 16 | 189 | | releaseNoteUri = property0.Value.GetString(); |
| 16 | 190 | | continue; |
| | 191 | | } |
| 16 | 192 | | if (property0.NameEquals("endOfLifeDate")) |
| | 193 | | { |
| 0 | 194 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | endOfLifeDate = property0.Value.GetDateTimeOffset("O"); |
| 0 | 199 | | continue; |
| | 200 | | } |
| 16 | 201 | | if (property0.NameEquals("supportedOSType")) |
| | 202 | | { |
| 16 | 203 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 16 | 207 | | supportedOSType = property0.Value.GetString().ToOperatingSystemTypes(); |
| | 208 | | continue; |
| | 209 | | } |
| | 210 | | } |
| | 211 | | continue; |
| | 212 | | } |
| | 213 | | } |
| 16 | 214 | | return new GalleryApplication(id, name, type, location, tags, description, eula, privacyStatementUri, releas |
| | 215 | | } |
| | 216 | | } |
| | 217 | | } |