{-# 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.Macie.Types.MemberAccount
-- 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.Macie.Types.MemberAccount where

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

-- | Contains information about the Amazon Macie Classic member account.
--
-- /See:/ 'newMemberAccount' smart constructor.
data MemberAccount = MemberAccount'
  { -- | The AWS account ID of the Amazon Macie Classic member account.
    MemberAccount -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text
  }
  deriving (MemberAccount -> MemberAccount -> Bool
(MemberAccount -> MemberAccount -> Bool)
-> (MemberAccount -> MemberAccount -> Bool) -> Eq MemberAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberAccount -> MemberAccount -> Bool
$c/= :: MemberAccount -> MemberAccount -> Bool
== :: MemberAccount -> MemberAccount -> Bool
$c== :: MemberAccount -> MemberAccount -> Bool
Prelude.Eq, ReadPrec [MemberAccount]
ReadPrec MemberAccount
Int -> ReadS MemberAccount
ReadS [MemberAccount]
(Int -> ReadS MemberAccount)
-> ReadS [MemberAccount]
-> ReadPrec MemberAccount
-> ReadPrec [MemberAccount]
-> Read MemberAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemberAccount]
$creadListPrec :: ReadPrec [MemberAccount]
readPrec :: ReadPrec MemberAccount
$creadPrec :: ReadPrec MemberAccount
readList :: ReadS [MemberAccount]
$creadList :: ReadS [MemberAccount]
readsPrec :: Int -> ReadS MemberAccount
$creadsPrec :: Int -> ReadS MemberAccount
Prelude.Read, Int -> MemberAccount -> ShowS
[MemberAccount] -> ShowS
MemberAccount -> String
(Int -> MemberAccount -> ShowS)
-> (MemberAccount -> String)
-> ([MemberAccount] -> ShowS)
-> Show MemberAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberAccount] -> ShowS
$cshowList :: [MemberAccount] -> ShowS
show :: MemberAccount -> String
$cshow :: MemberAccount -> String
showsPrec :: Int -> MemberAccount -> ShowS
$cshowsPrec :: Int -> MemberAccount -> ShowS
Prelude.Show, (forall x. MemberAccount -> Rep MemberAccount x)
-> (forall x. Rep MemberAccount x -> MemberAccount)
-> Generic MemberAccount
forall x. Rep MemberAccount x -> MemberAccount
forall x. MemberAccount -> Rep MemberAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MemberAccount x -> MemberAccount
$cfrom :: forall x. MemberAccount -> Rep MemberAccount x
Prelude.Generic)

-- |
-- Create a value of 'MemberAccount' 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', 'memberAccount_accountId' - The AWS account ID of the Amazon Macie Classic member account.
newMemberAccount ::
  MemberAccount
newMemberAccount :: MemberAccount
newMemberAccount =
  MemberAccount' :: Maybe Text -> MemberAccount
MemberAccount' {$sel:accountId:MemberAccount' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The AWS account ID of the Amazon Macie Classic member account.
memberAccount_accountId :: Lens.Lens' MemberAccount (Prelude.Maybe Prelude.Text)
memberAccount_accountId :: (Maybe Text -> f (Maybe Text)) -> MemberAccount -> f MemberAccount
memberAccount_accountId = (MemberAccount -> Maybe Text)
-> (MemberAccount -> Maybe Text -> MemberAccount)
-> Lens MemberAccount MemberAccount (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberAccount' {Maybe Text
accountId :: Maybe Text
$sel:accountId:MemberAccount' :: MemberAccount -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: MemberAccount
s@MemberAccount' {} Maybe Text
a -> MemberAccount
s {$sel:accountId:MemberAccount' :: Maybe Text
accountId = Maybe Text
a} :: MemberAccount)

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

instance Prelude.Hashable MemberAccount

instance Prelude.NFData MemberAccount