| | 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.ResourceManager.DigitalTwins.Models |
| | 12 | | { |
| | 13 | | public partial class DigitalTwinsEndpointResource : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Optional.IsDefined(Properties)) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("properties"); |
| 0 | 21 | | writer.WriteObjectValue(Properties); |
| | 22 | | } |
| 0 | 23 | | writer.WriteEndObject(); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | internal static DigitalTwinsEndpointResource DeserializeDigitalTwinsEndpointResource(JsonElement element) |
| | 27 | | { |
| 0 | 28 | | Optional<DigitalTwinsEndpointResourceProperties> properties = default; |
| 0 | 29 | | Optional<string> id = default; |
| 0 | 30 | | Optional<string> name = default; |
| 0 | 31 | | Optional<string> type = default; |
| 0 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 0 | 34 | | if (property.NameEquals("properties")) |
| | 35 | | { |
| 0 | 36 | | properties = DigitalTwinsEndpointResourceProperties.DeserializeDigitalTwinsEndpointResourcePropertie |
| 0 | 37 | | continue; |
| | 38 | | } |
| 0 | 39 | | if (property.NameEquals("id")) |
| | 40 | | { |
| 0 | 41 | | id = property.Value.GetString(); |
| 0 | 42 | | continue; |
| | 43 | | } |
| 0 | 44 | | if (property.NameEquals("name")) |
| | 45 | | { |
| 0 | 46 | | name = property.Value.GetString(); |
| 0 | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | if (property.NameEquals("type")) |
| | 50 | | { |
| 0 | 51 | | type = property.Value.GetString(); |
| | 52 | | continue; |
| | 53 | | } |
| | 54 | | } |
| 0 | 55 | | return new DigitalTwinsEndpointResource(id.Value, name.Value, type.Value, properties.Value); |
| | 56 | | } |
| | 57 | | } |
| | 58 | | } |