{-# 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.IoTEvents.Types.RecipientDetail
-- 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.IoTEvents.Types.RecipientDetail where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.SSOIdentity
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The information that identifies the recipient.
--
-- /See:/ 'newRecipientDetail' smart constructor.
data RecipientDetail = RecipientDetail'
  { -- | The AWS Single Sign-On (AWS SSO) authentication information.
    RecipientDetail -> Maybe SSOIdentity
ssoIdentity :: Prelude.Maybe SSOIdentity
  }
  deriving (RecipientDetail -> RecipientDetail -> Bool
(RecipientDetail -> RecipientDetail -> Bool)
-> (RecipientDetail -> RecipientDetail -> Bool)
-> Eq RecipientDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecipientDetail -> RecipientDetail -> Bool
$c/= :: RecipientDetail -> RecipientDetail -> Bool
== :: RecipientDetail -> RecipientDetail -> Bool
$c== :: RecipientDetail -> RecipientDetail -> Bool
Prelude.Eq, ReadPrec [RecipientDetail]
ReadPrec RecipientDetail
Int -> ReadS RecipientDetail
ReadS [RecipientDetail]
(Int -> ReadS RecipientDetail)
-> ReadS [RecipientDetail]
-> ReadPrec RecipientDetail
-> ReadPrec [RecipientDetail]
-> Read RecipientDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecipientDetail]
$creadListPrec :: ReadPrec [RecipientDetail]
readPrec :: ReadPrec RecipientDetail
$creadPrec :: ReadPrec RecipientDetail
readList :: ReadS [RecipientDetail]
$creadList :: ReadS [RecipientDetail]
readsPrec :: Int -> ReadS RecipientDetail
$creadsPrec :: Int -> ReadS RecipientDetail
Prelude.Read, Int -> RecipientDetail -> ShowS
[RecipientDetail] -> ShowS
RecipientDetail -> String
(Int -> RecipientDetail -> ShowS)
-> (RecipientDetail -> String)
-> ([RecipientDetail] -> ShowS)
-> Show RecipientDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecipientDetail] -> ShowS
$cshowList :: [RecipientDetail] -> ShowS
show :: RecipientDetail -> String
$cshow :: RecipientDetail -> String
showsPrec :: Int -> RecipientDetail -> ShowS
$cshowsPrec :: Int -> RecipientDetail -> ShowS
Prelude.Show, (forall x. RecipientDetail -> Rep RecipientDetail x)
-> (forall x. Rep RecipientDetail x -> RecipientDetail)
-> Generic RecipientDetail
forall x. Rep RecipientDetail x -> RecipientDetail
forall x. RecipientDetail -> Rep RecipientDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecipientDetail x -> RecipientDetail
$cfrom :: forall x. RecipientDetail -> Rep RecipientDetail x
Prelude.Generic)

-- |
-- Create a value of 'RecipientDetail' 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:
--
-- 'ssoIdentity', 'recipientDetail_ssoIdentity' - The AWS Single Sign-On (AWS SSO) authentication information.
newRecipientDetail ::
  RecipientDetail
newRecipientDetail :: RecipientDetail
newRecipientDetail =
  RecipientDetail' :: Maybe SSOIdentity -> RecipientDetail
RecipientDetail' {$sel:ssoIdentity:RecipientDetail' :: Maybe SSOIdentity
ssoIdentity = Maybe SSOIdentity
forall a. Maybe a
Prelude.Nothing}

-- | The AWS Single Sign-On (AWS SSO) authentication information.
recipientDetail_ssoIdentity :: Lens.Lens' RecipientDetail (Prelude.Maybe SSOIdentity)
recipientDetail_ssoIdentity :: (Maybe SSOIdentity -> f (Maybe SSOIdentity))
-> RecipientDetail -> f RecipientDetail
recipientDetail_ssoIdentity = (RecipientDetail -> Maybe SSOIdentity)
-> (RecipientDetail -> Maybe SSOIdentity -> RecipientDetail)
-> Lens
     RecipientDetail
     RecipientDetail
     (Maybe SSOIdentity)
     (Maybe SSOIdentity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
ssoIdentity} -> Maybe SSOIdentity
ssoIdentity) (\s :: RecipientDetail
s@RecipientDetail' {} Maybe SSOIdentity
a -> RecipientDetail
s {$sel:ssoIdentity:RecipientDetail' :: Maybe SSOIdentity
ssoIdentity = Maybe SSOIdentity
a} :: RecipientDetail)

instance Core.FromJSON RecipientDetail where
  parseJSON :: Value -> Parser RecipientDetail
parseJSON =
    String
-> (Object -> Parser RecipientDetail)
-> Value
-> Parser RecipientDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecipientDetail"
      ( \Object
x ->
          Maybe SSOIdentity -> RecipientDetail
RecipientDetail'
            (Maybe SSOIdentity -> RecipientDetail)
-> Parser (Maybe SSOIdentity) -> Parser RecipientDetail
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SSOIdentity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ssoIdentity")
      )

instance Prelude.Hashable RecipientDetail

instance Prelude.NFData RecipientDetail

instance Core.ToJSON RecipientDetail where
  toJSON :: RecipientDetail -> Value
toJSON RecipientDetail' {Maybe SSOIdentity
ssoIdentity :: Maybe SSOIdentity
$sel:ssoIdentity:RecipientDetail' :: RecipientDetail -> Maybe SSOIdentity
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"ssoIdentity" Text -> SSOIdentity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SSOIdentity -> Pair) -> Maybe SSOIdentity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SSOIdentity
ssoIdentity]
      )