internal static Eventhub DeserializeEventhub(JsonElement element) { Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <IReadOnlyList <string> > partitionIds = default; Optional <DateTimeOffset> createdAt = default; Optional <DateTimeOffset> updatedAt = default; Optional <long> messageRetentionInDays = default; Optional <long> partitionCount = default; Optional <EntityStatus> status = default; Optional <CaptureDescription> captureDescription = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("partitionIds")) { List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } partitionIds = array; continue; } if (property0.NameEquals("createdAt")) { createdAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("updatedAt")) { updatedAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("messageRetentionInDays")) { messageRetentionInDays = property0.Value.GetInt64(); continue; } if (property0.NameEquals("partitionCount")) { partitionCount = property0.Value.GetInt64(); continue; } if (property0.NameEquals("status")) { status = property0.Value.GetString().ToEntityStatus(); continue; } if (property0.NameEquals("captureDescription")) { captureDescription = CaptureDescription.DeserializeCaptureDescription(property0.Value); continue; } } continue; } } return(new Eventhub(id.Value, name.Value, type.Value, Optional.ToList(partitionIds), Optional.ToNullable(createdAt), Optional.ToNullable(updatedAt), Optional.ToNullable(messageRetentionInDays), Optional.ToNullable(partitionCount), Optional.ToNullable(status), captureDescription.Value)); }
internal static Eventhub DeserializeEventhub(JsonElement element) { string id = default; string name = default; string type = default; IList <string> partitionIds = default; DateTimeOffset? createdAt = default; DateTimeOffset? updatedAt = default; long? messageRetentionInDays = default; long? partitionCount = default; EntityStatus? status = default; CaptureDescription captureDescription = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("partitionIds")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(item.GetString()); } } partitionIds = array; continue; } if (property0.NameEquals("createdAt")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } createdAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("updatedAt")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } updatedAt = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("messageRetentionInDays")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } messageRetentionInDays = property0.Value.GetInt64(); continue; } if (property0.NameEquals("partitionCount")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } partitionCount = property0.Value.GetInt64(); continue; } if (property0.NameEquals("status")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } status = property0.Value.GetString().ToEntityStatus(); continue; } if (property0.NameEquals("captureDescription")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } captureDescription = CaptureDescription.DeserializeCaptureDescription(property0.Value); continue; } } continue; } } return(new Eventhub(id, name, type, partitionIds, createdAt, updatedAt, messageRetentionInDays, partitionCount, status, captureDescription)); }