示例#1
0
 internal PacketCaptureParameters(string target, int?bytesToCapturePerPacket, int?totalBytesPerSession, int?timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IList <PacketCaptureFilter> filters)
 {
     Target = target;
     BytesToCapturePerPacket = bytesToCapturePerPacket;
     TotalBytesPerSession    = totalBytesPerSession;
     TimeLimitInSeconds      = timeLimitInSeconds;
     StorageLocation         = storageLocation;
     Filters = filters;
 }
 public PacketCaptureResultProperties(string target, PacketCaptureStorageLocation storageLocation) : base(target, storageLocation)
 {
     if (target == null)
     {
         throw new ArgumentNullException(nameof(target));
     }
     if (storageLocation == null)
     {
         throw new ArgumentNullException(nameof(storageLocation));
     }
 }
 internal PacketCaptureResult(string name, string id, string etag, string target, int?bytesToCapturePerPacket, int?totalBytesPerSession, int?timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IReadOnlyList <PacketCaptureFilter> filters, ProvisioningState?provisioningState)
 {
     Name   = name;
     Id     = id;
     Etag   = etag;
     Target = target;
     BytesToCapturePerPacket = bytesToCapturePerPacket;
     TotalBytesPerSession    = totalBytesPerSession;
     TimeLimitInSeconds      = timeLimitInSeconds;
     StorageLocation         = storageLocation;
     Filters           = filters;
     ProvisioningState = provisioningState;
 }
示例#4
0
        public PacketCaptureParameters(string target, PacketCaptureStorageLocation storageLocation)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (storageLocation == null)
            {
                throw new ArgumentNullException(nameof(storageLocation));
            }

            Target          = target;
            StorageLocation = storageLocation;
        }
        internal PacketCaptureParameters(string target, PacketCaptureStorageLocation storageLocation)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (storageLocation == null)
            {
                throw new ArgumentNullException(nameof(storageLocation));
            }

            Target          = target;
            StorageLocation = storageLocation;
            Filters         = new ChangeTrackingList <PacketCaptureFilter>();
        }
        public PacketCaptureCreateOrUpdateContent(string target, PacketCaptureStorageLocation storageLocation)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (storageLocation == null)
            {
                throw new ArgumentNullException(nameof(storageLocation));
            }

            Target          = target;
            StorageLocation = storageLocation;
            Filters         = new ChangeTrackingList <PacketCaptureFilter>();
        }
示例#7
0
        internal static PacketCaptureResultProperties DeserializePacketCaptureResultProperties(JsonElement element)
        {
            ProvisioningState?provisioningState = default;
            string            target            = default;
            int?bytesToCapturePerPacket         = default;
            int?totalBytesPerSession            = default;
            int?timeLimitInSeconds = default;
            PacketCaptureStorageLocation storageLocation = default;
            IList <PacketCaptureFilter>  filters         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    provisioningState = new ProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("target"))
                {
                    target = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("bytesToCapturePerPacket"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    bytesToCapturePerPacket = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("totalBytesPerSession"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    totalBytesPerSession = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("timeLimitInSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    timeLimitInSeconds = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("storageLocation"))
                {
                    storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("filters"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <PacketCaptureFilter> array = new List <PacketCaptureFilter>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item));
                        }
                    }
                    filters = array;
                    continue;
                }
            }
            return(new PacketCaptureResultProperties(target, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds, storageLocation, filters, provisioningState));
        }
 internal PacketCaptureResultProperties(string target, int?bytesToCapturePerPacket, int?totalBytesPerSession, int?timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IList <PacketCaptureFilter> filters, ProvisioningState?provisioningState) : base(target, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds, storageLocation, filters)
 {
     ProvisioningState = provisioningState;
 }
示例#9
0
        internal static PacketCaptureResult DeserializePacketCaptureResult(JsonElement element)
        {
            Optional <string> name   = default;
            Optional <string> id     = default;
            Optional <string> etag   = default;
            Optional <string> target = default;
            Optional <int>    bytesToCapturePerPacket = default;
            Optional <int>    totalBytesPerSession    = default;
            Optional <int>    timeLimitInSeconds      = default;
            Optional <PacketCaptureStorageLocation>         storageLocation = default;
            Optional <IReadOnlyList <PacketCaptureFilter> > filters         = default;
            Optional <ProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("target"))
                        {
                            target = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("bytesToCapturePerPacket"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bytesToCapturePerPacket = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("totalBytesPerSession"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            totalBytesPerSession = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("timeLimitInSeconds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            timeLimitInSeconds = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("storageLocation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("filters"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PacketCaptureFilter> array = new List <PacketCaptureFilter>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item));
                            }
                            filters = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PacketCaptureResult(name.Value, id.Value, etag.Value, target.Value, Optional.ToNullable(bytesToCapturePerPacket), Optional.ToNullable(totalBytesPerSession), Optional.ToNullable(timeLimitInSeconds), storageLocation.Value, Optional.ToList(filters), Optional.ToNullable(provisioningState)));
        }