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

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

-- | Contains information about the member account.
--
-- /See:/ 'newMember' smart constructor.
data Member = Member'
  { -- | The timestamp when the invitation was sent.
    Member -> Maybe Text
invitedAt :: Prelude.Maybe Prelude.Text,
    -- | The detector ID of the member account.
    Member -> Maybe Text
detectorId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the member account.
    Member -> Text
accountId :: Prelude.Text,
    -- | The administrator account ID.
    Member -> Text
masterId :: Prelude.Text,
    -- | The email address of the member account.
    Member -> Text
email :: Prelude.Text,
    -- | The status of the relationship between the member and the administrator.
    Member -> Text
relationshipStatus :: Prelude.Text,
    -- | The last-updated timestamp of the member.
    Member -> Text
updatedAt :: Prelude.Text
  }
  deriving (Member -> Member -> Bool
(Member -> Member -> Bool)
-> (Member -> Member -> Bool) -> Eq Member
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Member -> Member -> Bool
$c/= :: Member -> Member -> Bool
== :: Member -> Member -> Bool
$c== :: Member -> Member -> Bool
Prelude.Eq, ReadPrec [Member]
ReadPrec Member
Int -> ReadS Member
ReadS [Member]
(Int -> ReadS Member)
-> ReadS [Member]
-> ReadPrec Member
-> ReadPrec [Member]
-> Read Member
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Member]
$creadListPrec :: ReadPrec [Member]
readPrec :: ReadPrec Member
$creadPrec :: ReadPrec Member
readList :: ReadS [Member]
$creadList :: ReadS [Member]
readsPrec :: Int -> ReadS Member
$creadsPrec :: Int -> ReadS Member
Prelude.Read, Int -> Member -> ShowS
[Member] -> ShowS
Member -> String
(Int -> Member -> ShowS)
-> (Member -> String) -> ([Member] -> ShowS) -> Show Member
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Member] -> ShowS
$cshowList :: [Member] -> ShowS
show :: Member -> String
$cshow :: Member -> String
showsPrec :: Int -> Member -> ShowS
$cshowsPrec :: Int -> Member -> ShowS
Prelude.Show, (forall x. Member -> Rep Member x)
-> (forall x. Rep Member x -> Member) -> Generic Member
forall x. Rep Member x -> Member
forall x. Member -> Rep Member x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Member x -> Member
$cfrom :: forall x. Member -> Rep Member x
Prelude.Generic)

-- |
-- Create a value of 'Member' 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:
--
-- 'invitedAt', 'member_invitedAt' - The timestamp when the invitation was sent.
--
-- 'detectorId', 'member_detectorId' - The detector ID of the member account.
--
-- 'accountId', 'member_accountId' - The ID of the member account.
--
-- 'masterId', 'member_masterId' - The administrator account ID.
--
-- 'email', 'member_email' - The email address of the member account.
--
-- 'relationshipStatus', 'member_relationshipStatus' - The status of the relationship between the member and the administrator.
--
-- 'updatedAt', 'member_updatedAt' - The last-updated timestamp of the member.
newMember ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'masterId'
  Prelude.Text ->
  -- | 'email'
  Prelude.Text ->
  -- | 'relationshipStatus'
  Prelude.Text ->
  -- | 'updatedAt'
  Prelude.Text ->
  Member
newMember :: Text -> Text -> Text -> Text -> Text -> Member
newMember
  Text
pAccountId_
  Text
pMasterId_
  Text
pEmail_
  Text
pRelationshipStatus_
  Text
pUpdatedAt_ =
    Member' :: Maybe Text
-> Maybe Text -> Text -> Text -> Text -> Text -> Text -> Member
Member'
      { $sel:invitedAt:Member' :: Maybe Text
invitedAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:detectorId:Member' :: Maybe Text
detectorId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:accountId:Member' :: Text
accountId = Text
pAccountId_,
        $sel:masterId:Member' :: Text
masterId = Text
pMasterId_,
        $sel:email:Member' :: Text
email = Text
pEmail_,
        $sel:relationshipStatus:Member' :: Text
relationshipStatus = Text
pRelationshipStatus_,
        $sel:updatedAt:Member' :: Text
updatedAt = Text
pUpdatedAt_
      }

-- | The timestamp when the invitation was sent.
member_invitedAt :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_invitedAt :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_invitedAt = (Member -> Maybe Text)
-> (Member -> Maybe Text -> Member)
-> Lens Member Member (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Maybe Text
invitedAt :: Maybe Text
$sel:invitedAt:Member' :: Member -> Maybe Text
invitedAt} -> Maybe Text
invitedAt) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:invitedAt:Member' :: Maybe Text
invitedAt = Maybe Text
a} :: Member)

-- | The detector ID of the member account.
member_detectorId :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_detectorId :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_detectorId = (Member -> Maybe Text)
-> (Member -> Maybe Text -> Member)
-> Lens Member Member (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Maybe Text
detectorId :: Maybe Text
$sel:detectorId:Member' :: Member -> Maybe Text
detectorId} -> Maybe Text
detectorId) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:detectorId:Member' :: Maybe Text
detectorId = Maybe Text
a} :: Member)

-- | The ID of the member account.
member_accountId :: Lens.Lens' Member Prelude.Text
member_accountId :: (Text -> f Text) -> Member -> f Member
member_accountId = (Member -> Text)
-> (Member -> Text -> Member) -> Lens Member Member Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Text
accountId :: Text
$sel:accountId:Member' :: Member -> Text
accountId} -> Text
accountId) (\s :: Member
s@Member' {} Text
a -> Member
s {$sel:accountId:Member' :: Text
accountId = Text
a} :: Member)

-- | The administrator account ID.
member_masterId :: Lens.Lens' Member Prelude.Text
member_masterId :: (Text -> f Text) -> Member -> f Member
member_masterId = (Member -> Text)
-> (Member -> Text -> Member) -> Lens Member Member Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Text
masterId :: Text
$sel:masterId:Member' :: Member -> Text
masterId} -> Text
masterId) (\s :: Member
s@Member' {} Text
a -> Member
s {$sel:masterId:Member' :: Text
masterId = Text
a} :: Member)

-- | The email address of the member account.
member_email :: Lens.Lens' Member Prelude.Text
member_email :: (Text -> f Text) -> Member -> f Member
member_email = (Member -> Text)
-> (Member -> Text -> Member) -> Lens Member Member Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Text
email :: Text
$sel:email:Member' :: Member -> Text
email} -> Text
email) (\s :: Member
s@Member' {} Text
a -> Member
s {$sel:email:Member' :: Text
email = Text
a} :: Member)

-- | The status of the relationship between the member and the administrator.
member_relationshipStatus :: Lens.Lens' Member Prelude.Text
member_relationshipStatus :: (Text -> f Text) -> Member -> f Member
member_relationshipStatus = (Member -> Text)
-> (Member -> Text -> Member) -> Lens Member Member Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Text
relationshipStatus :: Text
$sel:relationshipStatus:Member' :: Member -> Text
relationshipStatus} -> Text
relationshipStatus) (\s :: Member
s@Member' {} Text
a -> Member
s {$sel:relationshipStatus:Member' :: Text
relationshipStatus = Text
a} :: Member)

-- | The last-updated timestamp of the member.
member_updatedAt :: Lens.Lens' Member Prelude.Text
member_updatedAt :: (Text -> f Text) -> Member -> f Member
member_updatedAt = (Member -> Text)
-> (Member -> Text -> Member) -> Lens Member Member Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Text
updatedAt :: Text
$sel:updatedAt:Member' :: Member -> Text
updatedAt} -> Text
updatedAt) (\s :: Member
s@Member' {} Text
a -> Member
s {$sel:updatedAt:Member' :: Text
updatedAt = Text
a} :: Member)

instance Core.FromJSON Member where
  parseJSON :: Value -> Parser Member
parseJSON =
    String -> (Object -> Parser Member) -> Value -> Parser Member
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Member"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Text -> Text -> Text -> Text -> Text -> Member
Member'
            (Maybe Text
 -> Maybe Text -> Text -> Text -> Text -> Text -> Text -> Member)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Text -> Text -> Text -> Text -> Text -> Member)
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
"invitedAt")
            Parser
  (Maybe Text -> Text -> Text -> Text -> Text -> Text -> Member)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> Text -> Text -> Member)
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
"detectorId")
            Parser (Text -> Text -> Text -> Text -> Text -> Member)
-> Parser Text -> Parser (Text -> Text -> Text -> Text -> Member)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"accountId")
            Parser (Text -> Text -> Text -> Text -> Member)
-> Parser Text -> Parser (Text -> Text -> Text -> Member)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"masterId")
            Parser (Text -> Text -> Text -> Member)
-> Parser Text -> Parser (Text -> Text -> Member)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"email")
            Parser (Text -> Text -> Member)
-> Parser Text -> Parser (Text -> Member)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"relationshipStatus")
            Parser (Text -> Member) -> Parser Text -> Parser Member
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"updatedAt")
      )

instance Prelude.Hashable Member

instance Prelude.NFData Member