| | | 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 ParameterDefinitionsValue : IUtf8JsonSerializable |
| | | 15 | | { |
| | | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 17 | | { |
| | 20 | 18 | | writer.WriteStartObject(); |
| | 20 | 19 | | if (Type != null) |
| | | 20 | | { |
| | 20 | 21 | | writer.WritePropertyName("type"); |
| | 20 | 22 | | writer.WriteStringValue(Type.Value.ToString()); |
| | | 23 | | } |
| | 20 | 24 | | if (AllowedValues != null) |
| | | 25 | | { |
| | 0 | 26 | | writer.WritePropertyName("allowedValues"); |
| | 0 | 27 | | writer.WriteStartArray(); |
| | 0 | 28 | | foreach (var item in AllowedValues) |
| | | 29 | | { |
| | 0 | 30 | | writer.WriteObjectValue(item); |
| | | 31 | | } |
| | 0 | 32 | | writer.WriteEndArray(); |
| | | 33 | | } |
| | 20 | 34 | | if (DefaultValue != null) |
| | | 35 | | { |
| | 0 | 36 | | writer.WritePropertyName("defaultValue"); |
| | 0 | 37 | | writer.WriteObjectValue(DefaultValue); |
| | | 38 | | } |
| | 20 | 39 | | if (Metadata != null) |
| | | 40 | | { |
| | 0 | 41 | | writer.WritePropertyName("metadata"); |
| | 0 | 42 | | writer.WriteObjectValue(Metadata); |
| | | 43 | | } |
| | 20 | 44 | | writer.WriteEndObject(); |
| | 20 | 45 | | } |
| | | 46 | | |
| | | 47 | | internal static ParameterDefinitionsValue DeserializeParameterDefinitionsValue(JsonElement element) |
| | | 48 | | { |
| | 64036 | 49 | | ParameterType? type = default; |
| | 64036 | 50 | | IList<object> allowedValues = default; |
| | 64036 | 51 | | object defaultValue = default; |
| | 64036 | 52 | | ParameterDefinitionsValueMetadata metadata = default; |
| | 561408 | 53 | | foreach (var property in element.EnumerateObject()) |
| | | 54 | | { |
| | 216668 | 55 | | if (property.NameEquals("type")) |
| | | 56 | | { |
| | 64036 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 58 | | { |
| | | 59 | | continue; |
| | | 60 | | } |
| | 64036 | 61 | | type = new ParameterType(property.Value.GetString()); |
| | 64036 | 62 | | continue; |
| | | 63 | | } |
| | 152632 | 64 | | if (property.NameEquals("allowedValues")) |
| | | 65 | | { |
| | 35072 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 67 | | { |
| | | 68 | | continue; |
| | | 69 | | } |
| | 35072 | 70 | | List<object> array = new List<object>(); |
| | 297744 | 71 | | foreach (var item in property.Value.EnumerateArray()) |
| | | 72 | | { |
| | 113800 | 73 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 74 | | { |
| | 0 | 75 | | array.Add(null); |
| | | 76 | | } |
| | | 77 | | else |
| | | 78 | | { |
| | 113800 | 79 | | array.Add(item.GetObject()); |
| | | 80 | | } |
| | | 81 | | } |
| | 35072 | 82 | | allowedValues = array; |
| | 35072 | 83 | | continue; |
| | | 84 | | } |
| | 117560 | 85 | | if (property.NameEquals("defaultValue")) |
| | | 86 | | { |
| | 53544 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 88 | | { |
| | | 89 | | continue; |
| | | 90 | | } |
| | 53544 | 91 | | defaultValue = property.Value.GetObject(); |
| | 53544 | 92 | | continue; |
| | | 93 | | } |
| | 64016 | 94 | | if (property.NameEquals("metadata")) |
| | | 95 | | { |
| | 64016 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 97 | | { |
| | | 98 | | continue; |
| | | 99 | | } |
| | 64016 | 100 | | metadata = ParameterDefinitionsValueMetadata.DeserializeParameterDefinitionsValueMetadata(property.V |
| | | 101 | | continue; |
| | | 102 | | } |
| | | 103 | | } |
| | 64036 | 104 | | return new ParameterDefinitionsValue(type, allowedValues, defaultValue, metadata); |
| | | 105 | | } |
| | | 106 | | } |
| | | 107 | | } |