{-# 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.CognitoIdentityProvider.Types.ProviderDescription
-- 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.CognitoIdentityProvider.Types.ProviderDescription where

import Amazonka.CognitoIdentityProvider.Types.IdentityProviderTypeType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A container for identity provider details.
--
-- /See:/ 'newProviderDescription' smart constructor.
data ProviderDescription = ProviderDescription'
  { -- | The date the provider was last modified.
    ProviderDescription -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | The identity provider type.
    ProviderDescription -> Maybe IdentityProviderTypeType
providerType :: Prelude.Maybe IdentityProviderTypeType,
    -- | The date the provider was added to the user pool.
    ProviderDescription -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The identity provider name.
    ProviderDescription -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text
  }
  deriving (ProviderDescription -> ProviderDescription -> Bool
(ProviderDescription -> ProviderDescription -> Bool)
-> (ProviderDescription -> ProviderDescription -> Bool)
-> Eq ProviderDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProviderDescription -> ProviderDescription -> Bool
$c/= :: ProviderDescription -> ProviderDescription -> Bool
== :: ProviderDescription -> ProviderDescription -> Bool
$c== :: ProviderDescription -> ProviderDescription -> Bool
Prelude.Eq, ReadPrec [ProviderDescription]
ReadPrec ProviderDescription
Int -> ReadS ProviderDescription
ReadS [ProviderDescription]
(Int -> ReadS ProviderDescription)
-> ReadS [ProviderDescription]
-> ReadPrec ProviderDescription
-> ReadPrec [ProviderDescription]
-> Read ProviderDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProviderDescription]
$creadListPrec :: ReadPrec [ProviderDescription]
readPrec :: ReadPrec ProviderDescription
$creadPrec :: ReadPrec ProviderDescription
readList :: ReadS [ProviderDescription]
$creadList :: ReadS [ProviderDescription]
readsPrec :: Int -> ReadS ProviderDescription
$creadsPrec :: Int -> ReadS ProviderDescription
Prelude.Read, Int -> ProviderDescription -> ShowS
[ProviderDescription] -> ShowS
ProviderDescription -> String
(Int -> ProviderDescription -> ShowS)
-> (ProviderDescription -> String)
-> ([ProviderDescription] -> ShowS)
-> Show ProviderDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProviderDescription] -> ShowS
$cshowList :: [ProviderDescription] -> ShowS
show :: ProviderDescription -> String
$cshow :: ProviderDescription -> String
showsPrec :: Int -> ProviderDescription -> ShowS
$cshowsPrec :: Int -> ProviderDescription -> ShowS
Prelude.Show, (forall x. ProviderDescription -> Rep ProviderDescription x)
-> (forall x. Rep ProviderDescription x -> ProviderDescription)
-> Generic ProviderDescription
forall x. Rep ProviderDescription x -> ProviderDescription
forall x. ProviderDescription -> Rep ProviderDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProviderDescription x -> ProviderDescription
$cfrom :: forall x. ProviderDescription -> Rep ProviderDescription x
Prelude.Generic)

-- |
-- Create a value of 'ProviderDescription' 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:
--
-- 'lastModifiedDate', 'providerDescription_lastModifiedDate' - The date the provider was last modified.
--
-- 'providerType', 'providerDescription_providerType' - The identity provider type.
--
-- 'creationDate', 'providerDescription_creationDate' - The date the provider was added to the user pool.
--
-- 'providerName', 'providerDescription_providerName' - The identity provider name.
newProviderDescription ::
  ProviderDescription
newProviderDescription :: ProviderDescription
newProviderDescription =
  ProviderDescription' :: Maybe POSIX
-> Maybe IdentityProviderTypeType
-> Maybe POSIX
-> Maybe Text
-> ProviderDescription
ProviderDescription'
    { $sel:lastModifiedDate:ProviderDescription' :: Maybe POSIX
lastModifiedDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:ProviderDescription' :: Maybe IdentityProviderTypeType
providerType = Maybe IdentityProviderTypeType
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ProviderDescription' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:providerName:ProviderDescription' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date the provider was last modified.
providerDescription_lastModifiedDate :: Lens.Lens' ProviderDescription (Prelude.Maybe Prelude.UTCTime)
providerDescription_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProviderDescription -> f ProviderDescription
providerDescription_lastModifiedDate = (ProviderDescription -> Maybe POSIX)
-> (ProviderDescription -> Maybe POSIX -> ProviderDescription)
-> Lens
     ProviderDescription ProviderDescription (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderDescription' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:ProviderDescription' :: ProviderDescription -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: ProviderDescription
s@ProviderDescription' {} Maybe POSIX
a -> ProviderDescription
s {$sel:lastModifiedDate:ProviderDescription' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: ProviderDescription) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProviderDescription -> f ProviderDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProviderDescription
-> f ProviderDescription
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 identity provider type.
providerDescription_providerType :: Lens.Lens' ProviderDescription (Prelude.Maybe IdentityProviderTypeType)
providerDescription_providerType :: (Maybe IdentityProviderTypeType
 -> f (Maybe IdentityProviderTypeType))
-> ProviderDescription -> f ProviderDescription
providerDescription_providerType = (ProviderDescription -> Maybe IdentityProviderTypeType)
-> (ProviderDescription
    -> Maybe IdentityProviderTypeType -> ProviderDescription)
-> Lens
     ProviderDescription
     ProviderDescription
     (Maybe IdentityProviderTypeType)
     (Maybe IdentityProviderTypeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderDescription' {Maybe IdentityProviderTypeType
providerType :: Maybe IdentityProviderTypeType
$sel:providerType:ProviderDescription' :: ProviderDescription -> Maybe IdentityProviderTypeType
providerType} -> Maybe IdentityProviderTypeType
providerType) (\s :: ProviderDescription
s@ProviderDescription' {} Maybe IdentityProviderTypeType
a -> ProviderDescription
s {$sel:providerType:ProviderDescription' :: Maybe IdentityProviderTypeType
providerType = Maybe IdentityProviderTypeType
a} :: ProviderDescription)

-- | The date the provider was added to the user pool.
providerDescription_creationDate :: Lens.Lens' ProviderDescription (Prelude.Maybe Prelude.UTCTime)
providerDescription_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProviderDescription -> f ProviderDescription
providerDescription_creationDate = (ProviderDescription -> Maybe POSIX)
-> (ProviderDescription -> Maybe POSIX -> ProviderDescription)
-> Lens
     ProviderDescription ProviderDescription (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderDescription' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:ProviderDescription' :: ProviderDescription -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: ProviderDescription
s@ProviderDescription' {} Maybe POSIX
a -> ProviderDescription
s {$sel:creationDate:ProviderDescription' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: ProviderDescription) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProviderDescription -> f ProviderDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProviderDescription
-> f ProviderDescription
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 identity provider name.
providerDescription_providerName :: Lens.Lens' ProviderDescription (Prelude.Maybe Prelude.Text)
providerDescription_providerName :: (Maybe Text -> f (Maybe Text))
-> ProviderDescription -> f ProviderDescription
providerDescription_providerName = (ProviderDescription -> Maybe Text)
-> (ProviderDescription -> Maybe Text -> ProviderDescription)
-> Lens
     ProviderDescription ProviderDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProviderDescription' {Maybe Text
providerName :: Maybe Text
$sel:providerName:ProviderDescription' :: ProviderDescription -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: ProviderDescription
s@ProviderDescription' {} Maybe Text
a -> ProviderDescription
s {$sel:providerName:ProviderDescription' :: Maybe Text
providerName = Maybe Text
a} :: ProviderDescription)

instance Core.FromJSON ProviderDescription where
  parseJSON :: Value -> Parser ProviderDescription
parseJSON =
    String
-> (Object -> Parser ProviderDescription)
-> Value
-> Parser ProviderDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProviderDescription"
      ( \Object
x ->
          Maybe POSIX
-> Maybe IdentityProviderTypeType
-> Maybe POSIX
-> Maybe Text
-> ProviderDescription
ProviderDescription'
            (Maybe POSIX
 -> Maybe IdentityProviderTypeType
 -> Maybe POSIX
 -> Maybe Text
 -> ProviderDescription)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe IdentityProviderTypeType
      -> Maybe POSIX -> Maybe Text -> ProviderDescription)
forall (f :: * -> *) a b. Functor 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
"LastModifiedDate")
            Parser
  (Maybe IdentityProviderTypeType
   -> Maybe POSIX -> Maybe Text -> ProviderDescription)
-> Parser (Maybe IdentityProviderTypeType)
-> Parser (Maybe POSIX -> Maybe Text -> ProviderDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IdentityProviderTypeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProviderType")
            Parser (Maybe POSIX -> Maybe Text -> ProviderDescription)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> ProviderDescription)
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
"CreationDate")
            Parser (Maybe Text -> ProviderDescription)
-> Parser (Maybe Text) -> Parser ProviderDescription
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
"ProviderName")
      )

instance Prelude.Hashable ProviderDescription

instance Prelude.NFData ProviderDescription