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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.AdminStatus
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the delegated Amazon Macie administrator
-- account for an Amazon Web Services organization.
--
-- /See:/ 'newAdminAccount' smart constructor.
data AdminAccount = AdminAccount'
  { -- | The current status of the account as the delegated administrator of
    -- Amazon Macie for the organization.
    AdminAccount -> Maybe AdminStatus
status :: Prelude.Maybe AdminStatus,
    -- | The Amazon Web Services account ID for the account.
    AdminAccount -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text
  }
  deriving (AdminAccount -> AdminAccount -> Bool
(AdminAccount -> AdminAccount -> Bool)
-> (AdminAccount -> AdminAccount -> Bool) -> Eq AdminAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminAccount -> AdminAccount -> Bool
$c/= :: AdminAccount -> AdminAccount -> Bool
== :: AdminAccount -> AdminAccount -> Bool
$c== :: AdminAccount -> AdminAccount -> Bool
Prelude.Eq, ReadPrec [AdminAccount]
ReadPrec AdminAccount
Int -> ReadS AdminAccount
ReadS [AdminAccount]
(Int -> ReadS AdminAccount)
-> ReadS [AdminAccount]
-> ReadPrec AdminAccount
-> ReadPrec [AdminAccount]
-> Read AdminAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminAccount]
$creadListPrec :: ReadPrec [AdminAccount]
readPrec :: ReadPrec AdminAccount
$creadPrec :: ReadPrec AdminAccount
readList :: ReadS [AdminAccount]
$creadList :: ReadS [AdminAccount]
readsPrec :: Int -> ReadS AdminAccount
$creadsPrec :: Int -> ReadS AdminAccount
Prelude.Read, Int -> AdminAccount -> ShowS
[AdminAccount] -> ShowS
AdminAccount -> String
(Int -> AdminAccount -> ShowS)
-> (AdminAccount -> String)
-> ([AdminAccount] -> ShowS)
-> Show AdminAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminAccount] -> ShowS
$cshowList :: [AdminAccount] -> ShowS
show :: AdminAccount -> String
$cshow :: AdminAccount -> String
showsPrec :: Int -> AdminAccount -> ShowS
$cshowsPrec :: Int -> AdminAccount -> ShowS
Prelude.Show, (forall x. AdminAccount -> Rep AdminAccount x)
-> (forall x. Rep AdminAccount x -> AdminAccount)
-> Generic AdminAccount
forall x. Rep AdminAccount x -> AdminAccount
forall x. AdminAccount -> Rep AdminAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminAccount x -> AdminAccount
$cfrom :: forall x. AdminAccount -> Rep AdminAccount x
Prelude.Generic)

-- |
-- Create a value of 'AdminAccount' 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:
--
-- 'status', 'adminAccount_status' - The current status of the account as the delegated administrator of
-- Amazon Macie for the organization.
--
-- 'accountId', 'adminAccount_accountId' - The Amazon Web Services account ID for the account.
newAdminAccount ::
  AdminAccount
newAdminAccount :: AdminAccount
newAdminAccount =
  AdminAccount' :: Maybe AdminStatus -> Maybe Text -> AdminAccount
AdminAccount'
    { $sel:status:AdminAccount' :: Maybe AdminStatus
status = Maybe AdminStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AdminAccount' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the account as the delegated administrator of
-- Amazon Macie for the organization.
adminAccount_status :: Lens.Lens' AdminAccount (Prelude.Maybe AdminStatus)
adminAccount_status :: (Maybe AdminStatus -> f (Maybe AdminStatus))
-> AdminAccount -> f AdminAccount
adminAccount_status = (AdminAccount -> Maybe AdminStatus)
-> (AdminAccount -> Maybe AdminStatus -> AdminAccount)
-> Lens
     AdminAccount AdminAccount (Maybe AdminStatus) (Maybe AdminStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminAccount' {Maybe AdminStatus
status :: Maybe AdminStatus
$sel:status:AdminAccount' :: AdminAccount -> Maybe AdminStatus
status} -> Maybe AdminStatus
status) (\s :: AdminAccount
s@AdminAccount' {} Maybe AdminStatus
a -> AdminAccount
s {$sel:status:AdminAccount' :: Maybe AdminStatus
status = Maybe AdminStatus
a} :: AdminAccount)

-- | The Amazon Web Services account ID for the account.
adminAccount_accountId :: Lens.Lens' AdminAccount (Prelude.Maybe Prelude.Text)
adminAccount_accountId :: (Maybe Text -> f (Maybe Text)) -> AdminAccount -> f AdminAccount
adminAccount_accountId = (AdminAccount -> Maybe Text)
-> (AdminAccount -> Maybe Text -> AdminAccount)
-> Lens AdminAccount AdminAccount (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminAccount' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AdminAccount' :: AdminAccount -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AdminAccount
s@AdminAccount' {} Maybe Text
a -> AdminAccount
s {$sel:accountId:AdminAccount' :: Maybe Text
accountId = Maybe Text
a} :: AdminAccount)

instance Core.FromJSON AdminAccount where
  parseJSON :: Value -> Parser AdminAccount
parseJSON =
    String
-> (Object -> Parser AdminAccount) -> Value -> Parser AdminAccount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AdminAccount"
      ( \Object
x ->
          Maybe AdminStatus -> Maybe Text -> AdminAccount
AdminAccount'
            (Maybe AdminStatus -> Maybe Text -> AdminAccount)
-> Parser (Maybe AdminStatus)
-> Parser (Maybe Text -> AdminAccount)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AdminStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe Text -> AdminAccount)
-> Parser (Maybe Text) -> Parser AdminAccount
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
"accountId")
      )

instance Prelude.Hashable AdminAccount

instance Prelude.NFData AdminAccount