| | 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 ApplicationDefinition : 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.WritePropertyName("properties"); |
| 0 | 66 | | writer.WriteStartObject(); |
| 0 | 67 | | writer.WritePropertyName("lockLevel"); |
| 0 | 68 | | writer.WriteStringValue(LockLevel.ToSerialString()); |
| 0 | 69 | | if (DisplayName != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("displayName"); |
| 0 | 72 | | writer.WriteStringValue(DisplayName); |
| | 73 | | } |
| 0 | 74 | | if (IsEnabled != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("isEnabled"); |
| 0 | 77 | | writer.WriteStringValue(IsEnabled); |
| | 78 | | } |
| 0 | 79 | | writer.WritePropertyName("authorizations"); |
| 0 | 80 | | writer.WriteStartArray(); |
| 0 | 81 | | foreach (var item in Authorizations) |
| | 82 | | { |
| 0 | 83 | | writer.WriteObjectValue(item); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndArray(); |
| 0 | 86 | | if (Artifacts != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("artifacts"); |
| 0 | 89 | | writer.WriteStartArray(); |
| 0 | 90 | | foreach (var item in Artifacts) |
| | 91 | | { |
| 0 | 92 | | writer.WriteObjectValue(item); |
| | 93 | | } |
| 0 | 94 | | writer.WriteEndArray(); |
| | 95 | | } |
| 0 | 96 | | if (Description != null) |
| | 97 | | { |
| 0 | 98 | | writer.WritePropertyName("description"); |
| 0 | 99 | | writer.WriteStringValue(Description); |
| | 100 | | } |
| 0 | 101 | | if (PackageFileUri != null) |
| | 102 | | { |
| 0 | 103 | | writer.WritePropertyName("packageFileUri"); |
| 0 | 104 | | writer.WriteStringValue(PackageFileUri); |
| | 105 | | } |
| 0 | 106 | | if (MainTemplate != null) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("mainTemplate"); |
| 0 | 109 | | writer.WriteObjectValue(MainTemplate); |
| | 110 | | } |
| 0 | 111 | | if (CreateUiDefinition != null) |
| | 112 | | { |
| 0 | 113 | | writer.WritePropertyName("createUiDefinition"); |
| 0 | 114 | | writer.WriteObjectValue(CreateUiDefinition); |
| | 115 | | } |
| 0 | 116 | | writer.WriteEndObject(); |
| 0 | 117 | | writer.WriteEndObject(); |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | internal static ApplicationDefinition DeserializeApplicationDefinition(JsonElement element) |
| | 121 | | { |
| 0 | 122 | | string managedBy = default; |
| 0 | 123 | | SkuAutoGenerated sku = default; |
| 0 | 124 | | IdentityAutoGenerated2 identity = default; |
| 0 | 125 | | string id = default; |
| 0 | 126 | | string name = default; |
| 0 | 127 | | string type = default; |
| 0 | 128 | | string location = default; |
| 0 | 129 | | IDictionary<string, string> tags = default; |
| 0 | 130 | | ApplicationLockLevel lockLevel = default; |
| 0 | 131 | | string displayName = default; |
| 0 | 132 | | string isEnabled = default; |
| 0 | 133 | | IList<ApplicationProviderAuthorization> authorizations = default; |
| 0 | 134 | | IList<ApplicationArtifact> artifacts = default; |
| 0 | 135 | | string description = default; |
| 0 | 136 | | string packageFileUri = default; |
| 0 | 137 | | object mainTemplate = default; |
| 0 | 138 | | object createUiDefinition = default; |
| 0 | 139 | | foreach (var property in element.EnumerateObject()) |
| | 140 | | { |
| 0 | 141 | | if (property.NameEquals("managedBy")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | managedBy = property.Value.GetString(); |
| 0 | 148 | | continue; |
| | 149 | | } |
| 0 | 150 | | if (property.NameEquals("sku")) |
| | 151 | | { |
| 0 | 152 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 153 | | { |
| | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | sku = SkuAutoGenerated.DeserializeSkuAutoGenerated(property.Value); |
| 0 | 157 | | continue; |
| | 158 | | } |
| 0 | 159 | | if (property.NameEquals("identity")) |
| | 160 | | { |
| 0 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | identity = IdentityAutoGenerated2.DeserializeIdentityAutoGenerated2(property.Value); |
| 0 | 166 | | continue; |
| | 167 | | } |
| 0 | 168 | | if (property.NameEquals("id")) |
| | 169 | | { |
| 0 | 170 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 171 | | { |
| | 172 | | continue; |
| | 173 | | } |
| 0 | 174 | | id = property.Value.GetString(); |
| 0 | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | if (property.NameEquals("name")) |
| | 178 | | { |
| 0 | 179 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | name = property.Value.GetString(); |
| 0 | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | if (property.NameEquals("type")) |
| | 187 | | { |
| 0 | 188 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 189 | | { |
| | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | type = property.Value.GetString(); |
| 0 | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | if (property.NameEquals("location")) |
| | 196 | | { |
| 0 | 197 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 198 | | { |
| | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | location = property.Value.GetString(); |
| 0 | 202 | | continue; |
| | 203 | | } |
| 0 | 204 | | if (property.NameEquals("tags")) |
| | 205 | | { |
| 0 | 206 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 207 | | { |
| | 208 | | continue; |
| | 209 | | } |
| 0 | 210 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 211 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 212 | | { |
| 0 | 213 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| 0 | 215 | | dictionary.Add(property0.Name, null); |
| | 216 | | } |
| | 217 | | else |
| | 218 | | { |
| 0 | 219 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 220 | | } |
| | 221 | | } |
| 0 | 222 | | tags = dictionary; |
| 0 | 223 | | continue; |
| | 224 | | } |
| 0 | 225 | | if (property.NameEquals("properties")) |
| | 226 | | { |
| 0 | 227 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 228 | | { |
| 0 | 229 | | if (property0.NameEquals("lockLevel")) |
| | 230 | | { |
| 0 | 231 | | lockLevel = property0.Value.GetString().ToApplicationLockLevel(); |
| 0 | 232 | | continue; |
| | 233 | | } |
| 0 | 234 | | if (property0.NameEquals("displayName")) |
| | 235 | | { |
| 0 | 236 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 237 | | { |
| | 238 | | continue; |
| | 239 | | } |
| 0 | 240 | | displayName = property0.Value.GetString(); |
| 0 | 241 | | continue; |
| | 242 | | } |
| 0 | 243 | | if (property0.NameEquals("isEnabled")) |
| | 244 | | { |
| 0 | 245 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 246 | | { |
| | 247 | | continue; |
| | 248 | | } |
| 0 | 249 | | isEnabled = property0.Value.GetString(); |
| 0 | 250 | | continue; |
| | 251 | | } |
| 0 | 252 | | if (property0.NameEquals("authorizations")) |
| | 253 | | { |
| 0 | 254 | | List<ApplicationProviderAuthorization> array = new List<ApplicationProviderAuthorization>(); |
| 0 | 255 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 256 | | { |
| 0 | 257 | | if (item.ValueKind == JsonValueKind.Null) |
| | 258 | | { |
| 0 | 259 | | array.Add(null); |
| | 260 | | } |
| | 261 | | else |
| | 262 | | { |
| 0 | 263 | | array.Add(ApplicationProviderAuthorization.DeserializeApplicationProviderAuthorizati |
| | 264 | | } |
| | 265 | | } |
| 0 | 266 | | authorizations = array; |
| 0 | 267 | | continue; |
| | 268 | | } |
| 0 | 269 | | if (property0.NameEquals("artifacts")) |
| | 270 | | { |
| 0 | 271 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| | 273 | | continue; |
| | 274 | | } |
| 0 | 275 | | List<ApplicationArtifact> array = new List<ApplicationArtifact>(); |
| 0 | 276 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 277 | | { |
| 0 | 278 | | if (item.ValueKind == JsonValueKind.Null) |
| | 279 | | { |
| 0 | 280 | | array.Add(null); |
| | 281 | | } |
| | 282 | | else |
| | 283 | | { |
| 0 | 284 | | array.Add(ApplicationArtifact.DeserializeApplicationArtifact(item)); |
| | 285 | | } |
| | 286 | | } |
| 0 | 287 | | artifacts = array; |
| 0 | 288 | | continue; |
| | 289 | | } |
| 0 | 290 | | if (property0.NameEquals("description")) |
| | 291 | | { |
| 0 | 292 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 293 | | { |
| | 294 | | continue; |
| | 295 | | } |
| 0 | 296 | | description = property0.Value.GetString(); |
| 0 | 297 | | continue; |
| | 298 | | } |
| 0 | 299 | | if (property0.NameEquals("packageFileUri")) |
| | 300 | | { |
| 0 | 301 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 302 | | { |
| | 303 | | continue; |
| | 304 | | } |
| 0 | 305 | | packageFileUri = property0.Value.GetString(); |
| 0 | 306 | | continue; |
| | 307 | | } |
| 0 | 308 | | if (property0.NameEquals("mainTemplate")) |
| | 309 | | { |
| 0 | 310 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 311 | | { |
| | 312 | | continue; |
| | 313 | | } |
| 0 | 314 | | mainTemplate = property0.Value.GetObject(); |
| 0 | 315 | | continue; |
| | 316 | | } |
| 0 | 317 | | if (property0.NameEquals("createUiDefinition")) |
| | 318 | | { |
| 0 | 319 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| | 321 | | continue; |
| | 322 | | } |
| 0 | 323 | | createUiDefinition = property0.Value.GetObject(); |
| | 324 | | continue; |
| | 325 | | } |
| | 326 | | } |
| | 327 | | continue; |
| | 328 | | } |
| | 329 | | } |
| 0 | 330 | | return new ApplicationDefinition(id, name, type, location, tags, managedBy, sku, identity, lockLevel, displa |
| | 331 | | } |
| | 332 | | } |
| | 333 | | } |