| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Network.Models |
| | 13 | | { |
| | 14 | | public partial class NetworkWatcher : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 4 | 18 | | writer.WriteStartObject(); |
| 4 | 19 | | if (Etag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("etag"); |
| 0 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 4 | 24 | | if (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 4 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 4 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 4 | 39 | | if (Location != null) |
| | 40 | | { |
| 4 | 41 | | writer.WritePropertyName("location"); |
| 4 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 4 | 44 | | if (Tags != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("tags"); |
| 0 | 47 | | writer.WriteStartObject(); |
| 0 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName(item.Key); |
| 0 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 4 | 55 | | writer.WritePropertyName("properties"); |
| 4 | 56 | | writer.WriteStartObject(); |
| 4 | 57 | | if (ProvisioningState != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("provisioningState"); |
| 0 | 60 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 61 | | } |
| 4 | 62 | | writer.WriteEndObject(); |
| 4 | 63 | | writer.WriteEndObject(); |
| 4 | 64 | | } |
| | 65 | |
|
| | 66 | | internal static NetworkWatcher DeserializeNetworkWatcher(JsonElement element) |
| | 67 | | { |
| 64 | 68 | | string etag = default; |
| 64 | 69 | | string id = default; |
| 64 | 70 | | string name = default; |
| 64 | 71 | | string type = default; |
| 64 | 72 | | string location = default; |
| 64 | 73 | | IDictionary<string, string> tags = default; |
| 64 | 74 | | ProvisioningState? provisioningState = default; |
| 896 | 75 | | foreach (var property in element.EnumerateObject()) |
| | 76 | | { |
| 384 | 77 | | if (property.NameEquals("etag")) |
| | 78 | | { |
| 64 | 79 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 80 | | { |
| | 81 | | continue; |
| | 82 | | } |
| 64 | 83 | | etag = property.Value.GetString(); |
| 64 | 84 | | continue; |
| | 85 | | } |
| 320 | 86 | | if (property.NameEquals("id")) |
| | 87 | | { |
| 64 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 64 | 92 | | id = property.Value.GetString(); |
| 64 | 93 | | continue; |
| | 94 | | } |
| 256 | 95 | | if (property.NameEquals("name")) |
| | 96 | | { |
| 64 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 64 | 101 | | name = property.Value.GetString(); |
| 64 | 102 | | continue; |
| | 103 | | } |
| 192 | 104 | | if (property.NameEquals("type")) |
| | 105 | | { |
| 64 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 64 | 110 | | type = property.Value.GetString(); |
| 64 | 111 | | continue; |
| | 112 | | } |
| 128 | 113 | | if (property.NameEquals("location")) |
| | 114 | | { |
| 64 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 64 | 119 | | location = property.Value.GetString(); |
| 64 | 120 | | continue; |
| | 121 | | } |
| 64 | 122 | | if (property.NameEquals("tags")) |
| | 123 | | { |
| 0 | 124 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 129 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 130 | | { |
| 0 | 131 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 132 | | { |
| 0 | 133 | | dictionary.Add(property0.Name, null); |
| | 134 | | } |
| | 135 | | else |
| | 136 | | { |
| 0 | 137 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 138 | | } |
| | 139 | | } |
| 0 | 140 | | tags = dictionary; |
| 0 | 141 | | continue; |
| | 142 | | } |
| 64 | 143 | | if (property.NameEquals("properties")) |
| | 144 | | { |
| 384 | 145 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 146 | | { |
| 128 | 147 | | if (property0.NameEquals("provisioningState")) |
| | 148 | | { |
| 64 | 149 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 64 | 153 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 154 | | continue; |
| | 155 | | } |
| | 156 | | } |
| | 157 | | continue; |
| | 158 | | } |
| | 159 | | } |
| 64 | 160 | | return new NetworkWatcher(id, name, type, location, tags, etag, provisioningState); |
| | 161 | | } |
| | 162 | | } |
| | 163 | | } |