| | 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.Iot.Hub.Service.Models |
| | 12 | | { |
| | 13 | | public partial class SymmetricKey : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 40 | 17 | | writer.WriteStartObject(); |
| 40 | 18 | | if (Optional.IsDefined(PrimaryKey)) |
| | 19 | | { |
| 40 | 20 | | writer.WritePropertyName("primaryKey"); |
| 40 | 21 | | writer.WriteStringValue(PrimaryKey); |
| | 22 | | } |
| 40 | 23 | | if (Optional.IsDefined(SecondaryKey)) |
| | 24 | | { |
| 40 | 25 | | writer.WritePropertyName("secondaryKey"); |
| 40 | 26 | | writer.WriteStringValue(SecondaryKey); |
| | 27 | | } |
| 40 | 28 | | writer.WriteEndObject(); |
| 40 | 29 | | } |
| | 30 | |
|
| | 31 | | internal static SymmetricKey DeserializeSymmetricKey(JsonElement element) |
| | 32 | | { |
| 232 | 33 | | Optional<string> primaryKey = default; |
| 232 | 34 | | Optional<string> secondaryKey = default; |
| 1392 | 35 | | foreach (var property in element.EnumerateObject()) |
| | 36 | | { |
| 464 | 37 | | if (property.NameEquals("primaryKey")) |
| | 38 | | { |
| 232 | 39 | | primaryKey = property.Value.GetString(); |
| 232 | 40 | | continue; |
| | 41 | | } |
| 232 | 42 | | if (property.NameEquals("secondaryKey")) |
| | 43 | | { |
| 232 | 44 | | secondaryKey = property.Value.GetString(); |
| | 45 | | continue; |
| | 46 | | } |
| | 47 | | } |
| 232 | 48 | | return new SymmetricKey(primaryKey.Value, secondaryKey.Value); |
| | 49 | | } |
| | 50 | | } |
| | 51 | | } |