示例#1
0
        private void EnsureStorageLocation()
        {
            PacketCaptureStorageLocation storageLocation = createParameters.StorageLocation;

            if (storageLocation == null)
            {
                createParameters.StorageLocation = new PacketCaptureStorageLocation();
            }
        }
示例#2
0
 internal PacketCaptureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag?etag, string target, long?bytesToCapturePerPacket, long?totalBytesPerSession, int?timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IReadOnlyList <PacketCaptureFilter> filters, NetworkProvisioningState?provisioningState) : base(id, name, resourceType, systemData)
 {
     Etag   = etag;
     Target = target;
     BytesToCapturePerPacket = bytesToCapturePerPacket;
     TotalBytesPerSession    = totalBytesPerSession;
     TimeLimitInSeconds      = timeLimitInSeconds;
     StorageLocation         = storageLocation;
     Filters           = filters;
     ProvisioningState = provisioningState;
 }
 internal PacketCaptureData(string id, string name, string etag, string target, long?bytesToCapturePerPacket, long?totalBytesPerSession, int?timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IReadOnlyList <PacketCaptureFilter> filters, ProvisioningState?provisioningState) : base(id)
 {
     Name   = name;
     Etag   = etag;
     Target = target;
     BytesToCapturePerPacket = bytesToCapturePerPacket;
     TotalBytesPerSession    = totalBytesPerSession;
     TimeLimitInSeconds      = timeLimitInSeconds;
     StorageLocation         = storageLocation;
     Filters           = filters;
     ProvisioningState = provisioningState;
 }
        internal static PacketCaptureData DeserializePacketCaptureData(JsonElement element)
        {
            Optional <string> name   = default;
            Optional <string> id     = default;
            Optional <string> etag   = default;
            Optional <string> target = default;
            Optional <long>   bytesToCapturePerPacket = default;
            Optional <long>   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.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("totalBytesPerSession"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            totalBytesPerSession = property0.Value.GetInt64();
                            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 PacketCaptureData(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)));
        }