| | 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 IotHubDeviceConnectedEventData |
| | 14 | | { |
| | 15 | | internal static IotHubDeviceConnectedEventData DeserializeIotHubDeviceConnectedEventData(JsonElement element) |
| | 16 | | { |
| 2 | 17 | | Optional<string> deviceId = default; |
| 2 | 18 | | Optional<string> moduleId = default; |
| 2 | 19 | | Optional<string> hubName = default; |
| 2 | 20 | | Optional<DeviceConnectionStateEventInfo> deviceConnectionStateEventInfo = default; |
| 20 | 21 | | foreach (var property in element.EnumerateObject()) |
| | 22 | | { |
| 8 | 23 | | if (property.NameEquals("deviceId")) |
| | 24 | | { |
| 2 | 25 | | deviceId = property.Value.GetString(); |
| 2 | 26 | | continue; |
| | 27 | | } |
| 6 | 28 | | if (property.NameEquals("moduleId")) |
| | 29 | | { |
| 2 | 30 | | moduleId = property.Value.GetString(); |
| 2 | 31 | | continue; |
| | 32 | | } |
| 4 | 33 | | if (property.NameEquals("hubName")) |
| | 34 | | { |
| 2 | 35 | | hubName = property.Value.GetString(); |
| 2 | 36 | | continue; |
| | 37 | | } |
| 2 | 38 | | if (property.NameEquals("deviceConnectionStateEventInfo")) |
| | 39 | | { |
| 2 | 40 | | deviceConnectionStateEventInfo = DeviceConnectionStateEventInfo.DeserializeDeviceConnectionStateEven |
| | 41 | | continue; |
| | 42 | | } |
| | 43 | | } |
| 2 | 44 | | return new IotHubDeviceConnectedEventData(deviceId.Value, moduleId.Value, hubName.Value, deviceConnectionSta |
| | 45 | | } |
| | 46 | | } |
| | 47 | | } |