| | 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 BastionActiveSession |
| | 14 | | { |
| | 15 | | internal static BastionActiveSession DeserializeBastionActiveSession(JsonElement element) |
| | 16 | | { |
| 0 | 17 | | string sessionId = default; |
| 0 | 18 | | object startTime = default; |
| 0 | 19 | | string targetSubscriptionId = default; |
| 0 | 20 | | string resourceType = default; |
| 0 | 21 | | string targetHostName = default; |
| 0 | 22 | | string targetResourceGroup = default; |
| 0 | 23 | | string userName = default; |
| 0 | 24 | | string targetIpAddress = default; |
| 0 | 25 | | BastionConnectProtocol? protocol = default; |
| 0 | 26 | | string targetResourceId = default; |
| 0 | 27 | | float? sessionDurationInMins = default; |
| 0 | 28 | | foreach (var property in element.EnumerateObject()) |
| | 29 | | { |
| 0 | 30 | | if (property.NameEquals("sessionId")) |
| | 31 | | { |
| 0 | 32 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 33 | | { |
| | 34 | | continue; |
| | 35 | | } |
| 0 | 36 | | sessionId = property.Value.GetString(); |
| 0 | 37 | | continue; |
| | 38 | | } |
| 0 | 39 | | if (property.NameEquals("startTime")) |
| | 40 | | { |
| 0 | 41 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 42 | | { |
| | 43 | | continue; |
| | 44 | | } |
| 0 | 45 | | startTime = property.Value.GetObject(); |
| 0 | 46 | | continue; |
| | 47 | | } |
| 0 | 48 | | if (property.NameEquals("targetSubscriptionId")) |
| | 49 | | { |
| 0 | 50 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 51 | | { |
| | 52 | | continue; |
| | 53 | | } |
| 0 | 54 | | targetSubscriptionId = property.Value.GetString(); |
| 0 | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | if (property.NameEquals("resourceType")) |
| | 58 | | { |
| 0 | 59 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 60 | | { |
| | 61 | | continue; |
| | 62 | | } |
| 0 | 63 | | resourceType = property.Value.GetString(); |
| 0 | 64 | | continue; |
| | 65 | | } |
| 0 | 66 | | if (property.NameEquals("targetHostName")) |
| | 67 | | { |
| 0 | 68 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 69 | | { |
| | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | targetHostName = property.Value.GetString(); |
| 0 | 73 | | continue; |
| | 74 | | } |
| 0 | 75 | | if (property.NameEquals("targetResourceGroup")) |
| | 76 | | { |
| 0 | 77 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 78 | | { |
| | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | targetResourceGroup = property.Value.GetString(); |
| 0 | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | if (property.NameEquals("userName")) |
| | 85 | | { |
| 0 | 86 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 87 | | { |
| | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | userName = property.Value.GetString(); |
| 0 | 91 | | continue; |
| | 92 | | } |
| 0 | 93 | | if (property.NameEquals("targetIpAddress")) |
| | 94 | | { |
| 0 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | targetIpAddress = property.Value.GetString(); |
| 0 | 100 | | continue; |
| | 101 | | } |
| 0 | 102 | | if (property.NameEquals("protocol")) |
| | 103 | | { |
| 0 | 104 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 105 | | { |
| | 106 | | continue; |
| | 107 | | } |
| 0 | 108 | | protocol = new BastionConnectProtocol(property.Value.GetString()); |
| 0 | 109 | | continue; |
| | 110 | | } |
| 0 | 111 | | if (property.NameEquals("targetResourceId")) |
| | 112 | | { |
| 0 | 113 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 114 | | { |
| | 115 | | continue; |
| | 116 | | } |
| 0 | 117 | | targetResourceId = property.Value.GetString(); |
| 0 | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | if (property.NameEquals("sessionDurationInMins")) |
| | 121 | | { |
| 0 | 122 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| | 124 | | continue; |
| | 125 | | } |
| 0 | 126 | | sessionDurationInMins = property.Value.GetSingle(); |
| | 127 | | continue; |
| | 128 | | } |
| | 129 | | } |
| 0 | 130 | | return new BastionActiveSession(sessionId, startTime, targetSubscriptionId, resourceType, targetHostName, ta |
| | 131 | | } |
| | 132 | | } |
| | 133 | | } |