| | 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 GalleryApplicationVersion : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 0 | 24 | | if (Name != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("name"); |
| 0 | 27 | | writer.WriteStringValue(Name); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("location"); |
| 0 | 35 | | writer.WriteStringValue(Location); |
| 0 | 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 | | } |
| 0 | 47 | | writer.WritePropertyName("properties"); |
| 0 | 48 | | writer.WriteStartObject(); |
| 0 | 49 | | if (PublishingProfile != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("publishingProfile"); |
| 0 | 52 | | writer.WriteObjectValue(PublishingProfile); |
| | 53 | | } |
| 0 | 54 | | if (ProvisioningState != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("provisioningState"); |
| 0 | 57 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 58 | | } |
| 0 | 59 | | if (ReplicationStatus != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("replicationStatus"); |
| 0 | 62 | | writer.WriteObjectValue(ReplicationStatus); |
| | 63 | | } |
| 0 | 64 | | writer.WriteEndObject(); |
| 0 | 65 | | writer.WriteEndObject(); |
| 0 | 66 | | } |
| | 67 | |
|
| | 68 | | internal static GalleryApplicationVersion DeserializeGalleryApplicationVersion(JsonElement element) |
| | 69 | | { |
| 0 | 70 | | string id = default; |
| 0 | 71 | | string name = default; |
| 0 | 72 | | string type = default; |
| 0 | 73 | | string location = default; |
| 0 | 74 | | IDictionary<string, string> tags = default; |
| 0 | 75 | | GalleryApplicationVersionPublishingProfile publishingProfile = default; |
| 0 | 76 | | GalleryApplicationVersionPropertiesProvisioningState? provisioningState = default; |
| 0 | 77 | | ReplicationStatus replicationStatus = default; |
| 0 | 78 | | foreach (var property in element.EnumerateObject()) |
| | 79 | | { |
| 0 | 80 | | if (property.NameEquals("id")) |
| | 81 | | { |
| 0 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | id = property.Value.GetString(); |
| 0 | 87 | | continue; |
| | 88 | | } |
| 0 | 89 | | if (property.NameEquals("name")) |
| | 90 | | { |
| 0 | 91 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | name = property.Value.GetString(); |
| 0 | 96 | | continue; |
| | 97 | | } |
| 0 | 98 | | if (property.NameEquals("type")) |
| | 99 | | { |
| 0 | 100 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 101 | | { |
| | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | type = property.Value.GetString(); |
| 0 | 105 | | continue; |
| | 106 | | } |
| 0 | 107 | | if (property.NameEquals("location")) |
| | 108 | | { |
| 0 | 109 | | location = property.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 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 | | } |
| 0 | 133 | | if (property.NameEquals("properties")) |
| | 134 | | { |
| 0 | 135 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 136 | | { |
| 0 | 137 | | if (property0.NameEquals("publishingProfile")) |
| | 138 | | { |
| 0 | 139 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | publishingProfile = GalleryApplicationVersionPublishingProfile.DeserializeGalleryApplication |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property0.NameEquals("provisioningState")) |
| | 147 | | { |
| 0 | 148 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | provisioningState = new GalleryApplicationVersionPropertiesProvisioningState(property0.Value |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property0.NameEquals("replicationStatus")) |
| | 156 | | { |
| 0 | 157 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value); |
| | 162 | | continue; |
| | 163 | | } |
| | 164 | | } |
| | 165 | | continue; |
| | 166 | | } |
| | 167 | | } |
| 0 | 168 | | return new GalleryApplicationVersion(id, name, type, location, tags, publishingProfile, provisioningState, r |
| | 169 | | } |
| | 170 | | } |
| | 171 | | } |