{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecurityHub.Types.Network
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.Network where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.NetworkDirection
import Amazonka.SecurityHub.Types.PortRange

-- | The details of network-related information about a finding.
--
-- /See:/ 'newNetwork' smart constructor.
data Network = Network'
  { -- | The destination domain of network-related information about a finding.
    Network -> Maybe Text
destinationDomain :: Prelude.Maybe Prelude.Text,
    -- | The source port of network-related information about a finding.
    Network -> Maybe Int
sourcePort :: Prelude.Maybe Prelude.Int,
    -- | The range of open ports that is present on the network.
    Network -> Maybe PortRange
openPortRange :: Prelude.Maybe PortRange,
    -- | The source media access control (MAC) address of network-related
    -- information about a finding.
    Network -> Maybe Text
sourceMac :: Prelude.Maybe Prelude.Text,
    -- | The direction of network traffic associated with a finding.
    Network -> Maybe NetworkDirection
direction :: Prelude.Maybe NetworkDirection,
    -- | The destination IPv6 address of network-related information about a
    -- finding.
    Network -> Maybe Text
destinationIpV6 :: Prelude.Maybe Prelude.Text,
    -- | The protocol of network-related information about a finding.
    Network -> Maybe Text
protocol :: Prelude.Maybe Prelude.Text,
    -- | The source IPv6 address of network-related information about a finding.
    Network -> Maybe Text
sourceIpV6 :: Prelude.Maybe Prelude.Text,
    -- | The destination IPv4 address of network-related information about a
    -- finding.
    Network -> Maybe Text
destinationIpV4 :: Prelude.Maybe Prelude.Text,
    -- | The source domain of network-related information about a finding.
    Network -> Maybe Text
sourceDomain :: Prelude.Maybe Prelude.Text,
    -- | The destination port of network-related information about a finding.
    Network -> Maybe Int
destinationPort :: Prelude.Maybe Prelude.Int,
    -- | The source IPv4 address of network-related information about a finding.
    Network -> Maybe Text
sourceIpV4 :: Prelude.Maybe Prelude.Text
  }
  deriving (Network -> Network -> Bool
(Network -> Network -> Bool)
-> (Network -> Network -> Bool) -> Eq Network
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Network -> Network -> Bool
$c/= :: Network -> Network -> Bool
== :: Network -> Network -> Bool
$c== :: Network -> Network -> Bool
Prelude.Eq, ReadPrec [Network]
ReadPrec Network
Int -> ReadS Network
ReadS [Network]
(Int -> ReadS Network)
-> ReadS [Network]
-> ReadPrec Network
-> ReadPrec [Network]
-> Read Network
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Network]
$creadListPrec :: ReadPrec [Network]
readPrec :: ReadPrec Network
$creadPrec :: ReadPrec Network
readList :: ReadS [Network]
$creadList :: ReadS [Network]
readsPrec :: Int -> ReadS Network
$creadsPrec :: Int -> ReadS Network
Prelude.Read, Int -> Network -> ShowS
[Network] -> ShowS
Network -> String
(Int -> Network -> ShowS)
-> (Network -> String) -> ([Network] -> ShowS) -> Show Network
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Network] -> ShowS
$cshowList :: [Network] -> ShowS
show :: Network -> String
$cshow :: Network -> String
showsPrec :: Int -> Network -> ShowS
$cshowsPrec :: Int -> Network -> ShowS
Prelude.Show, (forall x. Network -> Rep Network x)
-> (forall x. Rep Network x -> Network) -> Generic Network
forall x. Rep Network x -> Network
forall x. Network -> Rep Network x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Network x -> Network
$cfrom :: forall x. Network -> Rep Network x
Prelude.Generic)

-- |
-- Create a value of 'Network' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'destinationDomain', 'network_destinationDomain' - The destination domain of network-related information about a finding.
--
-- 'sourcePort', 'network_sourcePort' - The source port of network-related information about a finding.
--
-- 'openPortRange', 'network_openPortRange' - The range of open ports that is present on the network.
--
-- 'sourceMac', 'network_sourceMac' - The source media access control (MAC) address of network-related
-- information about a finding.
--
-- 'direction', 'network_direction' - The direction of network traffic associated with a finding.
--
-- 'destinationIpV6', 'network_destinationIpV6' - The destination IPv6 address of network-related information about a
-- finding.
--
-- 'protocol', 'network_protocol' - The protocol of network-related information about a finding.
--
-- 'sourceIpV6', 'network_sourceIpV6' - The source IPv6 address of network-related information about a finding.
--
-- 'destinationIpV4', 'network_destinationIpV4' - The destination IPv4 address of network-related information about a
-- finding.
--
-- 'sourceDomain', 'network_sourceDomain' - The source domain of network-related information about a finding.
--
-- 'destinationPort', 'network_destinationPort' - The destination port of network-related information about a finding.
--
-- 'sourceIpV4', 'network_sourceIpV4' - The source IPv4 address of network-related information about a finding.
newNetwork ::
  Network
newNetwork :: Network
newNetwork =
  Network' :: Maybe Text
-> Maybe Int
-> Maybe PortRange
-> Maybe Text
-> Maybe NetworkDirection
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Network
Network'
    { $sel:destinationDomain:Network' :: Maybe Text
destinationDomain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourcePort:Network' :: Maybe Int
sourcePort = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:openPortRange:Network' :: Maybe PortRange
openPortRange = Maybe PortRange
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceMac:Network' :: Maybe Text
sourceMac = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:direction:Network' :: Maybe NetworkDirection
direction = Maybe NetworkDirection
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationIpV6:Network' :: Maybe Text
destinationIpV6 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:Network' :: Maybe Text
protocol = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceIpV6:Network' :: Maybe Text
sourceIpV6 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationIpV4:Network' :: Maybe Text
destinationIpV4 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceDomain:Network' :: Maybe Text
sourceDomain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPort:Network' :: Maybe Int
destinationPort = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceIpV4:Network' :: Maybe Text
sourceIpV4 = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The destination domain of network-related information about a finding.
network_destinationDomain :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_destinationDomain :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_destinationDomain = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
destinationDomain :: Maybe Text
$sel:destinationDomain:Network' :: Network -> Maybe Text
destinationDomain} -> Maybe Text
destinationDomain) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:destinationDomain:Network' :: Maybe Text
destinationDomain = Maybe Text
a} :: Network)

-- | The source port of network-related information about a finding.
network_sourcePort :: Lens.Lens' Network (Prelude.Maybe Prelude.Int)
network_sourcePort :: (Maybe Int -> f (Maybe Int)) -> Network -> f Network
network_sourcePort = (Network -> Maybe Int)
-> (Network -> Maybe Int -> Network)
-> Lens Network Network (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Int
sourcePort :: Maybe Int
$sel:sourcePort:Network' :: Network -> Maybe Int
sourcePort} -> Maybe Int
sourcePort) (\s :: Network
s@Network' {} Maybe Int
a -> Network
s {$sel:sourcePort:Network' :: Maybe Int
sourcePort = Maybe Int
a} :: Network)

-- | The range of open ports that is present on the network.
network_openPortRange :: Lens.Lens' Network (Prelude.Maybe PortRange)
network_openPortRange :: (Maybe PortRange -> f (Maybe PortRange)) -> Network -> f Network
network_openPortRange = (Network -> Maybe PortRange)
-> (Network -> Maybe PortRange -> Network)
-> Lens Network Network (Maybe PortRange) (Maybe PortRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe PortRange
openPortRange :: Maybe PortRange
$sel:openPortRange:Network' :: Network -> Maybe PortRange
openPortRange} -> Maybe PortRange
openPortRange) (\s :: Network
s@Network' {} Maybe PortRange
a -> Network
s {$sel:openPortRange:Network' :: Maybe PortRange
openPortRange = Maybe PortRange
a} :: Network)

-- | The source media access control (MAC) address of network-related
-- information about a finding.
network_sourceMac :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_sourceMac :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_sourceMac = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
sourceMac :: Maybe Text
$sel:sourceMac:Network' :: Network -> Maybe Text
sourceMac} -> Maybe Text
sourceMac) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:sourceMac:Network' :: Maybe Text
sourceMac = Maybe Text
a} :: Network)

-- | The direction of network traffic associated with a finding.
network_direction :: Lens.Lens' Network (Prelude.Maybe NetworkDirection)
network_direction :: (Maybe NetworkDirection -> f (Maybe NetworkDirection))
-> Network -> f Network
network_direction = (Network -> Maybe NetworkDirection)
-> (Network -> Maybe NetworkDirection -> Network)
-> Lens
     Network Network (Maybe NetworkDirection) (Maybe NetworkDirection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe NetworkDirection
direction :: Maybe NetworkDirection
$sel:direction:Network' :: Network -> Maybe NetworkDirection
direction} -> Maybe NetworkDirection
direction) (\s :: Network
s@Network' {} Maybe NetworkDirection
a -> Network
s {$sel:direction:Network' :: Maybe NetworkDirection
direction = Maybe NetworkDirection
a} :: Network)

-- | The destination IPv6 address of network-related information about a
-- finding.
network_destinationIpV6 :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_destinationIpV6 :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_destinationIpV6 = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
destinationIpV6 :: Maybe Text
$sel:destinationIpV6:Network' :: Network -> Maybe Text
destinationIpV6} -> Maybe Text
destinationIpV6) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:destinationIpV6:Network' :: Maybe Text
destinationIpV6 = Maybe Text
a} :: Network)

-- | The protocol of network-related information about a finding.
network_protocol :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_protocol :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_protocol = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
protocol :: Maybe Text
$sel:protocol:Network' :: Network -> Maybe Text
protocol} -> Maybe Text
protocol) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:protocol:Network' :: Maybe Text
protocol = Maybe Text
a} :: Network)

-- | The source IPv6 address of network-related information about a finding.
network_sourceIpV6 :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_sourceIpV6 :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_sourceIpV6 = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
sourceIpV6 :: Maybe Text
$sel:sourceIpV6:Network' :: Network -> Maybe Text
sourceIpV6} -> Maybe Text
sourceIpV6) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:sourceIpV6:Network' :: Maybe Text
sourceIpV6 = Maybe Text
a} :: Network)

-- | The destination IPv4 address of network-related information about a
-- finding.
network_destinationIpV4 :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_destinationIpV4 :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_destinationIpV4 = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
destinationIpV4 :: Maybe Text
$sel:destinationIpV4:Network' :: Network -> Maybe Text
destinationIpV4} -> Maybe Text
destinationIpV4) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:destinationIpV4:Network' :: Maybe Text
destinationIpV4 = Maybe Text
a} :: Network)

-- | The source domain of network-related information about a finding.
network_sourceDomain :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_sourceDomain :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_sourceDomain = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
sourceDomain :: Maybe Text
$sel:sourceDomain:Network' :: Network -> Maybe Text
sourceDomain} -> Maybe Text
sourceDomain) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:sourceDomain:Network' :: Maybe Text
sourceDomain = Maybe Text
a} :: Network)

-- | The destination port of network-related information about a finding.
network_destinationPort :: Lens.Lens' Network (Prelude.Maybe Prelude.Int)
network_destinationPort :: (Maybe Int -> f (Maybe Int)) -> Network -> f Network
network_destinationPort = (Network -> Maybe Int)
-> (Network -> Maybe Int -> Network)
-> Lens Network Network (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Int
destinationPort :: Maybe Int
$sel:destinationPort:Network' :: Network -> Maybe Int
destinationPort} -> Maybe Int
destinationPort) (\s :: Network
s@Network' {} Maybe Int
a -> Network
s {$sel:destinationPort:Network' :: Maybe Int
destinationPort = Maybe Int
a} :: Network)

-- | The source IPv4 address of network-related information about a finding.
network_sourceIpV4 :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_sourceIpV4 :: (Maybe Text -> f (Maybe Text)) -> Network -> f Network
network_sourceIpV4 = (Network -> Maybe Text)
-> (Network -> Maybe Text -> Network)
-> Lens Network Network (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
sourceIpV4 :: Maybe Text
$sel:sourceIpV4:Network' :: Network -> Maybe Text
sourceIpV4} -> Maybe Text
sourceIpV4) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:sourceIpV4:Network' :: Maybe Text
sourceIpV4 = Maybe Text
a} :: Network)

instance Core.FromJSON Network where
  parseJSON :: Value -> Parser Network
parseJSON =
    String -> (Object -> Parser Network) -> Value -> Parser Network
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Network"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe PortRange
-> Maybe Text
-> Maybe NetworkDirection
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Network
Network'
            (Maybe Text
 -> Maybe Int
 -> Maybe PortRange
 -> Maybe Text
 -> Maybe NetworkDirection
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Network)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe PortRange
      -> Maybe Text
      -> Maybe NetworkDirection
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationDomain")
            Parser
  (Maybe Int
   -> Maybe PortRange
   -> Maybe Text
   -> Maybe NetworkDirection
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe Int)
-> Parser
     (Maybe PortRange
      -> Maybe Text
      -> Maybe NetworkDirection
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourcePort")
            Parser
  (Maybe PortRange
   -> Maybe Text
   -> Maybe NetworkDirection
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe PortRange)
-> Parser
     (Maybe Text
      -> Maybe NetworkDirection
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PortRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OpenPortRange")
            Parser
  (Maybe Text
   -> Maybe NetworkDirection
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe Text)
-> Parser
     (Maybe NetworkDirection
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceMac")
            Parser
  (Maybe NetworkDirection
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe NetworkDirection)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NetworkDirection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Direction")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationIpV6")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Network)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Int -> Maybe Text -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Protocol")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Int -> Maybe Text -> Network)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Int -> Maybe Text -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceIpV6")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Int -> Maybe Text -> Network)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Int -> Maybe Text -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationIpV4")
            Parser (Maybe Text -> Maybe Int -> Maybe Text -> Network)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceDomain")
            Parser (Maybe Int -> Maybe Text -> Network)
-> Parser (Maybe Int) -> Parser (Maybe Text -> Network)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationPort")
            Parser (Maybe Text -> Network)
-> Parser (Maybe Text) -> Parser Network
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceIpV4")
      )

instance Prelude.Hashable Network

instance Prelude.NFData Network

instance Core.ToJSON Network where
  toJSON :: Network -> Value
toJSON Network' {Maybe Int
Maybe Text
Maybe NetworkDirection
Maybe PortRange
sourceIpV4 :: Maybe Text
destinationPort :: Maybe Int
sourceDomain :: Maybe Text
destinationIpV4 :: Maybe Text
sourceIpV6 :: Maybe Text
protocol :: Maybe Text
destinationIpV6 :: Maybe Text
direction :: Maybe NetworkDirection
sourceMac :: Maybe Text
openPortRange :: Maybe PortRange
sourcePort :: Maybe Int
destinationDomain :: Maybe Text
$sel:sourceIpV4:Network' :: Network -> Maybe Text
$sel:destinationPort:Network' :: Network -> Maybe Int
$sel:sourceDomain:Network' :: Network -> Maybe Text
$sel:destinationIpV4:Network' :: Network -> Maybe Text
$sel:sourceIpV6:Network' :: Network -> Maybe Text
$sel:protocol:Network' :: Network -> Maybe Text
$sel:destinationIpV6:Network' :: Network -> Maybe Text
$sel:direction:Network' :: Network -> Maybe NetworkDirection
$sel:sourceMac:Network' :: Network -> Maybe Text
$sel:openPortRange:Network' :: Network -> Maybe PortRange
$sel:sourcePort:Network' :: Network -> Maybe Int
$sel:destinationDomain:Network' :: Network -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DestinationDomain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationDomain,
            (Text
"SourcePort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
sourcePort,
            (Text
"OpenPortRange" Text -> PortRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PortRange -> Pair) -> Maybe PortRange -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PortRange
openPortRange,
            (Text
"SourceMac" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceMac,
            (Text
"Direction" Text -> NetworkDirection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NetworkDirection -> Pair) -> Maybe NetworkDirection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkDirection
direction,
            (Text
"DestinationIpV6" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationIpV6,
            (Text
"Protocol" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
protocol,
            (Text
"SourceIpV6" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceIpV6,
            (Text
"DestinationIpV4" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationIpV4,
            (Text
"SourceDomain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceDomain,
            (Text
"DestinationPort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
destinationPort,
            (Text
"SourceIpV4" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceIpV4
          ]
      )