| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Messaging.EventGrid.SystemEvents |
| | 12 | | { |
| | 13 | | public partial class IotHubDeviceCreatedEventData |
| | 14 | | { |
| | 15 | | internal static IotHubDeviceCreatedEventData DeserializeIotHubDeviceCreatedEventData(JsonElement element) |
| | 16 | | { |
| 2 | 17 | | Optional<string> deviceId = default; |
| 2 | 18 | | Optional<string> hubName = default; |
| 2 | 19 | | Optional<DeviceTwinInfo> twin = default; |
| 16 | 20 | | foreach (var property in element.EnumerateObject()) |
| | 21 | | { |
| 6 | 22 | | if (property.NameEquals("deviceId")) |
| | 23 | | { |
| 2 | 24 | | deviceId = property.Value.GetString(); |
| 2 | 25 | | continue; |
| | 26 | | } |
| 4 | 27 | | if (property.NameEquals("hubName")) |
| | 28 | | { |
| 2 | 29 | | hubName = property.Value.GetString(); |
| 2 | 30 | | continue; |
| | 31 | | } |
| 2 | 32 | | if (property.NameEquals("twin")) |
| | 33 | | { |
| 2 | 34 | | twin = DeviceTwinInfo.DeserializeDeviceTwinInfo(property.Value); |
| | 35 | | continue; |
| | 36 | | } |
| | 37 | | } |
| 2 | 38 | | return new IotHubDeviceCreatedEventData(deviceId.Value, hubName.Value, twin.Value); |
| | 39 | | } |
| | 40 | | } |
| | 41 | | } |