internal static JobProperties DeserializeJobProperties(JsonElement element) { Optional <string> jobId = default; Optional <DateTimeOffset> startTimeUtc = default; Optional <DateTimeOffset> endTimeUtc = default; Optional <JobPropertiesType> type = default; Optional <JobPropertiesStatus> status = default; Optional <int> progress = default; Optional <string> inputBlobContainerUri = default; Optional <string> inputBlobName = default; Optional <string> outputBlobContainerUri = default; Optional <string> outputBlobName = default; Optional <bool> excludeKeysInExport = default; Optional <JobPropertiesStorageAuthenticationType> storageAuthenticationType = default; Optional <string> failureReason = default; Optional <bool> includeConfigurations = default; Optional <string> configurationsBlobName = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobId")) { jobId = property.Value.GetString(); continue; } if (property.NameEquals("startTimeUtc")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } startTimeUtc = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("endTimeUtc")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } endTimeUtc = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new JobPropertiesType(property.Value.GetString()); continue; } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } status = new JobPropertiesStatus(property.Value.GetString()); continue; } if (property.NameEquals("progress")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } progress = property.Value.GetInt32(); continue; } if (property.NameEquals("inputBlobContainerUri")) { inputBlobContainerUri = property.Value.GetString(); continue; } if (property.NameEquals("inputBlobName")) { inputBlobName = property.Value.GetString(); continue; } if (property.NameEquals("outputBlobContainerUri")) { outputBlobContainerUri = property.Value.GetString(); continue; } if (property.NameEquals("outputBlobName")) { outputBlobName = property.Value.GetString(); continue; } if (property.NameEquals("excludeKeysInExport")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } excludeKeysInExport = property.Value.GetBoolean(); continue; } if (property.NameEquals("storageAuthenticationType")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } storageAuthenticationType = new JobPropertiesStorageAuthenticationType(property.Value.GetString()); continue; } if (property.NameEquals("failureReason")) { failureReason = property.Value.GetString(); continue; } if (property.NameEquals("includeConfigurations")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } includeConfigurations = property.Value.GetBoolean(); continue; } if (property.NameEquals("configurationsBlobName")) { configurationsBlobName = property.Value.GetString(); continue; } } return(new JobProperties(jobId.Value, Optional.ToNullable(startTimeUtc), Optional.ToNullable(endTimeUtc), Optional.ToNullable(type), Optional.ToNullable(status), Optional.ToNullable(progress), inputBlobContainerUri.Value, inputBlobName.Value, outputBlobContainerUri.Value, outputBlobName.Value, Optional.ToNullable(excludeKeysInExport), Optional.ToNullable(storageAuthenticationType), failureReason.Value, Optional.ToNullable(includeConfigurations), configurationsBlobName.Value)); }
internal static JobProperties DeserializeJobProperties(JsonElement element) { string jobId = default; DateTimeOffset? startTimeUtc = default; DateTimeOffset? endTimeUtc = default; JobPropertiesType? type = default; JobPropertiesStatus?status = default; int? progress = default; string inputBlobContainerUri = default; string inputBlobName = default; string outputBlobContainerUri = default; string outputBlobName = default; bool? excludeKeysInExport = default; JobPropertiesStorageAuthenticationType?storageAuthenticationType = default; string failureReason = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("jobId")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } jobId = property.Value.GetString(); continue; } if (property.NameEquals("startTimeUtc")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } startTimeUtc = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("endTimeUtc")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } endTimeUtc = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = new JobPropertiesType(property.Value.GetString()); continue; } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } status = new JobPropertiesStatus(property.Value.GetString()); continue; } if (property.NameEquals("progress")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } progress = property.Value.GetInt32(); continue; } if (property.NameEquals("inputBlobContainerUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } inputBlobContainerUri = property.Value.GetString(); continue; } if (property.NameEquals("inputBlobName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } inputBlobName = property.Value.GetString(); continue; } if (property.NameEquals("outputBlobContainerUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } outputBlobContainerUri = property.Value.GetString(); continue; } if (property.NameEquals("outputBlobName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } outputBlobName = property.Value.GetString(); continue; } if (property.NameEquals("excludeKeysInExport")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } excludeKeysInExport = property.Value.GetBoolean(); continue; } if (property.NameEquals("storageAuthenticationType")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } storageAuthenticationType = new JobPropertiesStorageAuthenticationType(property.Value.GetString()); continue; } if (property.NameEquals("failureReason")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } failureReason = property.Value.GetString(); continue; } } return(new JobProperties(jobId, startTimeUtc, endTimeUtc, type, status, progress, inputBlobContainerUri, inputBlobName, outputBlobContainerUri, outputBlobName, excludeKeysInExport, storageAuthenticationType, failureReason)); }