| | 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.Iot.Hub.Service.Models |
| | 13 | | { |
| | 14 | | public partial class JobProperties : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsDefined(JobId)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("jobId"); |
| 0 | 22 | | writer.WriteStringValue(JobId); |
| | 23 | | } |
| 0 | 24 | | if (Optional.IsDefined(StartTimeUtc)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("startTimeUtc"); |
| 0 | 27 | | writer.WriteStringValue(StartTimeUtc.Value, "O"); |
| | 28 | | } |
| 0 | 29 | | if (Optional.IsDefined(EndTimeUtc)) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("endTimeUtc"); |
| 0 | 32 | | writer.WriteStringValue(EndTimeUtc.Value, "O"); |
| | 33 | | } |
| 0 | 34 | | if (Optional.IsDefined(Type)) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type.Value.ToString()); |
| | 38 | | } |
| 0 | 39 | | if (Optional.IsDefined(Status)) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("status"); |
| 0 | 42 | | writer.WriteStringValue(Status.Value.ToString()); |
| | 43 | | } |
| 0 | 44 | | if (Optional.IsDefined(Progress)) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("progress"); |
| 0 | 47 | | writer.WriteNumberValue(Progress.Value); |
| | 48 | | } |
| 0 | 49 | | if (Optional.IsDefined(InputBlobContainerUri)) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("inputBlobContainerUri"); |
| 0 | 52 | | writer.WriteStringValue(InputBlobContainerUri); |
| | 53 | | } |
| 0 | 54 | | if (Optional.IsDefined(InputBlobName)) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("inputBlobName"); |
| 0 | 57 | | writer.WriteStringValue(InputBlobName); |
| | 58 | | } |
| 0 | 59 | | if (Optional.IsDefined(OutputBlobContainerUri)) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("outputBlobContainerUri"); |
| 0 | 62 | | writer.WriteStringValue(OutputBlobContainerUri); |
| | 63 | | } |
| 0 | 64 | | if (Optional.IsDefined(OutputBlobName)) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("outputBlobName"); |
| 0 | 67 | | writer.WriteStringValue(OutputBlobName); |
| | 68 | | } |
| 0 | 69 | | if (Optional.IsDefined(ExcludeKeysInExport)) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("excludeKeysInExport"); |
| 0 | 72 | | writer.WriteBooleanValue(ExcludeKeysInExport.Value); |
| | 73 | | } |
| 0 | 74 | | if (Optional.IsDefined(StorageAuthenticationType)) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("storageAuthenticationType"); |
| 0 | 77 | | writer.WriteStringValue(StorageAuthenticationType.Value.ToString()); |
| | 78 | | } |
| 0 | 79 | | if (Optional.IsDefined(FailureReason)) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("failureReason"); |
| 0 | 82 | | writer.WriteStringValue(FailureReason); |
| | 83 | | } |
| 0 | 84 | | if (Optional.IsDefined(IncludeConfigurations)) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("includeConfigurations"); |
| 0 | 87 | | writer.WriteBooleanValue(IncludeConfigurations.Value); |
| | 88 | | } |
| 0 | 89 | | if (Optional.IsDefined(ConfigurationsBlobName)) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("configurationsBlobName"); |
| 0 | 92 | | writer.WriteStringValue(ConfigurationsBlobName); |
| | 93 | | } |
| 0 | 94 | | writer.WriteEndObject(); |
| 0 | 95 | | } |
| | 96 | |
|
| | 97 | | internal static JobProperties DeserializeJobProperties(JsonElement element) |
| | 98 | | { |
| 0 | 99 | | Optional<string> jobId = default; |
| 0 | 100 | | Optional<DateTimeOffset> startTimeUtc = default; |
| 0 | 101 | | Optional<DateTimeOffset> endTimeUtc = default; |
| 0 | 102 | | Optional<JobPropertiesType> type = default; |
| 0 | 103 | | Optional<JobPropertiesStatus> status = default; |
| 0 | 104 | | Optional<int> progress = default; |
| 0 | 105 | | Optional<string> inputBlobContainerUri = default; |
| 0 | 106 | | Optional<string> inputBlobName = default; |
| 0 | 107 | | Optional<string> outputBlobContainerUri = default; |
| 0 | 108 | | Optional<string> outputBlobName = default; |
| 0 | 109 | | Optional<bool> excludeKeysInExport = default; |
| 0 | 110 | | Optional<JobPropertiesStorageAuthenticationType> storageAuthenticationType = default; |
| 0 | 111 | | Optional<string> failureReason = default; |
| 0 | 112 | | Optional<bool> includeConfigurations = default; |
| 0 | 113 | | Optional<string> configurationsBlobName = default; |
| 0 | 114 | | foreach (var property in element.EnumerateObject()) |
| | 115 | | { |
| 0 | 116 | | if (property.NameEquals("jobId")) |
| | 117 | | { |
| 0 | 118 | | jobId = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | if (property.NameEquals("startTimeUtc")) |
| | 122 | | { |
| 0 | 123 | | startTimeUtc = property.Value.GetDateTimeOffset("O"); |
| 0 | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | if (property.NameEquals("endTimeUtc")) |
| | 127 | | { |
| 0 | 128 | | endTimeUtc = property.Value.GetDateTimeOffset("O"); |
| 0 | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | if (property.NameEquals("type")) |
| | 132 | | { |
| 0 | 133 | | type = new JobPropertiesType(property.Value.GetString()); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property.NameEquals("status")) |
| | 137 | | { |
| 0 | 138 | | status = new JobPropertiesStatus(property.Value.GetString()); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("progress")) |
| | 142 | | { |
| 0 | 143 | | progress = property.Value.GetInt32(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property.NameEquals("inputBlobContainerUri")) |
| | 147 | | { |
| 0 | 148 | | inputBlobContainerUri = property.Value.GetString(); |
| 0 | 149 | | continue; |
| | 150 | | } |
| 0 | 151 | | if (property.NameEquals("inputBlobName")) |
| | 152 | | { |
| 0 | 153 | | inputBlobName = property.Value.GetString(); |
| 0 | 154 | | continue; |
| | 155 | | } |
| 0 | 156 | | if (property.NameEquals("outputBlobContainerUri")) |
| | 157 | | { |
| 0 | 158 | | outputBlobContainerUri = property.Value.GetString(); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property.NameEquals("outputBlobName")) |
| | 162 | | { |
| 0 | 163 | | outputBlobName = property.Value.GetString(); |
| 0 | 164 | | continue; |
| | 165 | | } |
| 0 | 166 | | if (property.NameEquals("excludeKeysInExport")) |
| | 167 | | { |
| 0 | 168 | | excludeKeysInExport = property.Value.GetBoolean(); |
| 0 | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | if (property.NameEquals("storageAuthenticationType")) |
| | 172 | | { |
| 0 | 173 | | storageAuthenticationType = new JobPropertiesStorageAuthenticationType(property.Value.GetString()); |
| 0 | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | if (property.NameEquals("failureReason")) |
| | 177 | | { |
| 0 | 178 | | failureReason = property.Value.GetString(); |
| 0 | 179 | | continue; |
| | 180 | | } |
| 0 | 181 | | if (property.NameEquals("includeConfigurations")) |
| | 182 | | { |
| 0 | 183 | | includeConfigurations = property.Value.GetBoolean(); |
| 0 | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | if (property.NameEquals("configurationsBlobName")) |
| | 187 | | { |
| 0 | 188 | | configurationsBlobName = property.Value.GetString(); |
| | 189 | | continue; |
| | 190 | | } |
| | 191 | | } |
| 0 | 192 | | return new JobProperties(jobId.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Op |
| | 193 | | } |
| | 194 | | } |
| | 195 | | } |