| | 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.Resources.Models |
| | 13 | | { |
| | 14 | | public partial class ScriptStatus : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (ContainerInstanceId != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("containerInstanceId"); |
| 0 | 22 | | writer.WriteStringValue(ContainerInstanceId); |
| | 23 | | } |
| 0 | 24 | | if (StorageAccountId != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("storageAccountId"); |
| 0 | 27 | | writer.WriteStringValue(StorageAccountId); |
| | 28 | | } |
| 0 | 29 | | if (StartTime != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("startTime"); |
| 0 | 32 | | writer.WriteStringValue(StartTime.Value, "O"); |
| | 33 | | } |
| 0 | 34 | | if (EndTime != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("endTime"); |
| 0 | 37 | | writer.WriteStringValue(EndTime.Value, "O"); |
| | 38 | | } |
| 0 | 39 | | if (ExpirationTime != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("expirationTime"); |
| 0 | 42 | | writer.WriteStringValue(ExpirationTime.Value, "O"); |
| | 43 | | } |
| 0 | 44 | | if (Error != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("error"); |
| 0 | 47 | | writer.WriteObjectValue(Error); |
| | 48 | | } |
| 0 | 49 | | writer.WriteEndObject(); |
| 0 | 50 | | } |
| | 51 | |
|
| | 52 | | internal static ScriptStatus DeserializeScriptStatus(JsonElement element) |
| | 53 | | { |
| 74 | 54 | | string containerInstanceId = default; |
| 74 | 55 | | string storageAccountId = default; |
| 74 | 56 | | DateTimeOffset? startTime = default; |
| 74 | 57 | | DateTimeOffset? endTime = default; |
| 74 | 58 | | DateTimeOffset? expirationTime = default; |
| 74 | 59 | | ErrorResponse error = default; |
| 708 | 60 | | foreach (var property in element.EnumerateObject()) |
| | 61 | | { |
| 280 | 62 | | if (property.NameEquals("containerInstanceId")) |
| | 63 | | { |
| 56 | 64 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 65 | | { |
| | 66 | | continue; |
| | 67 | | } |
| 56 | 68 | | containerInstanceId = property.Value.GetString(); |
| 56 | 69 | | continue; |
| | 70 | | } |
| 224 | 71 | | if (property.NameEquals("storageAccountId")) |
| | 72 | | { |
| 58 | 73 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 74 | | { |
| | 75 | | continue; |
| | 76 | | } |
| 58 | 77 | | storageAccountId = property.Value.GetString(); |
| 58 | 78 | | continue; |
| | 79 | | } |
| 166 | 80 | | if (property.NameEquals("startTime")) |
| | 81 | | { |
| 70 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 70 | 86 | | startTime = property.Value.GetDateTimeOffset("O"); |
| 70 | 87 | | continue; |
| | 88 | | } |
| 96 | 89 | | if (property.NameEquals("endTime")) |
| | 90 | | { |
| 40 | 91 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| | 93 | | continue; |
| | 94 | | } |
| 40 | 95 | | endTime = property.Value.GetDateTimeOffset("O"); |
| 40 | 96 | | continue; |
| | 97 | | } |
| 56 | 98 | | if (property.NameEquals("expirationTime")) |
| | 99 | | { |
| 40 | 100 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 101 | | { |
| | 102 | | continue; |
| | 103 | | } |
| 40 | 104 | | expirationTime = property.Value.GetDateTimeOffset("O"); |
| 40 | 105 | | continue; |
| | 106 | | } |
| 16 | 107 | | if (property.NameEquals("error")) |
| | 108 | | { |
| 16 | 109 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 16 | 113 | | error = ErrorResponse.DeserializeErrorResponse(property.Value); |
| | 114 | | continue; |
| | 115 | | } |
| | 116 | | } |
| 74 | 117 | | return new ScriptStatus(containerInstanceId, storageAccountId, startTime, endTime, expirationTime, error); |
| | 118 | | } |
| | 119 | | } |
| | 120 | | } |