{-# 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.Detective.Types.Administrator
-- 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.Detective.Types.Administrator 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

-- | Information about the Detective administrator account for an
-- organization.
--
-- /See:/ 'newAdministrator' smart constructor.
data Administrator = Administrator'
  { -- | The Amazon Web Services account identifier of the Detective
    -- administrator account for the organization.
    Administrator -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the Detective administrator account was enabled.
    -- The value is an ISO8601 formatted string. For example,
    -- @2021-08-18T16:35:56.284Z@.
    Administrator -> Maybe ISO8601
delegationTime :: Prelude.Maybe Data.ISO8601,
    -- | The ARN of the organization behavior graph.
    Administrator -> Maybe Text
graphArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Administrator -> Administrator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Administrator -> Administrator -> Bool
$c/= :: Administrator -> Administrator -> Bool
== :: Administrator -> Administrator -> Bool
$c== :: Administrator -> Administrator -> Bool
Prelude.Eq, ReadPrec [Administrator]
ReadPrec Administrator
Int -> ReadS Administrator
ReadS [Administrator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Administrator]
$creadListPrec :: ReadPrec [Administrator]
readPrec :: ReadPrec Administrator
$creadPrec :: ReadPrec Administrator
readList :: ReadS [Administrator]
$creadList :: ReadS [Administrator]
readsPrec :: Int -> ReadS Administrator
$creadsPrec :: Int -> ReadS Administrator
Prelude.Read, Int -> Administrator -> ShowS
[Administrator] -> ShowS
Administrator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Administrator] -> ShowS
$cshowList :: [Administrator] -> ShowS
show :: Administrator -> String
$cshow :: Administrator -> String
showsPrec :: Int -> Administrator -> ShowS
$cshowsPrec :: Int -> Administrator -> ShowS
Prelude.Show, forall x. Rep Administrator x -> Administrator
forall x. Administrator -> Rep Administrator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Administrator x -> Administrator
$cfrom :: forall x. Administrator -> Rep Administrator x
Prelude.Generic)

-- |
-- Create a value of 'Administrator' 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', 'administrator_accountId' - The Amazon Web Services account identifier of the Detective
-- administrator account for the organization.
--
-- 'delegationTime', 'administrator_delegationTime' - The date and time when the Detective administrator account was enabled.
-- The value is an ISO8601 formatted string. For example,
-- @2021-08-18T16:35:56.284Z@.
--
-- 'graphArn', 'administrator_graphArn' - The ARN of the organization behavior graph.
newAdministrator ::
  Administrator
newAdministrator :: Administrator
newAdministrator =
  Administrator'
    { $sel:accountId:Administrator' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:delegationTime:Administrator' :: Maybe ISO8601
delegationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:graphArn:Administrator' :: Maybe Text
graphArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account identifier of the Detective
-- administrator account for the organization.
administrator_accountId :: Lens.Lens' Administrator (Prelude.Maybe Prelude.Text)
administrator_accountId :: Lens' Administrator (Maybe Text)
administrator_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Administrator' {Maybe Text
accountId :: Maybe Text
$sel:accountId:Administrator' :: Administrator -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Administrator
s@Administrator' {} Maybe Text
a -> Administrator
s {$sel:accountId:Administrator' :: Maybe Text
accountId = Maybe Text
a} :: Administrator)

-- | The date and time when the Detective administrator account was enabled.
-- The value is an ISO8601 formatted string. For example,
-- @2021-08-18T16:35:56.284Z@.
administrator_delegationTime :: Lens.Lens' Administrator (Prelude.Maybe Prelude.UTCTime)
administrator_delegationTime :: Lens' Administrator (Maybe UTCTime)
administrator_delegationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Administrator' {Maybe ISO8601
delegationTime :: Maybe ISO8601
$sel:delegationTime:Administrator' :: Administrator -> Maybe ISO8601
delegationTime} -> Maybe ISO8601
delegationTime) (\s :: Administrator
s@Administrator' {} Maybe ISO8601
a -> Administrator
s {$sel:delegationTime:Administrator' :: Maybe ISO8601
delegationTime = Maybe ISO8601
a} :: Administrator) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ARN of the organization behavior graph.
administrator_graphArn :: Lens.Lens' Administrator (Prelude.Maybe Prelude.Text)
administrator_graphArn :: Lens' Administrator (Maybe Text)
administrator_graphArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Administrator' {Maybe Text
graphArn :: Maybe Text
$sel:graphArn:Administrator' :: Administrator -> Maybe Text
graphArn} -> Maybe Text
graphArn) (\s :: Administrator
s@Administrator' {} Maybe Text
a -> Administrator
s {$sel:graphArn:Administrator' :: Maybe Text
graphArn = Maybe Text
a} :: Administrator)

instance Data.FromJSON Administrator where
  parseJSON :: Value -> Parser Administrator
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Administrator"
      ( \Object
x ->
          Maybe Text -> Maybe ISO8601 -> Maybe Text -> Administrator
Administrator'
            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
"DelegationTime")
            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
"GraphArn")
      )

instance Prelude.Hashable Administrator where
  hashWithSalt :: Int -> Administrator -> Int
hashWithSalt Int
_salt Administrator' {Maybe Text
Maybe ISO8601
graphArn :: Maybe Text
delegationTime :: Maybe ISO8601
accountId :: Maybe Text
$sel:graphArn:Administrator' :: Administrator -> Maybe Text
$sel:delegationTime:Administrator' :: Administrator -> Maybe ISO8601
$sel:accountId:Administrator' :: Administrator -> 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 ISO8601
delegationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
graphArn

instance Prelude.NFData Administrator where
  rnf :: Administrator -> ()
rnf Administrator' {Maybe Text
Maybe ISO8601
graphArn :: Maybe Text
delegationTime :: Maybe ISO8601
accountId :: Maybe Text
$sel:graphArn:Administrator' :: Administrator -> Maybe Text
$sel:delegationTime:Administrator' :: Administrator -> Maybe ISO8601
$sel:accountId:Administrator' :: Administrator -> 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 ISO8601
delegationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
graphArn