{-# 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.Inspector2.Types.NetworkPath
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector2.Types.NetworkPath where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.Step
import qualified Amazonka.Prelude as Prelude

-- | Information on the network path associated with a finding.
--
-- /See:/ 'newNetworkPath' smart constructor.
data NetworkPath = NetworkPath'
  { -- | The details on the steps in the network path.
    NetworkPath -> Maybe (NonEmpty Step)
steps :: Prelude.Maybe (Prelude.NonEmpty Step)
  }
  deriving (NetworkPath -> NetworkPath -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkPath -> NetworkPath -> Bool
$c/= :: NetworkPath -> NetworkPath -> Bool
== :: NetworkPath -> NetworkPath -> Bool
$c== :: NetworkPath -> NetworkPath -> Bool
Prelude.Eq, ReadPrec [NetworkPath]
ReadPrec NetworkPath
Int -> ReadS NetworkPath
ReadS [NetworkPath]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkPath]
$creadListPrec :: ReadPrec [NetworkPath]
readPrec :: ReadPrec NetworkPath
$creadPrec :: ReadPrec NetworkPath
readList :: ReadS [NetworkPath]
$creadList :: ReadS [NetworkPath]
readsPrec :: Int -> ReadS NetworkPath
$creadsPrec :: Int -> ReadS NetworkPath
Prelude.Read, Int -> NetworkPath -> ShowS
[NetworkPath] -> ShowS
NetworkPath -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkPath] -> ShowS
$cshowList :: [NetworkPath] -> ShowS
show :: NetworkPath -> String
$cshow :: NetworkPath -> String
showsPrec :: Int -> NetworkPath -> ShowS
$cshowsPrec :: Int -> NetworkPath -> ShowS
Prelude.Show, forall x. Rep NetworkPath x -> NetworkPath
forall x. NetworkPath -> Rep NetworkPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkPath x -> NetworkPath
$cfrom :: forall x. NetworkPath -> Rep NetworkPath x
Prelude.Generic)

-- |
-- Create a value of 'NetworkPath' 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:
--
-- 'steps', 'networkPath_steps' - The details on the steps in the network path.
newNetworkPath ::
  NetworkPath
newNetworkPath :: NetworkPath
newNetworkPath =
  NetworkPath' {$sel:steps:NetworkPath' :: Maybe (NonEmpty Step)
steps = forall a. Maybe a
Prelude.Nothing}

-- | The details on the steps in the network path.
networkPath_steps :: Lens.Lens' NetworkPath (Prelude.Maybe (Prelude.NonEmpty Step))
networkPath_steps :: Lens' NetworkPath (Maybe (NonEmpty Step))
networkPath_steps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkPath' {Maybe (NonEmpty Step)
steps :: Maybe (NonEmpty Step)
$sel:steps:NetworkPath' :: NetworkPath -> Maybe (NonEmpty Step)
steps} -> Maybe (NonEmpty Step)
steps) (\s :: NetworkPath
s@NetworkPath' {} Maybe (NonEmpty Step)
a -> NetworkPath
s {$sel:steps:NetworkPath' :: Maybe (NonEmpty Step)
steps = Maybe (NonEmpty Step)
a} :: NetworkPath) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON NetworkPath where
  parseJSON :: Value -> Parser NetworkPath
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkPath"
      ( \Object
x ->
          Maybe (NonEmpty Step) -> NetworkPath
NetworkPath' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"steps")
      )

instance Prelude.Hashable NetworkPath where
  hashWithSalt :: Int -> NetworkPath -> Int
hashWithSalt Int
_salt NetworkPath' {Maybe (NonEmpty Step)
steps :: Maybe (NonEmpty Step)
$sel:steps:NetworkPath' :: NetworkPath -> Maybe (NonEmpty Step)
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Step)
steps

instance Prelude.NFData NetworkPath where
  rnf :: NetworkPath -> ()
rnf NetworkPath' {Maybe (NonEmpty Step)
steps :: Maybe (NonEmpty Step)
$sel:steps:NetworkPath' :: NetworkPath -> Maybe (NonEmpty Step)
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Step)
steps