{-# 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.ActionLocalIpDetails
-- 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.ActionLocalIpDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the IP address where the scanned port is
-- located.
--
-- /See:/ 'newActionLocalIpDetails' smart constructor.
data ActionLocalIpDetails = ActionLocalIpDetails'
  { -- | The IP address.
    ActionLocalIpDetails -> Maybe Text
ipAddressV4 :: Prelude.Maybe Prelude.Text
  }
  deriving (ActionLocalIpDetails -> ActionLocalIpDetails -> Bool
(ActionLocalIpDetails -> ActionLocalIpDetails -> Bool)
-> (ActionLocalIpDetails -> ActionLocalIpDetails -> Bool)
-> Eq ActionLocalIpDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionLocalIpDetails -> ActionLocalIpDetails -> Bool
$c/= :: ActionLocalIpDetails -> ActionLocalIpDetails -> Bool
== :: ActionLocalIpDetails -> ActionLocalIpDetails -> Bool
$c== :: ActionLocalIpDetails -> ActionLocalIpDetails -> Bool
Prelude.Eq, ReadPrec [ActionLocalIpDetails]
ReadPrec ActionLocalIpDetails
Int -> ReadS ActionLocalIpDetails
ReadS [ActionLocalIpDetails]
(Int -> ReadS ActionLocalIpDetails)
-> ReadS [ActionLocalIpDetails]
-> ReadPrec ActionLocalIpDetails
-> ReadPrec [ActionLocalIpDetails]
-> Read ActionLocalIpDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionLocalIpDetails]
$creadListPrec :: ReadPrec [ActionLocalIpDetails]
readPrec :: ReadPrec ActionLocalIpDetails
$creadPrec :: ReadPrec ActionLocalIpDetails
readList :: ReadS [ActionLocalIpDetails]
$creadList :: ReadS [ActionLocalIpDetails]
readsPrec :: Int -> ReadS ActionLocalIpDetails
$creadsPrec :: Int -> ReadS ActionLocalIpDetails
Prelude.Read, Int -> ActionLocalIpDetails -> ShowS
[ActionLocalIpDetails] -> ShowS
ActionLocalIpDetails -> String
(Int -> ActionLocalIpDetails -> ShowS)
-> (ActionLocalIpDetails -> String)
-> ([ActionLocalIpDetails] -> ShowS)
-> Show ActionLocalIpDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionLocalIpDetails] -> ShowS
$cshowList :: [ActionLocalIpDetails] -> ShowS
show :: ActionLocalIpDetails -> String
$cshow :: ActionLocalIpDetails -> String
showsPrec :: Int -> ActionLocalIpDetails -> ShowS
$cshowsPrec :: Int -> ActionLocalIpDetails -> ShowS
Prelude.Show, (forall x. ActionLocalIpDetails -> Rep ActionLocalIpDetails x)
-> (forall x. Rep ActionLocalIpDetails x -> ActionLocalIpDetails)
-> Generic ActionLocalIpDetails
forall x. Rep ActionLocalIpDetails x -> ActionLocalIpDetails
forall x. ActionLocalIpDetails -> Rep ActionLocalIpDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionLocalIpDetails x -> ActionLocalIpDetails
$cfrom :: forall x. ActionLocalIpDetails -> Rep ActionLocalIpDetails x
Prelude.Generic)

-- |
-- Create a value of 'ActionLocalIpDetails' 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:
--
-- 'ipAddressV4', 'actionLocalIpDetails_ipAddressV4' - The IP address.
newActionLocalIpDetails ::
  ActionLocalIpDetails
newActionLocalIpDetails :: ActionLocalIpDetails
newActionLocalIpDetails =
  ActionLocalIpDetails' :: Maybe Text -> ActionLocalIpDetails
ActionLocalIpDetails'
    { $sel:ipAddressV4:ActionLocalIpDetails' :: Maybe Text
ipAddressV4 =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The IP address.
actionLocalIpDetails_ipAddressV4 :: Lens.Lens' ActionLocalIpDetails (Prelude.Maybe Prelude.Text)
actionLocalIpDetails_ipAddressV4 :: (Maybe Text -> f (Maybe Text))
-> ActionLocalIpDetails -> f ActionLocalIpDetails
actionLocalIpDetails_ipAddressV4 = (ActionLocalIpDetails -> Maybe Text)
-> (ActionLocalIpDetails -> Maybe Text -> ActionLocalIpDetails)
-> Lens
     ActionLocalIpDetails ActionLocalIpDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionLocalIpDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:ActionLocalIpDetails' :: ActionLocalIpDetails -> Maybe Text
ipAddressV4} -> Maybe Text
ipAddressV4) (\s :: ActionLocalIpDetails
s@ActionLocalIpDetails' {} Maybe Text
a -> ActionLocalIpDetails
s {$sel:ipAddressV4:ActionLocalIpDetails' :: Maybe Text
ipAddressV4 = Maybe Text
a} :: ActionLocalIpDetails)

instance Core.FromJSON ActionLocalIpDetails where
  parseJSON :: Value -> Parser ActionLocalIpDetails
parseJSON =
    String
-> (Object -> Parser ActionLocalIpDetails)
-> Value
-> Parser ActionLocalIpDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionLocalIpDetails"
      ( \Object
x ->
          Maybe Text -> ActionLocalIpDetails
ActionLocalIpDetails'
            (Maybe Text -> ActionLocalIpDetails)
-> Parser (Maybe Text) -> Parser ActionLocalIpDetails
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
"IpAddressV4")
      )

instance Prelude.Hashable ActionLocalIpDetails

instance Prelude.NFData ActionLocalIpDetails

instance Core.ToJSON ActionLocalIpDetails where
  toJSON :: ActionLocalIpDetails -> Value
toJSON ActionLocalIpDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:ActionLocalIpDetails' :: ActionLocalIpDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"IpAddressV4" 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
ipAddressV4]
      )