| | | 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 FlowLogInformation : IUtf8JsonSerializable |
| | | 14 | | { |
| | | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 16 | | { |
| | 0 | 17 | | writer.WriteStartObject(); |
| | 0 | 18 | | writer.WritePropertyName("targetResourceId"); |
| | 0 | 19 | | writer.WriteStringValue(TargetResourceId); |
| | 0 | 20 | | if (FlowAnalyticsConfiguration != null) |
| | | 21 | | { |
| | 0 | 22 | | writer.WritePropertyName("flowAnalyticsConfiguration"); |
| | 0 | 23 | | writer.WriteObjectValue(FlowAnalyticsConfiguration); |
| | | 24 | | } |
| | 0 | 25 | | writer.WritePropertyName("properties"); |
| | 0 | 26 | | writer.WriteStartObject(); |
| | 0 | 27 | | writer.WritePropertyName("storageId"); |
| | 0 | 28 | | writer.WriteStringValue(StorageId); |
| | 0 | 29 | | writer.WritePropertyName("enabled"); |
| | 0 | 30 | | writer.WriteBooleanValue(Enabled); |
| | 0 | 31 | | if (RetentionPolicy != null) |
| | | 32 | | { |
| | 0 | 33 | | writer.WritePropertyName("retentionPolicy"); |
| | 0 | 34 | | writer.WriteObjectValue(RetentionPolicy); |
| | | 35 | | } |
| | 0 | 36 | | if (Format != null) |
| | | 37 | | { |
| | 0 | 38 | | writer.WritePropertyName("format"); |
| | 0 | 39 | | writer.WriteObjectValue(Format); |
| | | 40 | | } |
| | 0 | 41 | | writer.WriteEndObject(); |
| | 0 | 42 | | writer.WriteEndObject(); |
| | 0 | 43 | | } |
| | | 44 | | |
| | | 45 | | internal static FlowLogInformation DeserializeFlowLogInformation(JsonElement element) |
| | | 46 | | { |
| | 0 | 47 | | string targetResourceId = default; |
| | 0 | 48 | | TrafficAnalyticsProperties flowAnalyticsConfiguration = default; |
| | 0 | 49 | | string storageId = default; |
| | 0 | 50 | | bool enabled = default; |
| | 0 | 51 | | RetentionPolicyParameters retentionPolicy = default; |
| | 0 | 52 | | FlowLogFormatParameters format = default; |
| | 0 | 53 | | foreach (var property in element.EnumerateObject()) |
| | | 54 | | { |
| | 0 | 55 | | if (property.NameEquals("targetResourceId")) |
| | | 56 | | { |
| | 0 | 57 | | targetResourceId = property.Value.GetString(); |
| | 0 | 58 | | continue; |
| | | 59 | | } |
| | 0 | 60 | | if (property.NameEquals("flowAnalyticsConfiguration")) |
| | | 61 | | { |
| | 0 | 62 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 63 | | { |
| | | 64 | | continue; |
| | | 65 | | } |
| | 0 | 66 | | flowAnalyticsConfiguration = TrafficAnalyticsProperties.DeserializeTrafficAnalyticsProperties(proper |
| | 0 | 67 | | continue; |
| | | 68 | | } |
| | 0 | 69 | | if (property.NameEquals("properties")) |
| | | 70 | | { |
| | 0 | 71 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 72 | | { |
| | 0 | 73 | | if (property0.NameEquals("storageId")) |
| | | 74 | | { |
| | 0 | 75 | | storageId = property0.Value.GetString(); |
| | 0 | 76 | | continue; |
| | | 77 | | } |
| | 0 | 78 | | if (property0.NameEquals("enabled")) |
| | | 79 | | { |
| | 0 | 80 | | enabled = property0.Value.GetBoolean(); |
| | 0 | 81 | | continue; |
| | | 82 | | } |
| | 0 | 83 | | if (property0.NameEquals("retentionPolicy")) |
| | | 84 | | { |
| | 0 | 85 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 86 | | { |
| | | 87 | | continue; |
| | | 88 | | } |
| | 0 | 89 | | retentionPolicy = RetentionPolicyParameters.DeserializeRetentionPolicyParameters(property0.V |
| | 0 | 90 | | continue; |
| | | 91 | | } |
| | 0 | 92 | | if (property0.NameEquals("format")) |
| | | 93 | | { |
| | 0 | 94 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 95 | | { |
| | | 96 | | continue; |
| | | 97 | | } |
| | 0 | 98 | | format = FlowLogFormatParameters.DeserializeFlowLogFormatParameters(property0.Value); |
| | | 99 | | continue; |
| | | 100 | | } |
| | | 101 | | } |
| | | 102 | | continue; |
| | | 103 | | } |
| | | 104 | | } |
| | 0 | 105 | | return new FlowLogInformation(targetResourceId, flowAnalyticsConfiguration, storageId, enabled, retentionPol |
| | | 106 | | } |
| | | 107 | | } |
| | | 108 | | } |