{-# 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.Inspector2.Types.DelegatedAdmin
-- 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.Inspector2.Types.DelegatedAdmin where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.RelationshipStatus
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'DelegatedAdmin' 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', 'delegatedAdmin_accountId' - The Amazon Web Services account ID of the Amazon Inspector delegated
-- administrator for your organization.
--
-- 'relationshipStatus', 'delegatedAdmin_relationshipStatus' - The status of the Amazon Inspector delegated administrator.
newDelegatedAdmin ::
  DelegatedAdmin
newDelegatedAdmin :: DelegatedAdmin
newDelegatedAdmin =
  DelegatedAdmin'
    { $sel:accountId:DelegatedAdmin' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:relationshipStatus:DelegatedAdmin' :: Maybe RelationshipStatus
relationshipStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID of the Amazon Inspector delegated
-- administrator for your organization.
delegatedAdmin_accountId :: Lens.Lens' DelegatedAdmin (Prelude.Maybe Prelude.Text)
delegatedAdmin_accountId :: Lens' DelegatedAdmin (Maybe Text)
delegatedAdmin_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegatedAdmin' {Maybe Text
accountId :: Maybe Text
$sel:accountId:DelegatedAdmin' :: DelegatedAdmin -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: DelegatedAdmin
s@DelegatedAdmin' {} Maybe Text
a -> DelegatedAdmin
s {$sel:accountId:DelegatedAdmin' :: Maybe Text
accountId = Maybe Text
a} :: DelegatedAdmin)

-- | The status of the Amazon Inspector delegated administrator.
delegatedAdmin_relationshipStatus :: Lens.Lens' DelegatedAdmin (Prelude.Maybe RelationshipStatus)
delegatedAdmin_relationshipStatus :: Lens' DelegatedAdmin (Maybe RelationshipStatus)
delegatedAdmin_relationshipStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegatedAdmin' {Maybe RelationshipStatus
relationshipStatus :: Maybe RelationshipStatus
$sel:relationshipStatus:DelegatedAdmin' :: DelegatedAdmin -> Maybe RelationshipStatus
relationshipStatus} -> Maybe RelationshipStatus
relationshipStatus) (\s :: DelegatedAdmin
s@DelegatedAdmin' {} Maybe RelationshipStatus
a -> DelegatedAdmin
s {$sel:relationshipStatus:DelegatedAdmin' :: Maybe RelationshipStatus
relationshipStatus = Maybe RelationshipStatus
a} :: DelegatedAdmin)

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

instance Prelude.Hashable DelegatedAdmin where
  hashWithSalt :: Int -> DelegatedAdmin -> Int
hashWithSalt Int
_salt DelegatedAdmin' {Maybe Text
Maybe RelationshipStatus
relationshipStatus :: Maybe RelationshipStatus
accountId :: Maybe Text
$sel:relationshipStatus:DelegatedAdmin' :: DelegatedAdmin -> Maybe RelationshipStatus
$sel:accountId:DelegatedAdmin' :: DelegatedAdmin -> 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 RelationshipStatus
relationshipStatus

instance Prelude.NFData DelegatedAdmin where
  rnf :: DelegatedAdmin -> ()
rnf DelegatedAdmin' {Maybe Text
Maybe RelationshipStatus
relationshipStatus :: Maybe RelationshipStatus
accountId :: Maybe Text
$sel:relationshipStatus:DelegatedAdmin' :: DelegatedAdmin -> Maybe RelationshipStatus
$sel:accountId:DelegatedAdmin' :: DelegatedAdmin -> 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 RelationshipStatus
relationshipStatus