| | 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 GalleryImageVersion : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 16 | 18 | | writer.WriteStartObject(); |
| 16 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 16 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 16 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 16 | 34 | | writer.WritePropertyName("location"); |
| 16 | 35 | | writer.WriteStringValue(Location); |
| 16 | 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 | | } |
| 16 | 47 | | writer.WritePropertyName("properties"); |
| 16 | 48 | | writer.WriteStartObject(); |
| 16 | 49 | | if (PublishingProfile != null) |
| | 50 | | { |
| 16 | 51 | | writer.WritePropertyName("publishingProfile"); |
| 16 | 52 | | writer.WriteObjectValue(PublishingProfile); |
| | 53 | | } |
| 16 | 54 | | if (ProvisioningState != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("provisioningState"); |
| 0 | 57 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 58 | | } |
| 16 | 59 | | if (StorageProfile != null) |
| | 60 | | { |
| 16 | 61 | | writer.WritePropertyName("storageProfile"); |
| 16 | 62 | | writer.WriteObjectValue(StorageProfile); |
| | 63 | | } |
| 16 | 64 | | if (ReplicationStatus != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("replicationStatus"); |
| 0 | 67 | | writer.WriteObjectValue(ReplicationStatus); |
| | 68 | | } |
| 16 | 69 | | writer.WriteEndObject(); |
| 16 | 70 | | writer.WriteEndObject(); |
| 16 | 71 | | } |
| | 72 | |
|
| | 73 | | internal static GalleryImageVersion DeserializeGalleryImageVersion(JsonElement element) |
| | 74 | | { |
| 24 | 75 | | string id = default; |
| 24 | 76 | | string name = default; |
| 24 | 77 | | string type = default; |
| 24 | 78 | | string location = default; |
| 24 | 79 | | IDictionary<string, string> tags = default; |
| 24 | 80 | | GalleryArtifactPublishingProfileBase publishingProfile = default; |
| 24 | 81 | | GalleryImageVersionPropertiesProvisioningState? provisioningState = default; |
| 24 | 82 | | GalleryImageVersionStorageProfile storageProfile = default; |
| 24 | 83 | | ReplicationStatus replicationStatus = default; |
| 288 | 84 | | foreach (var property in element.EnumerateObject()) |
| | 85 | | { |
| 120 | 86 | | if (property.NameEquals("id")) |
| | 87 | | { |
| 24 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 24 | 92 | | id = property.Value.GetString(); |
| 24 | 93 | | continue; |
| | 94 | | } |
| 96 | 95 | | if (property.NameEquals("name")) |
| | 96 | | { |
| 24 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 24 | 101 | | name = property.Value.GetString(); |
| 24 | 102 | | continue; |
| | 103 | | } |
| 72 | 104 | | if (property.NameEquals("type")) |
| | 105 | | { |
| 24 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 24 | 110 | | type = property.Value.GetString(); |
| 24 | 111 | | continue; |
| | 112 | | } |
| 48 | 113 | | if (property.NameEquals("location")) |
| | 114 | | { |
| 24 | 115 | | location = property.Value.GetString(); |
| 24 | 116 | | continue; |
| | 117 | | } |
| 24 | 118 | | if (property.NameEquals("tags")) |
| | 119 | | { |
| 0 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 125 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 126 | | { |
| 0 | 127 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| 0 | 129 | | dictionary.Add(property0.Name, null); |
| | 130 | | } |
| | 131 | | else |
| | 132 | | { |
| 0 | 133 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 134 | | } |
| | 135 | | } |
| 0 | 136 | | tags = dictionary; |
| 0 | 137 | | continue; |
| | 138 | | } |
| 24 | 139 | | if (property.NameEquals("properties")) |
| | 140 | | { |
| 216 | 141 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 142 | | { |
| 84 | 143 | | if (property0.NameEquals("publishingProfile")) |
| | 144 | | { |
| 24 | 145 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 24 | 149 | | publishingProfile = GalleryArtifactPublishingProfileBase.DeserializeGalleryArtifactPublishin |
| 24 | 150 | | continue; |
| | 151 | | } |
| 60 | 152 | | if (property0.NameEquals("provisioningState")) |
| | 153 | | { |
| 24 | 154 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 24 | 158 | | provisioningState = new GalleryImageVersionPropertiesProvisioningState(property0.Value.GetSt |
| 24 | 159 | | continue; |
| | 160 | | } |
| 36 | 161 | | if (property0.NameEquals("storageProfile")) |
| | 162 | | { |
| 24 | 163 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 24 | 167 | | storageProfile = GalleryImageVersionStorageProfile.DeserializeGalleryImageVersionStorageProf |
| 24 | 168 | | continue; |
| | 169 | | } |
| 12 | 170 | | if (property0.NameEquals("replicationStatus")) |
| | 171 | | { |
| 12 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 12 | 176 | | replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value); |
| | 177 | | continue; |
| | 178 | | } |
| | 179 | | } |
| | 180 | | continue; |
| | 181 | | } |
| | 182 | | } |
| 24 | 183 | | return new GalleryImageVersion(id, name, type, location, tags, publishingProfile, provisioningState, storage |
| | 184 | | } |
| | 185 | | } |
| | 186 | | } |