{-# 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.MacieV2.Types.FindingActor
-- 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.MacieV2.Types.FindingActor where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.DomainDetails
import Amazonka.MacieV2.Types.IpAddressDetails
import Amazonka.MacieV2.Types.UserIdentity
import qualified Amazonka.Prelude as Prelude

-- | Provides information about an entity that performed an action that
-- produced a policy finding for a resource.
--
-- /See:/ 'newFindingActor' smart constructor.
data FindingActor = FindingActor'
  { -- | The domain name of the device that the entity used to perform the action
    -- on the affected resource.
    FindingActor -> Maybe DomainDetails
domainDetails :: Prelude.Maybe DomainDetails,
    -- | The IP address of the device that the entity used to perform the action
    -- on the affected resource. This object also provides information such as
    -- the owner and geographic location for the IP address.
    FindingActor -> Maybe IpAddressDetails
ipAddressDetails :: Prelude.Maybe IpAddressDetails,
    -- | The type and other characteristics of the entity that performed the
    -- action on the affected resource.
    FindingActor -> Maybe UserIdentity
userIdentity :: Prelude.Maybe UserIdentity
  }
  deriving (FindingActor -> FindingActor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FindingActor -> FindingActor -> Bool
$c/= :: FindingActor -> FindingActor -> Bool
== :: FindingActor -> FindingActor -> Bool
$c== :: FindingActor -> FindingActor -> Bool
Prelude.Eq, ReadPrec [FindingActor]
ReadPrec FindingActor
Int -> ReadS FindingActor
ReadS [FindingActor]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FindingActor]
$creadListPrec :: ReadPrec [FindingActor]
readPrec :: ReadPrec FindingActor
$creadPrec :: ReadPrec FindingActor
readList :: ReadS [FindingActor]
$creadList :: ReadS [FindingActor]
readsPrec :: Int -> ReadS FindingActor
$creadsPrec :: Int -> ReadS FindingActor
Prelude.Read, Int -> FindingActor -> ShowS
[FindingActor] -> ShowS
FindingActor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FindingActor] -> ShowS
$cshowList :: [FindingActor] -> ShowS
show :: FindingActor -> String
$cshow :: FindingActor -> String
showsPrec :: Int -> FindingActor -> ShowS
$cshowsPrec :: Int -> FindingActor -> ShowS
Prelude.Show, forall x. Rep FindingActor x -> FindingActor
forall x. FindingActor -> Rep FindingActor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FindingActor x -> FindingActor
$cfrom :: forall x. FindingActor -> Rep FindingActor x
Prelude.Generic)

-- |
-- Create a value of 'FindingActor' 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:
--
-- 'domainDetails', 'findingActor_domainDetails' - The domain name of the device that the entity used to perform the action
-- on the affected resource.
--
-- 'ipAddressDetails', 'findingActor_ipAddressDetails' - The IP address of the device that the entity used to perform the action
-- on the affected resource. This object also provides information such as
-- the owner and geographic location for the IP address.
--
-- 'userIdentity', 'findingActor_userIdentity' - The type and other characteristics of the entity that performed the
-- action on the affected resource.
newFindingActor ::
  FindingActor
newFindingActor :: FindingActor
newFindingActor =
  FindingActor'
    { $sel:domainDetails:FindingActor' :: Maybe DomainDetails
domainDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressDetails:FindingActor' :: Maybe IpAddressDetails
ipAddressDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:userIdentity:FindingActor' :: Maybe UserIdentity
userIdentity = forall a. Maybe a
Prelude.Nothing
    }

-- | The domain name of the device that the entity used to perform the action
-- on the affected resource.
findingActor_domainDetails :: Lens.Lens' FindingActor (Prelude.Maybe DomainDetails)
findingActor_domainDetails :: Lens' FindingActor (Maybe DomainDetails)
findingActor_domainDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingActor' {Maybe DomainDetails
domainDetails :: Maybe DomainDetails
$sel:domainDetails:FindingActor' :: FindingActor -> Maybe DomainDetails
domainDetails} -> Maybe DomainDetails
domainDetails) (\s :: FindingActor
s@FindingActor' {} Maybe DomainDetails
a -> FindingActor
s {$sel:domainDetails:FindingActor' :: Maybe DomainDetails
domainDetails = Maybe DomainDetails
a} :: FindingActor)

-- | The IP address of the device that the entity used to perform the action
-- on the affected resource. This object also provides information such as
-- the owner and geographic location for the IP address.
findingActor_ipAddressDetails :: Lens.Lens' FindingActor (Prelude.Maybe IpAddressDetails)
findingActor_ipAddressDetails :: Lens' FindingActor (Maybe IpAddressDetails)
findingActor_ipAddressDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingActor' {Maybe IpAddressDetails
ipAddressDetails :: Maybe IpAddressDetails
$sel:ipAddressDetails:FindingActor' :: FindingActor -> Maybe IpAddressDetails
ipAddressDetails} -> Maybe IpAddressDetails
ipAddressDetails) (\s :: FindingActor
s@FindingActor' {} Maybe IpAddressDetails
a -> FindingActor
s {$sel:ipAddressDetails:FindingActor' :: Maybe IpAddressDetails
ipAddressDetails = Maybe IpAddressDetails
a} :: FindingActor)

-- | The type and other characteristics of the entity that performed the
-- action on the affected resource.
findingActor_userIdentity :: Lens.Lens' FindingActor (Prelude.Maybe UserIdentity)
findingActor_userIdentity :: Lens' FindingActor (Maybe UserIdentity)
findingActor_userIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FindingActor' {Maybe UserIdentity
userIdentity :: Maybe UserIdentity
$sel:userIdentity:FindingActor' :: FindingActor -> Maybe UserIdentity
userIdentity} -> Maybe UserIdentity
userIdentity) (\s :: FindingActor
s@FindingActor' {} Maybe UserIdentity
a -> FindingActor
s {$sel:userIdentity:FindingActor' :: Maybe UserIdentity
userIdentity = Maybe UserIdentity
a} :: FindingActor)

instance Data.FromJSON FindingActor where
  parseJSON :: Value -> Parser FindingActor
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FindingActor"
      ( \Object
x ->
          Maybe DomainDetails
-> Maybe IpAddressDetails -> Maybe UserIdentity -> FindingActor
FindingActor'
            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
"domainDetails")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ipAddressDetails")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"userIdentity")
      )

instance Prelude.Hashable FindingActor where
  hashWithSalt :: Int -> FindingActor -> Int
hashWithSalt Int
_salt FindingActor' {Maybe DomainDetails
Maybe IpAddressDetails
Maybe UserIdentity
userIdentity :: Maybe UserIdentity
ipAddressDetails :: Maybe IpAddressDetails
domainDetails :: Maybe DomainDetails
$sel:userIdentity:FindingActor' :: FindingActor -> Maybe UserIdentity
$sel:ipAddressDetails:FindingActor' :: FindingActor -> Maybe IpAddressDetails
$sel:domainDetails:FindingActor' :: FindingActor -> Maybe DomainDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DomainDetails
domainDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IpAddressDetails
ipAddressDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserIdentity
userIdentity

instance Prelude.NFData FindingActor where
  rnf :: FindingActor -> ()
rnf FindingActor' {Maybe DomainDetails
Maybe IpAddressDetails
Maybe UserIdentity
userIdentity :: Maybe UserIdentity
ipAddressDetails :: Maybe IpAddressDetails
domainDetails :: Maybe DomainDetails
$sel:userIdentity:FindingActor' :: FindingActor -> Maybe UserIdentity
$sel:ipAddressDetails:FindingActor' :: FindingActor -> Maybe IpAddressDetails
$sel:domainDetails:FindingActor' :: FindingActor -> Maybe DomainDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DomainDetails
domainDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IpAddressDetails
ipAddressDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UserIdentity
userIdentity