{-# 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.GuardDuty.Types.RemoteAccountDetails
-- 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.GuardDuty.Types.RemoteAccountDetails where

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

-- | Contains details about the remote Amazon Web Services account that made
-- the API call.
--
-- /See:/ 'newRemoteAccountDetails' smart constructor.
data RemoteAccountDetails = RemoteAccountDetails'
  { -- | The Amazon Web Services account ID of the remote API caller.
    RemoteAccountDetails -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | Details on whether the Amazon Web Services account of the remote API
    -- caller is related to your GuardDuty environment. If this value is @True@
    -- the API caller is affiliated to your account in some way. If it is
    -- @False@ the API caller is from outside your environment.
    RemoteAccountDetails -> Maybe Bool
affiliated :: Prelude.Maybe Prelude.Bool
  }
  deriving (RemoteAccountDetails -> RemoteAccountDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoteAccountDetails -> RemoteAccountDetails -> Bool
$c/= :: RemoteAccountDetails -> RemoteAccountDetails -> Bool
== :: RemoteAccountDetails -> RemoteAccountDetails -> Bool
$c== :: RemoteAccountDetails -> RemoteAccountDetails -> Bool
Prelude.Eq, ReadPrec [RemoteAccountDetails]
ReadPrec RemoteAccountDetails
Int -> ReadS RemoteAccountDetails
ReadS [RemoteAccountDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoteAccountDetails]
$creadListPrec :: ReadPrec [RemoteAccountDetails]
readPrec :: ReadPrec RemoteAccountDetails
$creadPrec :: ReadPrec RemoteAccountDetails
readList :: ReadS [RemoteAccountDetails]
$creadList :: ReadS [RemoteAccountDetails]
readsPrec :: Int -> ReadS RemoteAccountDetails
$creadsPrec :: Int -> ReadS RemoteAccountDetails
Prelude.Read, Int -> RemoteAccountDetails -> ShowS
[RemoteAccountDetails] -> ShowS
RemoteAccountDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoteAccountDetails] -> ShowS
$cshowList :: [RemoteAccountDetails] -> ShowS
show :: RemoteAccountDetails -> String
$cshow :: RemoteAccountDetails -> String
showsPrec :: Int -> RemoteAccountDetails -> ShowS
$cshowsPrec :: Int -> RemoteAccountDetails -> ShowS
Prelude.Show, forall x. Rep RemoteAccountDetails x -> RemoteAccountDetails
forall x. RemoteAccountDetails -> Rep RemoteAccountDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoteAccountDetails x -> RemoteAccountDetails
$cfrom :: forall x. RemoteAccountDetails -> Rep RemoteAccountDetails x
Prelude.Generic)

-- |
-- Create a value of 'RemoteAccountDetails' 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:
--
-- 'accountId', 'remoteAccountDetails_accountId' - The Amazon Web Services account ID of the remote API caller.
--
-- 'affiliated', 'remoteAccountDetails_affiliated' - Details on whether the Amazon Web Services account of the remote API
-- caller is related to your GuardDuty environment. If this value is @True@
-- the API caller is affiliated to your account in some way. If it is
-- @False@ the API caller is from outside your environment.
newRemoteAccountDetails ::
  RemoteAccountDetails
newRemoteAccountDetails :: RemoteAccountDetails
newRemoteAccountDetails =
  RemoteAccountDetails'
    { $sel:accountId:RemoteAccountDetails' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:affiliated:RemoteAccountDetails' :: Maybe Bool
affiliated = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID of the remote API caller.
remoteAccountDetails_accountId :: Lens.Lens' RemoteAccountDetails (Prelude.Maybe Prelude.Text)
remoteAccountDetails_accountId :: Lens' RemoteAccountDetails (Maybe Text)
remoteAccountDetails_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoteAccountDetails' {Maybe Text
accountId :: Maybe Text
$sel:accountId:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: RemoteAccountDetails
s@RemoteAccountDetails' {} Maybe Text
a -> RemoteAccountDetails
s {$sel:accountId:RemoteAccountDetails' :: Maybe Text
accountId = Maybe Text
a} :: RemoteAccountDetails)

-- | Details on whether the Amazon Web Services account of the remote API
-- caller is related to your GuardDuty environment. If this value is @True@
-- the API caller is affiliated to your account in some way. If it is
-- @False@ the API caller is from outside your environment.
remoteAccountDetails_affiliated :: Lens.Lens' RemoteAccountDetails (Prelude.Maybe Prelude.Bool)
remoteAccountDetails_affiliated :: Lens' RemoteAccountDetails (Maybe Bool)
remoteAccountDetails_affiliated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoteAccountDetails' {Maybe Bool
affiliated :: Maybe Bool
$sel:affiliated:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Bool
affiliated} -> Maybe Bool
affiliated) (\s :: RemoteAccountDetails
s@RemoteAccountDetails' {} Maybe Bool
a -> RemoteAccountDetails
s {$sel:affiliated:RemoteAccountDetails' :: Maybe Bool
affiliated = Maybe Bool
a} :: RemoteAccountDetails)

instance Data.FromJSON RemoteAccountDetails where
  parseJSON :: Value -> Parser RemoteAccountDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RemoteAccountDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Bool -> RemoteAccountDetails
RemoteAccountDetails'
            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
"accountId")
            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
"affiliated")
      )

instance Prelude.Hashable RemoteAccountDetails where
  hashWithSalt :: Int -> RemoteAccountDetails -> Int
hashWithSalt Int
_salt RemoteAccountDetails' {Maybe Bool
Maybe Text
affiliated :: Maybe Bool
accountId :: Maybe Text
$sel:affiliated:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Bool
$sel:accountId:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
affiliated

instance Prelude.NFData RemoteAccountDetails where
  rnf :: RemoteAccountDetails -> ()
rnf RemoteAccountDetails' {Maybe Bool
Maybe Text
affiliated :: Maybe Bool
accountId :: Maybe Text
$sel:affiliated:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Bool
$sel:accountId:RemoteAccountDetails' :: RemoteAccountDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
affiliated