| | 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.EventHubs.Models |
| | 12 | | { |
| | 13 | | public partial class Destination : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 8 | 17 | | writer.WriteStartObject(); |
| 8 | 18 | | if (Name != null) |
| | 19 | | { |
| 8 | 20 | | writer.WritePropertyName("name"); |
| 8 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 8 | 23 | | writer.WritePropertyName("properties"); |
| 8 | 24 | | writer.WriteStartObject(); |
| 8 | 25 | | if (StorageAccountResourceId != null) |
| | 26 | | { |
| 8 | 27 | | writer.WritePropertyName("storageAccountResourceId"); |
| 8 | 28 | | writer.WriteStringValue(StorageAccountResourceId); |
| | 29 | | } |
| 8 | 30 | | if (BlobContainer != null) |
| | 31 | | { |
| 8 | 32 | | writer.WritePropertyName("blobContainer"); |
| 8 | 33 | | writer.WriteStringValue(BlobContainer); |
| | 34 | | } |
| 8 | 35 | | if (ArchiveNameFormat != null) |
| | 36 | | { |
| 8 | 37 | | writer.WritePropertyName("archiveNameFormat"); |
| 8 | 38 | | writer.WriteStringValue(ArchiveNameFormat); |
| | 39 | | } |
| 8 | 40 | | writer.WriteEndObject(); |
| 8 | 41 | | writer.WriteEndObject(); |
| 8 | 42 | | } |
| | 43 | |
|
| | 44 | | internal static Destination DeserializeDestination(JsonElement element) |
| | 45 | | { |
| 20 | 46 | | string name = default; |
| 20 | 47 | | string storageAccountResourceId = default; |
| 20 | 48 | | string blobContainer = default; |
| 20 | 49 | | string archiveNameFormat = default; |
| 120 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 40 | 52 | | if (property.NameEquals("name")) |
| | 53 | | { |
| 20 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 20 | 58 | | name = property.Value.GetString(); |
| 20 | 59 | | continue; |
| | 60 | | } |
| 20 | 61 | | if (property.NameEquals("properties")) |
| | 62 | | { |
| 160 | 63 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 64 | | { |
| 60 | 65 | | if (property0.NameEquals("storageAccountResourceId")) |
| | 66 | | { |
| 20 | 67 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 20 | 71 | | storageAccountResourceId = property0.Value.GetString(); |
| 20 | 72 | | continue; |
| | 73 | | } |
| 40 | 74 | | if (property0.NameEquals("blobContainer")) |
| | 75 | | { |
| 20 | 76 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 20 | 80 | | blobContainer = property0.Value.GetString(); |
| 20 | 81 | | continue; |
| | 82 | | } |
| 20 | 83 | | if (property0.NameEquals("archiveNameFormat")) |
| | 84 | | { |
| 20 | 85 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 20 | 89 | | archiveNameFormat = property0.Value.GetString(); |
| | 90 | | continue; |
| | 91 | | } |
| | 92 | | } |
| | 93 | | continue; |
| | 94 | | } |
| | 95 | | } |
| 20 | 96 | | return new Destination(name, storageAccountResourceId, blobContainer, archiveNameFormat); |
| | 97 | | } |
| | 98 | | } |
| | 99 | | } |