< Summary

Class:Azure.ResourceManager.Network.Models.PacketCaptureResultProperties
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureResultProperties.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureResultProperties.Serialization.cs
Covered lines:0
Uncovered lines:74
Coverable lines:74
Total lines:185
Line coverage:0% (0 of 74)
Covered branches:0
Total branches:46
Branch coverage:0% (0 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_ProvisioningState()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializePacketCaptureResultProperties(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureResultProperties.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Network.Models
 12{
 13    /// <summary> The properties of a packet capture session. </summary>
 14    public partial class PacketCaptureResultProperties : PacketCaptureParameters
 15    {
 16        /// <summary> Initializes a new instance of PacketCaptureResultProperties. </summary>
 17        /// <param name="target"> The ID of the targeted resource, only VM is currently supported. </param>
 18        /// <param name="storageLocation"> The storage location for a packet capture session. </param>
 019        public PacketCaptureResultProperties(string target, PacketCaptureStorageLocation storageLocation) : base(target,
 20        {
 021            if (target == null)
 22            {
 023                throw new ArgumentNullException(nameof(target));
 24            }
 025            if (storageLocation == null)
 26            {
 027                throw new ArgumentNullException(nameof(storageLocation));
 28            }
 029        }
 30
 31        /// <summary> Initializes a new instance of PacketCaptureResultProperties. </summary>
 32        /// <param name="target"> The ID of the targeted resource, only VM is currently supported. </param>
 33        /// <param name="bytesToCapturePerPacket"> Number of bytes captured per packet, the remaining bytes are truncate
 34        /// <param name="totalBytesPerSession"> Maximum size of the capture output. </param>
 35        /// <param name="timeLimitInSeconds"> Maximum duration of the capture session in seconds. </param>
 36        /// <param name="storageLocation"> The storage location for a packet capture session. </param>
 37        /// <param name="filters"> A list of packet capture filters. </param>
 38        /// <param name="provisioningState"> The provisioning state of the packet capture session. </param>
 039        internal PacketCaptureResultProperties(string target, int? bytesToCapturePerPacket, int? totalBytesPerSession, i
 40        {
 041            ProvisioningState = provisioningState;
 042        }
 43
 44        /// <summary> The provisioning state of the packet capture session. </summary>
 045        public ProvisioningState? ProvisioningState { get; }
 46    }
 47}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureResultProperties.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    public partial class PacketCaptureResultProperties : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (ProvisioningState != null)
 20            {
 021                writer.WritePropertyName("provisioningState");
 022                writer.WriteStringValue(ProvisioningState.Value.ToString());
 23            }
 024            writer.WritePropertyName("target");
 025            writer.WriteStringValue(Target);
 026            if (BytesToCapturePerPacket != null)
 27            {
 028                writer.WritePropertyName("bytesToCapturePerPacket");
 029                writer.WriteNumberValue(BytesToCapturePerPacket.Value);
 30            }
 031            if (TotalBytesPerSession != null)
 32            {
 033                writer.WritePropertyName("totalBytesPerSession");
 034                writer.WriteNumberValue(TotalBytesPerSession.Value);
 35            }
 036            if (TimeLimitInSeconds != null)
 37            {
 038                writer.WritePropertyName("timeLimitInSeconds");
 039                writer.WriteNumberValue(TimeLimitInSeconds.Value);
 40            }
 041            writer.WritePropertyName("storageLocation");
 042            writer.WriteObjectValue(StorageLocation);
 043            if (Filters != null)
 44            {
 045                writer.WritePropertyName("filters");
 046                writer.WriteStartArray();
 047                foreach (var item in Filters)
 48                {
 049                    writer.WriteObjectValue(item);
 50                }
 051                writer.WriteEndArray();
 52            }
 053            writer.WriteEndObject();
 054        }
 55
 56        internal static PacketCaptureResultProperties DeserializePacketCaptureResultProperties(JsonElement element)
 57        {
 058            ProvisioningState? provisioningState = default;
 059            string target = default;
 060            int? bytesToCapturePerPacket = default;
 061            int? totalBytesPerSession = default;
 062            int? timeLimitInSeconds = default;
 063            PacketCaptureStorageLocation storageLocation = default;
 064            IList<PacketCaptureFilter> filters = default;
 065            foreach (var property in element.EnumerateObject())
 66            {
 067                if (property.NameEquals("provisioningState"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    provisioningState = new ProvisioningState(property.Value.GetString());
 074                    continue;
 75                }
 076                if (property.NameEquals("target"))
 77                {
 078                    target = property.Value.GetString();
 079                    continue;
 80                }
 081                if (property.NameEquals("bytesToCapturePerPacket"))
 82                {
 083                    if (property.Value.ValueKind == JsonValueKind.Null)
 84                    {
 85                        continue;
 86                    }
 087                    bytesToCapturePerPacket = property.Value.GetInt32();
 088                    continue;
 89                }
 090                if (property.NameEquals("totalBytesPerSession"))
 91                {
 092                    if (property.Value.ValueKind == JsonValueKind.Null)
 93                    {
 94                        continue;
 95                    }
 096                    totalBytesPerSession = property.Value.GetInt32();
 097                    continue;
 98                }
 099                if (property.NameEquals("timeLimitInSeconds"))
 100                {
 0101                    if (property.Value.ValueKind == JsonValueKind.Null)
 102                    {
 103                        continue;
 104                    }
 0105                    timeLimitInSeconds = property.Value.GetInt32();
 0106                    continue;
 107                }
 0108                if (property.NameEquals("storageLocation"))
 109                {
 0110                    storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(property.Valu
 0111                    continue;
 112                }
 0113                if (property.NameEquals("filters"))
 114                {
 0115                    if (property.Value.ValueKind == JsonValueKind.Null)
 116                    {
 117                        continue;
 118                    }
 0119                    List<PacketCaptureFilter> array = new List<PacketCaptureFilter>();
 0120                    foreach (var item in property.Value.EnumerateArray())
 121                    {
 0122                        if (item.ValueKind == JsonValueKind.Null)
 123                        {
 0124                            array.Add(null);
 125                        }
 126                        else
 127                        {
 0128                            array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item));
 129                        }
 130                    }
 0131                    filters = array;
 132                    continue;
 133                }
 134            }
 0135            return new PacketCaptureResultProperties(target, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInS
 136        }
 137    }
 138}