< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Target()-0%100%
get_BytesToCapturePerPacket()-0%100%
get_TotalBytesPerSession()-0%100%
get_TimeLimitInSeconds()-0%100%
get_StorageLocation()-0%100%
get_Filters()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializePacketCaptureParameters(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureParameters.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> Parameters that define the create packet capture operation. </summary>
 14    public partial class PacketCaptureParameters
 15    {
 16        /// <summary> Initializes a new instance of PacketCaptureParameters. </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 PacketCaptureParameters(string target, PacketCaptureStorageLocation storageLocation)
 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            }
 29
 030            Target = target;
 031            StorageLocation = storageLocation;
 032        }
 33
 34        /// <summary> Initializes a new instance of PacketCaptureParameters. </summary>
 35        /// <param name="target"> The ID of the targeted resource, only VM is currently supported. </param>
 36        /// <param name="bytesToCapturePerPacket"> Number of bytes captured per packet, the remaining bytes are truncate
 37        /// <param name="totalBytesPerSession"> Maximum size of the capture output. </param>
 38        /// <param name="timeLimitInSeconds"> Maximum duration of the capture session in seconds. </param>
 39        /// <param name="storageLocation"> The storage location for a packet capture session. </param>
 40        /// <param name="filters"> A list of packet capture filters. </param>
 041        internal PacketCaptureParameters(string target, int? bytesToCapturePerPacket, int? totalBytesPerSession, int? ti
 42        {
 043            Target = target;
 044            BytesToCapturePerPacket = bytesToCapturePerPacket;
 045            TotalBytesPerSession = totalBytesPerSession;
 046            TimeLimitInSeconds = timeLimitInSeconds;
 047            StorageLocation = storageLocation;
 048            Filters = filters;
 049        }
 50
 51        /// <summary> The ID of the targeted resource, only VM is currently supported. </summary>
 052        public string Target { get; set; }
 53        /// <summary> Number of bytes captured per packet, the remaining bytes are truncated. </summary>
 054        public int? BytesToCapturePerPacket { get; set; }
 55        /// <summary> Maximum size of the capture output. </summary>
 056        public int? TotalBytesPerSession { get; set; }
 57        /// <summary> Maximum duration of the capture session in seconds. </summary>
 058        public int? TimeLimitInSeconds { get; set; }
 59        /// <summary> The storage location for a packet capture session. </summary>
 060        public PacketCaptureStorageLocation StorageLocation { get; set; }
 61        /// <summary> A list of packet capture filters. </summary>
 062        public IList<PacketCaptureFilter> Filters { get; set; }
 63    }
 64}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PacketCaptureParameters.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 PacketCaptureParameters : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("target");
 020            writer.WriteStringValue(Target);
 021            if (BytesToCapturePerPacket != null)
 22            {
 023                writer.WritePropertyName("bytesToCapturePerPacket");
 024                writer.WriteNumberValue(BytesToCapturePerPacket.Value);
 25            }
 026            if (TotalBytesPerSession != null)
 27            {
 028                writer.WritePropertyName("totalBytesPerSession");
 029                writer.WriteNumberValue(TotalBytesPerSession.Value);
 30            }
 031            if (TimeLimitInSeconds != null)
 32            {
 033                writer.WritePropertyName("timeLimitInSeconds");
 034                writer.WriteNumberValue(TimeLimitInSeconds.Value);
 35            }
 036            writer.WritePropertyName("storageLocation");
 037            writer.WriteObjectValue(StorageLocation);
 038            if (Filters != null)
 39            {
 040                writer.WritePropertyName("filters");
 041                writer.WriteStartArray();
 042                foreach (var item in Filters)
 43                {
 044                    writer.WriteObjectValue(item);
 45                }
 046                writer.WriteEndArray();
 47            }
 048            writer.WriteEndObject();
 049        }
 50
 51        internal static PacketCaptureParameters DeserializePacketCaptureParameters(JsonElement element)
 52        {
 053            string target = default;
 054            int? bytesToCapturePerPacket = default;
 055            int? totalBytesPerSession = default;
 056            int? timeLimitInSeconds = default;
 057            PacketCaptureStorageLocation storageLocation = default;
 058            IList<PacketCaptureFilter> filters = default;
 059            foreach (var property in element.EnumerateObject())
 60            {
 061                if (property.NameEquals("target"))
 62                {
 063                    target = property.Value.GetString();
 064                    continue;
 65                }
 066                if (property.NameEquals("bytesToCapturePerPacket"))
 67                {
 068                    if (property.Value.ValueKind == JsonValueKind.Null)
 69                    {
 70                        continue;
 71                    }
 072                    bytesToCapturePerPacket = property.Value.GetInt32();
 073                    continue;
 74                }
 075                if (property.NameEquals("totalBytesPerSession"))
 76                {
 077                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 081                    totalBytesPerSession = property.Value.GetInt32();
 082                    continue;
 83                }
 084                if (property.NameEquals("timeLimitInSeconds"))
 85                {
 086                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 090                    timeLimitInSeconds = property.Value.GetInt32();
 091                    continue;
 92                }
 093                if (property.NameEquals("storageLocation"))
 94                {
 095                    storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(property.Valu
 096                    continue;
 97                }
 098                if (property.NameEquals("filters"))
 99                {
 0100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 0104                    List<PacketCaptureFilter> array = new List<PacketCaptureFilter>();
 0105                    foreach (var item in property.Value.EnumerateArray())
 106                    {
 0107                        if (item.ValueKind == JsonValueKind.Null)
 108                        {
 0109                            array.Add(null);
 110                        }
 111                        else
 112                        {
 0113                            array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item));
 114                        }
 115                    }
 0116                    filters = array;
 117                    continue;
 118                }
 119            }
 0120            return new PacketCaptureParameters(target, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds
 121        }
 122    }
 123}