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