| | | 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.Network.Models |
| | | 12 | | { |
| | | 13 | | public partial class BastionShareableLink : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 0 | 17 | | writer.WriteStartObject(); |
| | 0 | 18 | | writer.WritePropertyName("vm"); |
| | 0 | 19 | | writer.WriteObjectValue(Vm); |
| | 0 | 20 | | if (Bsl != null) |
| | | 21 | | { |
| | 0 | 22 | | writer.WritePropertyName("bsl"); |
| | 0 | 23 | | writer.WriteStringValue(Bsl); |
| | | 24 | | } |
| | 0 | 25 | | if (CreatedAt != null) |
| | | 26 | | { |
| | 0 | 27 | | writer.WritePropertyName("createdAt"); |
| | 0 | 28 | | writer.WriteStringValue(CreatedAt); |
| | | 29 | | } |
| | 0 | 30 | | if (Message != null) |
| | | 31 | | { |
| | 0 | 32 | | writer.WritePropertyName("message"); |
| | 0 | 33 | | writer.WriteStringValue(Message); |
| | | 34 | | } |
| | 0 | 35 | | writer.WriteEndObject(); |
| | 0 | 36 | | } |
| | | 37 | | |
| | | 38 | | internal static BastionShareableLink DeserializeBastionShareableLink(JsonElement element) |
| | | 39 | | { |
| | 0 | 40 | | Resource vm = default; |
| | 0 | 41 | | string bsl = default; |
| | 0 | 42 | | string createdAt = default; |
| | 0 | 43 | | string message = default; |
| | 0 | 44 | | foreach (var property in element.EnumerateObject()) |
| | | 45 | | { |
| | 0 | 46 | | if (property.NameEquals("vm")) |
| | | 47 | | { |
| | 0 | 48 | | vm = Resource.DeserializeResource(property.Value); |
| | 0 | 49 | | continue; |
| | | 50 | | } |
| | 0 | 51 | | if (property.NameEquals("bsl")) |
| | | 52 | | { |
| | 0 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 54 | | { |
| | | 55 | | continue; |
| | | 56 | | } |
| | 0 | 57 | | bsl = property.Value.GetString(); |
| | 0 | 58 | | continue; |
| | | 59 | | } |
| | 0 | 60 | | if (property.NameEquals("createdAt")) |
| | | 61 | | { |
| | 0 | 62 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 63 | | { |
| | | 64 | | continue; |
| | | 65 | | } |
| | 0 | 66 | | createdAt = property.Value.GetString(); |
| | 0 | 67 | | continue; |
| | | 68 | | } |
| | 0 | 69 | | if (property.NameEquals("message")) |
| | | 70 | | { |
| | 0 | 71 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 72 | | { |
| | | 73 | | continue; |
| | | 74 | | } |
| | 0 | 75 | | message = property.Value.GetString(); |
| | | 76 | | continue; |
| | | 77 | | } |
| | | 78 | | } |
| | 0 | 79 | | return new BastionShareableLink(vm, bsl, createdAt, message); |
| | | 80 | | } |
| | | 81 | | } |
| | | 82 | | } |