| | 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.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class InstanceViewStatus : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 80 | 18 | | writer.WriteStartObject(); |
| 80 | 19 | | if (Code != null) |
| | 20 | | { |
| 80 | 21 | | writer.WritePropertyName("code"); |
| 80 | 22 | | writer.WriteStringValue(Code); |
| | 23 | | } |
| 80 | 24 | | if (Level != null) |
| | 25 | | { |
| 80 | 26 | | writer.WritePropertyName("level"); |
| 80 | 27 | | writer.WriteStringValue(Level.Value.ToSerialString()); |
| | 28 | | } |
| 80 | 29 | | if (DisplayStatus != null) |
| | 30 | | { |
| 80 | 31 | | writer.WritePropertyName("displayStatus"); |
| 80 | 32 | | writer.WriteStringValue(DisplayStatus); |
| | 33 | | } |
| 80 | 34 | | if (Message != null) |
| | 35 | | { |
| 16 | 36 | | writer.WritePropertyName("message"); |
| 16 | 37 | | writer.WriteStringValue(Message); |
| | 38 | | } |
| 80 | 39 | | if (Time != null) |
| | 40 | | { |
| 64 | 41 | | writer.WritePropertyName("time"); |
| 64 | 42 | | writer.WriteStringValue(Time.Value, "O"); |
| | 43 | | } |
| 80 | 44 | | writer.WriteEndObject(); |
| 80 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static InstanceViewStatus DeserializeInstanceViewStatus(JsonElement element) |
| | 48 | | { |
| 980 | 49 | | string code = default; |
| 980 | 50 | | StatusLevelTypes? level = default; |
| 980 | 51 | | string displayStatus = default; |
| 980 | 52 | | string message = default; |
| 980 | 53 | | DateTimeOffset? time = default; |
| 9816 | 54 | | foreach (var property in element.EnumerateObject()) |
| | 55 | | { |
| 3928 | 56 | | if (property.NameEquals("code")) |
| | 57 | | { |
| 980 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 980 | 62 | | code = property.Value.GetString(); |
| 980 | 63 | | continue; |
| | 64 | | } |
| 2948 | 65 | | if (property.NameEquals("level")) |
| | 66 | | { |
| 980 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 980 | 71 | | level = property.Value.GetString().ToStatusLevelTypes(); |
| 980 | 72 | | continue; |
| | 73 | | } |
| 1968 | 74 | | if (property.NameEquals("displayStatus")) |
| | 75 | | { |
| 976 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 976 | 80 | | displayStatus = property.Value.GetString(); |
| 976 | 81 | | continue; |
| | 82 | | } |
| 992 | 83 | | if (property.NameEquals("message")) |
| | 84 | | { |
| 260 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 260 | 89 | | message = property.Value.GetString(); |
| 260 | 90 | | continue; |
| | 91 | | } |
| 732 | 92 | | if (property.NameEquals("time")) |
| | 93 | | { |
| 732 | 94 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 95 | | { |
| | 96 | | continue; |
| | 97 | | } |
| 732 | 98 | | time = property.Value.GetDateTimeOffset("O"); |
| | 99 | | continue; |
| | 100 | | } |
| | 101 | | } |
| 980 | 102 | | return new InstanceViewStatus(code, level, displayStatus, message, time); |
| | 103 | | } |
| | 104 | | } |
| | 105 | | } |