| | | 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; |
| | | 9 | | using System.Collections.Generic; |
| | | 10 | | using System.Text.Json; |
| | | 11 | | using Azure.Core; |
| | | 12 | | |
| | | 13 | | namespace Azure.ResourceManager.Compute.Models |
| | | 14 | | { |
| | | 15 | | public partial class GalleryApplicationVersionPublishingProfile : IUtf8JsonSerializable |
| | | 16 | | { |
| | | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 18 | | { |
| | 0 | 19 | | writer.WriteStartObject(); |
| | 0 | 20 | | writer.WritePropertyName("source"); |
| | 0 | 21 | | writer.WriteObjectValue(Source); |
| | 0 | 22 | | if (ContentType != null) |
| | | 23 | | { |
| | 0 | 24 | | writer.WritePropertyName("contentType"); |
| | 0 | 25 | | writer.WriteStringValue(ContentType); |
| | | 26 | | } |
| | 0 | 27 | | if (EnableHealthCheck != null) |
| | | 28 | | { |
| | 0 | 29 | | writer.WritePropertyName("enableHealthCheck"); |
| | 0 | 30 | | writer.WriteBooleanValue(EnableHealthCheck.Value); |
| | | 31 | | } |
| | 0 | 32 | | if (TargetRegions != null) |
| | | 33 | | { |
| | 0 | 34 | | writer.WritePropertyName("targetRegions"); |
| | 0 | 35 | | writer.WriteStartArray(); |
| | 0 | 36 | | foreach (var item in TargetRegions) |
| | | 37 | | { |
| | 0 | 38 | | writer.WriteObjectValue(item); |
| | | 39 | | } |
| | 0 | 40 | | writer.WriteEndArray(); |
| | | 41 | | } |
| | 0 | 42 | | if (ReplicaCount != null) |
| | | 43 | | { |
| | 0 | 44 | | writer.WritePropertyName("replicaCount"); |
| | 0 | 45 | | writer.WriteNumberValue(ReplicaCount.Value); |
| | | 46 | | } |
| | 0 | 47 | | if (ExcludeFromLatest != null) |
| | | 48 | | { |
| | 0 | 49 | | writer.WritePropertyName("excludeFromLatest"); |
| | 0 | 50 | | writer.WriteBooleanValue(ExcludeFromLatest.Value); |
| | | 51 | | } |
| | 0 | 52 | | if (PublishedDate != null) |
| | | 53 | | { |
| | 0 | 54 | | writer.WritePropertyName("publishedDate"); |
| | 0 | 55 | | writer.WriteStringValue(PublishedDate.Value, "O"); |
| | | 56 | | } |
| | 0 | 57 | | if (EndOfLifeDate != null) |
| | | 58 | | { |
| | 0 | 59 | | writer.WritePropertyName("endOfLifeDate"); |
| | 0 | 60 | | writer.WriteStringValue(EndOfLifeDate.Value, "O"); |
| | | 61 | | } |
| | 0 | 62 | | if (StorageAccountType != null) |
| | | 63 | | { |
| | 0 | 64 | | writer.WritePropertyName("storageAccountType"); |
| | 0 | 65 | | writer.WriteStringValue(StorageAccountType.Value.ToString()); |
| | | 66 | | } |
| | 0 | 67 | | writer.WriteEndObject(); |
| | 0 | 68 | | } |
| | | 69 | | |
| | | 70 | | internal static GalleryApplicationVersionPublishingProfile DeserializeGalleryApplicationVersionPublishingProfile |
| | | 71 | | { |
| | 0 | 72 | | UserArtifactSource source = default; |
| | 0 | 73 | | string contentType = default; |
| | 0 | 74 | | bool? enableHealthCheck = default; |
| | 0 | 75 | | IList<TargetRegion> targetRegions = default; |
| | 0 | 76 | | int? replicaCount = default; |
| | 0 | 77 | | bool? excludeFromLatest = default; |
| | 0 | 78 | | DateTimeOffset? publishedDate = default; |
| | 0 | 79 | | DateTimeOffset? endOfLifeDate = default; |
| | 0 | 80 | | StorageAccountType? storageAccountType = default; |
| | 0 | 81 | | foreach (var property in element.EnumerateObject()) |
| | | 82 | | { |
| | 0 | 83 | | if (property.NameEquals("source")) |
| | | 84 | | { |
| | 0 | 85 | | source = UserArtifactSource.DeserializeUserArtifactSource(property.Value); |
| | 0 | 86 | | continue; |
| | | 87 | | } |
| | 0 | 88 | | if (property.NameEquals("contentType")) |
| | | 89 | | { |
| | 0 | 90 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 91 | | { |
| | | 92 | | continue; |
| | | 93 | | } |
| | 0 | 94 | | contentType = property.Value.GetString(); |
| | 0 | 95 | | continue; |
| | | 96 | | } |
| | 0 | 97 | | if (property.NameEquals("enableHealthCheck")) |
| | | 98 | | { |
| | 0 | 99 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 100 | | { |
| | | 101 | | continue; |
| | | 102 | | } |
| | 0 | 103 | | enableHealthCheck = property.Value.GetBoolean(); |
| | 0 | 104 | | continue; |
| | | 105 | | } |
| | 0 | 106 | | if (property.NameEquals("targetRegions")) |
| | | 107 | | { |
| | 0 | 108 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 109 | | { |
| | | 110 | | continue; |
| | | 111 | | } |
| | 0 | 112 | | List<TargetRegion> array = new List<TargetRegion>(); |
| | 0 | 113 | | foreach (var item in property.Value.EnumerateArray()) |
| | | 114 | | { |
| | 0 | 115 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 116 | | { |
| | 0 | 117 | | array.Add(null); |
| | | 118 | | } |
| | | 119 | | else |
| | | 120 | | { |
| | 0 | 121 | | array.Add(TargetRegion.DeserializeTargetRegion(item)); |
| | | 122 | | } |
| | | 123 | | } |
| | 0 | 124 | | targetRegions = array; |
| | 0 | 125 | | continue; |
| | | 126 | | } |
| | 0 | 127 | | if (property.NameEquals("replicaCount")) |
| | | 128 | | { |
| | 0 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 130 | | { |
| | | 131 | | continue; |
| | | 132 | | } |
| | 0 | 133 | | replicaCount = property.Value.GetInt32(); |
| | 0 | 134 | | continue; |
| | | 135 | | } |
| | 0 | 136 | | if (property.NameEquals("excludeFromLatest")) |
| | | 137 | | { |
| | 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 139 | | { |
| | | 140 | | continue; |
| | | 141 | | } |
| | 0 | 142 | | excludeFromLatest = property.Value.GetBoolean(); |
| | 0 | 143 | | continue; |
| | | 144 | | } |
| | 0 | 145 | | if (property.NameEquals("publishedDate")) |
| | | 146 | | { |
| | 0 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 148 | | { |
| | | 149 | | continue; |
| | | 150 | | } |
| | 0 | 151 | | publishedDate = property.Value.GetDateTimeOffset("O"); |
| | 0 | 152 | | continue; |
| | | 153 | | } |
| | 0 | 154 | | if (property.NameEquals("endOfLifeDate")) |
| | | 155 | | { |
| | 0 | 156 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 157 | | { |
| | | 158 | | continue; |
| | | 159 | | } |
| | 0 | 160 | | endOfLifeDate = property.Value.GetDateTimeOffset("O"); |
| | 0 | 161 | | continue; |
| | | 162 | | } |
| | 0 | 163 | | if (property.NameEquals("storageAccountType")) |
| | | 164 | | { |
| | 0 | 165 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 166 | | { |
| | | 167 | | continue; |
| | | 168 | | } |
| | 0 | 169 | | storageAccountType = new StorageAccountType(property.Value.GetString()); |
| | | 170 | | continue; |
| | | 171 | | } |
| | | 172 | | } |
| | 0 | 173 | | return new GalleryApplicationVersionPublishingProfile(targetRegions, replicaCount, excludeFromLatest, publis |
| | | 174 | | } |
| | | 175 | | } |
| | | 176 | | } |