| | 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 FlowLog : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Etag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("etag"); |
| 0 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 0 | 24 | | if (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 0 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 0 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 0 | 39 | | if (Location != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("location"); |
| 0 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 0 | 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 | | } |
| 0 | 55 | | writer.WritePropertyName("properties"); |
| 0 | 56 | | writer.WriteStartObject(); |
| 0 | 57 | | if (TargetResourceId != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("targetResourceId"); |
| 0 | 60 | | writer.WriteStringValue(TargetResourceId); |
| | 61 | | } |
| 0 | 62 | | if (TargetResourceGuid != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("targetResourceGuid"); |
| 0 | 65 | | writer.WriteStringValue(TargetResourceGuid); |
| | 66 | | } |
| 0 | 67 | | if (StorageId != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("storageId"); |
| 0 | 70 | | writer.WriteStringValue(StorageId); |
| | 71 | | } |
| 0 | 72 | | if (Enabled != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("enabled"); |
| 0 | 75 | | writer.WriteBooleanValue(Enabled.Value); |
| | 76 | | } |
| 0 | 77 | | if (RetentionPolicy != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("retentionPolicy"); |
| 0 | 80 | | writer.WriteObjectValue(RetentionPolicy); |
| | 81 | | } |
| 0 | 82 | | if (Format != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("format"); |
| 0 | 85 | | writer.WriteObjectValue(Format); |
| | 86 | | } |
| 0 | 87 | | if (FlowAnalyticsConfiguration != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("flowAnalyticsConfiguration"); |
| 0 | 90 | | writer.WriteObjectValue(FlowAnalyticsConfiguration); |
| | 91 | | } |
| 0 | 92 | | if (ProvisioningState != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("provisioningState"); |
| 0 | 95 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 96 | | } |
| 0 | 97 | | writer.WriteEndObject(); |
| 0 | 98 | | writer.WriteEndObject(); |
| 0 | 99 | | } |
| | 100 | |
|
| | 101 | | internal static FlowLog DeserializeFlowLog(JsonElement element) |
| | 102 | | { |
| 0 | 103 | | string etag = default; |
| 0 | 104 | | string id = default; |
| 0 | 105 | | string name = default; |
| 0 | 106 | | string type = default; |
| 0 | 107 | | string location = default; |
| 0 | 108 | | IDictionary<string, string> tags = default; |
| 0 | 109 | | string targetResourceId = default; |
| 0 | 110 | | string targetResourceGuid = default; |
| 0 | 111 | | string storageId = default; |
| 0 | 112 | | bool? enabled = default; |
| 0 | 113 | | RetentionPolicyParameters retentionPolicy = default; |
| 0 | 114 | | FlowLogFormatParameters format = default; |
| 0 | 115 | | TrafficAnalyticsProperties flowAnalyticsConfiguration = default; |
| 0 | 116 | | ProvisioningState? provisioningState = default; |
| 0 | 117 | | foreach (var property in element.EnumerateObject()) |
| | 118 | | { |
| 0 | 119 | | if (property.NameEquals("etag")) |
| | 120 | | { |
| 0 | 121 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| | 123 | | continue; |
| | 124 | | } |
| 0 | 125 | | etag = property.Value.GetString(); |
| 0 | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | if (property.NameEquals("id")) |
| | 129 | | { |
| 0 | 130 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 131 | | { |
| | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | id = property.Value.GetString(); |
| 0 | 135 | | continue; |
| | 136 | | } |
| 0 | 137 | | if (property.NameEquals("name")) |
| | 138 | | { |
| 0 | 139 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 140 | | { |
| | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | name = property.Value.GetString(); |
| 0 | 144 | | continue; |
| | 145 | | } |
| 0 | 146 | | if (property.NameEquals("type")) |
| | 147 | | { |
| 0 | 148 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 149 | | { |
| | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | type = property.Value.GetString(); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property.NameEquals("location")) |
| | 156 | | { |
| 0 | 157 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 158 | | { |
| | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | location = property.Value.GetString(); |
| 0 | 162 | | continue; |
| | 163 | | } |
| 0 | 164 | | if (property.NameEquals("tags")) |
| | 165 | | { |
| 0 | 166 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 171 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 172 | | { |
| 0 | 173 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | dictionary.Add(property0.Name, null); |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 0 | 179 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 180 | | } |
| | 181 | | } |
| 0 | 182 | | tags = dictionary; |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property.NameEquals("properties")) |
| | 186 | | { |
| 0 | 187 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 188 | | { |
| 0 | 189 | | if (property0.NameEquals("targetResourceId")) |
| | 190 | | { |
| 0 | 191 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 192 | | { |
| | 193 | | continue; |
| | 194 | | } |
| 0 | 195 | | targetResourceId = property0.Value.GetString(); |
| 0 | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | if (property0.NameEquals("targetResourceGuid")) |
| | 199 | | { |
| 0 | 200 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| | 202 | | continue; |
| | 203 | | } |
| 0 | 204 | | targetResourceGuid = property0.Value.GetString(); |
| 0 | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | if (property0.NameEquals("storageId")) |
| | 208 | | { |
| 0 | 209 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| | 211 | | continue; |
| | 212 | | } |
| 0 | 213 | | storageId = property0.Value.GetString(); |
| 0 | 214 | | continue; |
| | 215 | | } |
| 0 | 216 | | if (property0.NameEquals("enabled")) |
| | 217 | | { |
| 0 | 218 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| | 220 | | continue; |
| | 221 | | } |
| 0 | 222 | | enabled = property0.Value.GetBoolean(); |
| 0 | 223 | | continue; |
| | 224 | | } |
| 0 | 225 | | if (property0.NameEquals("retentionPolicy")) |
| | 226 | | { |
| 0 | 227 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| | 229 | | continue; |
| | 230 | | } |
| 0 | 231 | | retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.V |
| 0 | 232 | | continue; |
| | 233 | | } |
| 0 | 234 | | if (property0.NameEquals("format")) |
| | 235 | | { |
| 0 | 236 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 237 | | { |
| | 238 | | continue; |
| | 239 | | } |
| 0 | 240 | | format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value); |
| 0 | 241 | | continue; |
| | 242 | | } |
| 0 | 243 | | if (property0.NameEquals("flowAnalyticsConfiguration")) |
| | 244 | | { |
| 0 | 245 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 246 | | { |
| | 247 | | continue; |
| | 248 | | } |
| 0 | 249 | | flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsPropertie |
| 0 | 250 | | continue; |
| | 251 | | } |
| 0 | 252 | | if (property0.NameEquals("provisioningState")) |
| | 253 | | { |
| 0 | 254 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 255 | | { |
| | 256 | | continue; |
| | 257 | | } |
| 0 | 258 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 259 | | continue; |
| | 260 | | } |
| | 261 | | } |
| | 262 | | continue; |
| | 263 | | } |
| | 264 | | } |
| 0 | 265 | | return new FlowLog(id, name, type, location, tags, etag, targetResourceId, targetResourceGuid, storageId, en |
| | 266 | | } |
| | 267 | | } |
| | 268 | | } |