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

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

-- | The details about a member account.
--
-- /See:/ 'newMember' smart constructor.
data Member = Member'
  { -- | The email address of the member account.
    Member -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
    -- | A timestamp for the date and time when the invitation was sent to the
    -- member account.
    Member -> Maybe POSIX
invitedAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Web Services account ID of the Security Hub administrator
    -- account associated with this member account.
    Member -> Maybe Text
administratorId :: Prelude.Maybe Prelude.Text,
    -- | This is replaced by @AdministratorID@.
    --
    -- The Amazon Web Services account ID of the Security Hub administrator
    -- account associated with this member account.
    Member -> Maybe Text
masterId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account ID of the member account.
    Member -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The status of the relationship between the member account and its
    -- administrator account.
    --
    -- The status can have one of the following values:
    --
    -- -   @CREATED@ - Indicates that the administrator account added the
    --     member account, but has not yet invited the member account.
    --
    -- -   @INVITED@ - Indicates that the administrator account invited the
    --     member account. The member account has not yet responded to the
    --     invitation.
    --
    -- -   @ENABLED@ - Indicates that the member account is currently active.
    --     For manually invited member accounts, indicates that the member
    --     account accepted the invitation.
    --
    -- -   @REMOVED@ - Indicates that the administrator account disassociated
    --     the member account.
    --
    -- -   @RESIGNED@ - Indicates that the member account disassociated
    --     themselves from the administrator account.
    --
    -- -   @DELETED@ - Indicates that the administrator account deleted the
    --     member account.
    --
    -- -   @ACCOUNT_SUSPENDED@ - Indicates that an organization account was
    --     suspended from Amazon Web Services at the same time that the
    --     administrator account tried to enable the organization account as a
    --     member account.
    Member -> Maybe Text
memberStatus :: Prelude.Maybe Prelude.Text,
    -- | The timestamp for the date and time when the member account was updated.
    Member -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX
  }
  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:
--
-- 'email', 'member_email' - The email address of the member account.
--
-- 'invitedAt', 'member_invitedAt' - A timestamp for the date and time when the invitation was sent to the
-- member account.
--
-- 'administratorId', 'member_administratorId' - The Amazon Web Services account ID of the Security Hub administrator
-- account associated with this member account.
--
-- 'masterId', 'member_masterId' - This is replaced by @AdministratorID@.
--
-- The Amazon Web Services account ID of the Security Hub administrator
-- account associated with this member account.
--
-- 'accountId', 'member_accountId' - The Amazon Web Services account ID of the member account.
--
-- 'memberStatus', 'member_memberStatus' - The status of the relationship between the member account and its
-- administrator account.
--
-- The status can have one of the following values:
--
-- -   @CREATED@ - Indicates that the administrator account added the
--     member account, but has not yet invited the member account.
--
-- -   @INVITED@ - Indicates that the administrator account invited the
--     member account. The member account has not yet responded to the
--     invitation.
--
-- -   @ENABLED@ - Indicates that the member account is currently active.
--     For manually invited member accounts, indicates that the member
--     account accepted the invitation.
--
-- -   @REMOVED@ - Indicates that the administrator account disassociated
--     the member account.
--
-- -   @RESIGNED@ - Indicates that the member account disassociated
--     themselves from the administrator account.
--
-- -   @DELETED@ - Indicates that the administrator account deleted the
--     member account.
--
-- -   @ACCOUNT_SUSPENDED@ - Indicates that an organization account was
--     suspended from Amazon Web Services at the same time that the
--     administrator account tried to enable the organization account as a
--     member account.
--
-- 'updatedAt', 'member_updatedAt' - The timestamp for the date and time when the member account was updated.
newMember ::
  Member
newMember :: Member
newMember =
  Member' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Member
Member'
    { $sel:email:Member' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:invitedAt:Member' :: Maybe POSIX
invitedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:administratorId:Member' :: Maybe Text
administratorId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:masterId:Member' :: Maybe Text
masterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:Member' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:memberStatus:Member' :: Maybe Text
memberStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:Member' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The email address of the member account.
member_email :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_email :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_email = (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
email :: Maybe Text
$sel:email:Member' :: Member -> Maybe Text
email} -> Maybe Text
email) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:email:Member' :: Maybe Text
email = Maybe Text
a} :: Member)

-- | A timestamp for the date and time when the invitation was sent to the
-- member account.
member_invitedAt :: Lens.Lens' Member (Prelude.Maybe Prelude.UTCTime)
member_invitedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Member -> f Member
member_invitedAt = (Member -> Maybe POSIX)
-> (Member -> Maybe POSIX -> Member)
-> Lens Member Member (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Maybe POSIX
invitedAt :: Maybe POSIX
$sel:invitedAt:Member' :: Member -> Maybe POSIX
invitedAt} -> Maybe POSIX
invitedAt) (\s :: Member
s@Member' {} Maybe POSIX
a -> Member
s {$sel:invitedAt:Member' :: Maybe POSIX
invitedAt = Maybe POSIX
a} :: Member) ((Maybe POSIX -> f (Maybe POSIX)) -> Member -> f Member)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Member
-> f Member
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Web Services account ID of the Security Hub administrator
-- account associated with this member account.
member_administratorId :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_administratorId :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_administratorId = (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
administratorId :: Maybe Text
$sel:administratorId:Member' :: Member -> Maybe Text
administratorId} -> Maybe Text
administratorId) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:administratorId:Member' :: Maybe Text
administratorId = Maybe Text
a} :: Member)

-- | This is replaced by @AdministratorID@.
--
-- The Amazon Web Services account ID of the Security Hub administrator
-- account associated with this member account.
member_masterId :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_masterId :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_masterId = (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
masterId :: Maybe Text
$sel:masterId:Member' :: Member -> Maybe Text
masterId} -> Maybe Text
masterId) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:masterId:Member' :: Maybe Text
masterId = Maybe Text
a} :: Member)

-- | The Amazon Web Services account ID of the member account.
member_accountId :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_accountId :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_accountId = (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
accountId :: Maybe Text
$sel:accountId:Member' :: Member -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:accountId:Member' :: Maybe Text
accountId = Maybe Text
a} :: Member)

-- | The status of the relationship between the member account and its
-- administrator account.
--
-- The status can have one of the following values:
--
-- -   @CREATED@ - Indicates that the administrator account added the
--     member account, but has not yet invited the member account.
--
-- -   @INVITED@ - Indicates that the administrator account invited the
--     member account. The member account has not yet responded to the
--     invitation.
--
-- -   @ENABLED@ - Indicates that the member account is currently active.
--     For manually invited member accounts, indicates that the member
--     account accepted the invitation.
--
-- -   @REMOVED@ - Indicates that the administrator account disassociated
--     the member account.
--
-- -   @RESIGNED@ - Indicates that the member account disassociated
--     themselves from the administrator account.
--
-- -   @DELETED@ - Indicates that the administrator account deleted the
--     member account.
--
-- -   @ACCOUNT_SUSPENDED@ - Indicates that an organization account was
--     suspended from Amazon Web Services at the same time that the
--     administrator account tried to enable the organization account as a
--     member account.
member_memberStatus :: Lens.Lens' Member (Prelude.Maybe Prelude.Text)
member_memberStatus :: (Maybe Text -> f (Maybe Text)) -> Member -> f Member
member_memberStatus = (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
memberStatus :: Maybe Text
$sel:memberStatus:Member' :: Member -> Maybe Text
memberStatus} -> Maybe Text
memberStatus) (\s :: Member
s@Member' {} Maybe Text
a -> Member
s {$sel:memberStatus:Member' :: Maybe Text
memberStatus = Maybe Text
a} :: Member)

-- | The timestamp for the date and time when the member account was updated.
member_updatedAt :: Lens.Lens' Member (Prelude.Maybe Prelude.UTCTime)
member_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Member -> f Member
member_updatedAt = (Member -> Maybe POSIX)
-> (Member -> Maybe POSIX -> Member)
-> Lens Member Member (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Member' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:Member' :: Member -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: Member
s@Member' {} Maybe POSIX
a -> Member
s {$sel:updatedAt:Member' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: Member) ((Maybe POSIX -> f (Maybe POSIX)) -> Member -> f Member)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Member
-> f Member
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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 POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Member
Member'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Member)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> 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
"Email")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Member)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Member)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InvitedAt")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Member)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> 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
"AdministratorId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Member)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> 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
"MasterId")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> Member)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> 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
"AccountId")
            Parser (Maybe Text -> Maybe POSIX -> Member)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> 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
"MemberStatus")
            Parser (Maybe POSIX -> Member)
-> Parser (Maybe POSIX) -> Parser Member
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedAt")
      )

instance Prelude.Hashable Member

instance Prelude.NFData Member