| | | 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.Text.Json; |
| | | 9 | | using Azure.Core; |
| | | 10 | | |
| | | 11 | | namespace Azure.ResourceManager.Compute.Models |
| | | 12 | | { |
| | | 13 | | public partial class CreationData : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 228 | 17 | | writer.WriteStartObject(); |
| | 228 | 18 | | writer.WritePropertyName("createOption"); |
| | 228 | 19 | | writer.WriteStringValue(CreateOption.ToString()); |
| | 228 | 20 | | if (StorageAccountId != null) |
| | | 21 | | { |
| | 40 | 22 | | writer.WritePropertyName("storageAccountId"); |
| | 40 | 23 | | writer.WriteStringValue(StorageAccountId); |
| | | 24 | | } |
| | 228 | 25 | | if (ImageReference != null) |
| | | 26 | | { |
| | 0 | 27 | | writer.WritePropertyName("imageReference"); |
| | 0 | 28 | | writer.WriteObjectValue(ImageReference); |
| | | 29 | | } |
| | 228 | 30 | | if (GalleryImageReference != null) |
| | | 31 | | { |
| | 0 | 32 | | writer.WritePropertyName("galleryImageReference"); |
| | 0 | 33 | | writer.WriteObjectValue(GalleryImageReference); |
| | | 34 | | } |
| | 228 | 35 | | if (SourceUri != null) |
| | | 36 | | { |
| | 40 | 37 | | writer.WritePropertyName("sourceUri"); |
| | 40 | 38 | | writer.WriteStringValue(SourceUri); |
| | | 39 | | } |
| | 228 | 40 | | if (SourceResourceId != null) |
| | | 41 | | { |
| | 48 | 42 | | writer.WritePropertyName("sourceResourceId"); |
| | 48 | 43 | | writer.WriteStringValue(SourceResourceId); |
| | | 44 | | } |
| | 228 | 45 | | if (SourceUniqueId != null) |
| | | 46 | | { |
| | 0 | 47 | | writer.WritePropertyName("sourceUniqueId"); |
| | 0 | 48 | | writer.WriteStringValue(SourceUniqueId); |
| | | 49 | | } |
| | 228 | 50 | | if (UploadSizeBytes != null) |
| | | 51 | | { |
| | 8 | 52 | | writer.WritePropertyName("uploadSizeBytes"); |
| | 8 | 53 | | writer.WriteNumberValue(UploadSizeBytes.Value); |
| | | 54 | | } |
| | 228 | 55 | | writer.WriteEndObject(); |
| | 228 | 56 | | } |
| | | 57 | | |
| | | 58 | | internal static CreationData DeserializeCreationData(JsonElement element) |
| | | 59 | | { |
| | 316 | 60 | | DiskCreateOption createOption = default; |
| | 316 | 61 | | string storageAccountId = default; |
| | 316 | 62 | | ImageDiskReference imageReference = default; |
| | 316 | 63 | | ImageDiskReference galleryImageReference = default; |
| | 316 | 64 | | string sourceUri = default; |
| | 316 | 65 | | string sourceResourceId = default; |
| | 316 | 66 | | string sourceUniqueId = default; |
| | 316 | 67 | | long? uploadSizeBytes = default; |
| | 1912 | 68 | | foreach (var property in element.EnumerateObject()) |
| | | 69 | | { |
| | 640 | 70 | | if (property.NameEquals("createOption")) |
| | | 71 | | { |
| | 316 | 72 | | createOption = new DiskCreateOption(property.Value.GetString()); |
| | 316 | 73 | | continue; |
| | | 74 | | } |
| | 324 | 75 | | if (property.NameEquals("storageAccountId")) |
| | | 76 | | { |
| | 68 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 78 | | { |
| | | 79 | | continue; |
| | | 80 | | } |
| | 68 | 81 | | storageAccountId = property.Value.GetString(); |
| | 68 | 82 | | continue; |
| | | 83 | | } |
| | 256 | 84 | | if (property.NameEquals("imageReference")) |
| | | 85 | | { |
| | 4 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 87 | | { |
| | | 88 | | continue; |
| | | 89 | | } |
| | 4 | 90 | | imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value); |
| | 4 | 91 | | continue; |
| | | 92 | | } |
| | 252 | 93 | | if (property.NameEquals("galleryImageReference")) |
| | | 94 | | { |
| | 0 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 96 | | { |
| | | 97 | | continue; |
| | | 98 | | } |
| | 0 | 99 | | galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value); |
| | 0 | 100 | | continue; |
| | | 101 | | } |
| | 252 | 102 | | if (property.NameEquals("sourceUri")) |
| | | 103 | | { |
| | 68 | 104 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 105 | | { |
| | | 106 | | continue; |
| | | 107 | | } |
| | 68 | 108 | | sourceUri = property.Value.GetString(); |
| | 68 | 109 | | continue; |
| | | 110 | | } |
| | 184 | 111 | | if (property.NameEquals("sourceResourceId")) |
| | | 112 | | { |
| | 88 | 113 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 114 | | { |
| | | 115 | | continue; |
| | | 116 | | } |
| | 88 | 117 | | sourceResourceId = property.Value.GetString(); |
| | 88 | 118 | | continue; |
| | | 119 | | } |
| | 96 | 120 | | if (property.NameEquals("sourceUniqueId")) |
| | | 121 | | { |
| | 88 | 122 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 123 | | { |
| | | 124 | | continue; |
| | | 125 | | } |
| | 88 | 126 | | sourceUniqueId = property.Value.GetString(); |
| | 88 | 127 | | continue; |
| | | 128 | | } |
| | 8 | 129 | | if (property.NameEquals("uploadSizeBytes")) |
| | | 130 | | { |
| | 8 | 131 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 132 | | { |
| | | 133 | | continue; |
| | | 134 | | } |
| | 8 | 135 | | uploadSizeBytes = property.Value.GetInt64(); |
| | | 136 | | continue; |
| | | 137 | | } |
| | | 138 | | } |
| | 316 | 139 | | return new CreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, so |
| | | 140 | | } |
| | | 141 | | } |
| | | 142 | | } |