{-# 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.CognitoIdentity.Types.IdentityPool
-- 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.CognitoIdentity.Types.IdentityPool where

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

-- | An object representing an Amazon Cognito identity pool.
--
-- /See:/ 'newIdentityPool' smart constructor.
data IdentityPool = IdentityPool'
  { -- | An array of Amazon Resource Names (ARNs) of the SAML provider for your
    -- identity pool.
    IdentityPool -> Maybe [Text]
samlProviderARNs :: Prelude.Maybe [Prelude.Text],
    -- | Optional key:value pairs mapping provider names to provider app IDs.
    IdentityPool -> Maybe (HashMap Text Text)
supportedLoginProviders :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Enables or disables the Basic (Classic) authentication flow. For more
    -- information, see
    -- <https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html Identity Pools (Federated Identities) Authentication Flow>
    -- in the /Amazon Cognito Developer Guide/.
    IdentityPool -> Maybe Bool
allowClassicFlow :: Prelude.Maybe Prelude.Bool,
    -- | The \"domain\" by which Cognito will refer to your users.
    IdentityPool -> Maybe Text
developerProviderName :: Prelude.Maybe Prelude.Text,
    -- | The tags that are assigned to the identity pool. A tag is a label that
    -- you can apply to identity pools to categorize and manage them in
    -- different ways, such as by purpose, owner, environment, or other
    -- criteria.
    IdentityPool -> Maybe (HashMap Text Text)
identityPoolTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARNs of the OpenID Connect providers.
    IdentityPool -> Maybe [Text]
openIdConnectProviderARNs :: Prelude.Maybe [Prelude.Text],
    -- | A list representing an Amazon Cognito user pool and its client ID.
    IdentityPool -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders :: Prelude.Maybe [CognitoIdentityProvider],
    -- | An identity pool ID in the format REGION:GUID.
    IdentityPool -> Text
identityPoolId :: Prelude.Text,
    -- | A string that you provide.
    IdentityPool -> Text
identityPoolName :: Prelude.Text,
    -- | TRUE if the identity pool supports unauthenticated logins.
    IdentityPool -> Bool
allowUnauthenticatedIdentities :: Prelude.Bool
  }
  deriving (IdentityPool -> IdentityPool -> Bool
(IdentityPool -> IdentityPool -> Bool)
-> (IdentityPool -> IdentityPool -> Bool) -> Eq IdentityPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityPool -> IdentityPool -> Bool
$c/= :: IdentityPool -> IdentityPool -> Bool
== :: IdentityPool -> IdentityPool -> Bool
$c== :: IdentityPool -> IdentityPool -> Bool
Prelude.Eq, ReadPrec [IdentityPool]
ReadPrec IdentityPool
Int -> ReadS IdentityPool
ReadS [IdentityPool]
(Int -> ReadS IdentityPool)
-> ReadS [IdentityPool]
-> ReadPrec IdentityPool
-> ReadPrec [IdentityPool]
-> Read IdentityPool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityPool]
$creadListPrec :: ReadPrec [IdentityPool]
readPrec :: ReadPrec IdentityPool
$creadPrec :: ReadPrec IdentityPool
readList :: ReadS [IdentityPool]
$creadList :: ReadS [IdentityPool]
readsPrec :: Int -> ReadS IdentityPool
$creadsPrec :: Int -> ReadS IdentityPool
Prelude.Read, Int -> IdentityPool -> ShowS
[IdentityPool] -> ShowS
IdentityPool -> String
(Int -> IdentityPool -> ShowS)
-> (IdentityPool -> String)
-> ([IdentityPool] -> ShowS)
-> Show IdentityPool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityPool] -> ShowS
$cshowList :: [IdentityPool] -> ShowS
show :: IdentityPool -> String
$cshow :: IdentityPool -> String
showsPrec :: Int -> IdentityPool -> ShowS
$cshowsPrec :: Int -> IdentityPool -> ShowS
Prelude.Show, (forall x. IdentityPool -> Rep IdentityPool x)
-> (forall x. Rep IdentityPool x -> IdentityPool)
-> Generic IdentityPool
forall x. Rep IdentityPool x -> IdentityPool
forall x. IdentityPool -> Rep IdentityPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityPool x -> IdentityPool
$cfrom :: forall x. IdentityPool -> Rep IdentityPool x
Prelude.Generic)

-- |
-- Create a value of 'IdentityPool' 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:
--
-- 'samlProviderARNs', 'identityPool_samlProviderARNs' - An array of Amazon Resource Names (ARNs) of the SAML provider for your
-- identity pool.
--
-- 'supportedLoginProviders', 'identityPool_supportedLoginProviders' - Optional key:value pairs mapping provider names to provider app IDs.
--
-- 'allowClassicFlow', 'identityPool_allowClassicFlow' - Enables or disables the Basic (Classic) authentication flow. For more
-- information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html Identity Pools (Federated Identities) Authentication Flow>
-- in the /Amazon Cognito Developer Guide/.
--
-- 'developerProviderName', 'identityPool_developerProviderName' - The \"domain\" by which Cognito will refer to your users.
--
-- 'identityPoolTags', 'identityPool_identityPoolTags' - The tags that are assigned to the identity pool. A tag is a label that
-- you can apply to identity pools to categorize and manage them in
-- different ways, such as by purpose, owner, environment, or other
-- criteria.
--
-- 'openIdConnectProviderARNs', 'identityPool_openIdConnectProviderARNs' - The ARNs of the OpenID Connect providers.
--
-- 'cognitoIdentityProviders', 'identityPool_cognitoIdentityProviders' - A list representing an Amazon Cognito user pool and its client ID.
--
-- 'identityPoolId', 'identityPool_identityPoolId' - An identity pool ID in the format REGION:GUID.
--
-- 'identityPoolName', 'identityPool_identityPoolName' - A string that you provide.
--
-- 'allowUnauthenticatedIdentities', 'identityPool_allowUnauthenticatedIdentities' - TRUE if the identity pool supports unauthenticated logins.
newIdentityPool ::
  -- | 'identityPoolId'
  Prelude.Text ->
  -- | 'identityPoolName'
  Prelude.Text ->
  -- | 'allowUnauthenticatedIdentities'
  Prelude.Bool ->
  IdentityPool
newIdentityPool :: Text -> Text -> Bool -> IdentityPool
newIdentityPool
  Text
pIdentityPoolId_
  Text
pIdentityPoolName_
  Bool
pAllowUnauthenticatedIdentities_ =
    IdentityPool' :: Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Text]
-> Maybe [CognitoIdentityProvider]
-> Text
-> Text
-> Bool
-> IdentityPool
IdentityPool'
      { $sel:samlProviderARNs:IdentityPool' :: Maybe [Text]
samlProviderARNs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:supportedLoginProviders:IdentityPool' :: Maybe (HashMap Text Text)
supportedLoginProviders = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:allowClassicFlow:IdentityPool' :: Maybe Bool
allowClassicFlow = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:developerProviderName:IdentityPool' :: Maybe Text
developerProviderName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:identityPoolTags:IdentityPool' :: Maybe (HashMap Text Text)
identityPoolTags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:openIdConnectProviderARNs:IdentityPool' :: Maybe [Text]
openIdConnectProviderARNs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:cognitoIdentityProviders:IdentityPool' :: Maybe [CognitoIdentityProvider]
cognitoIdentityProviders = Maybe [CognitoIdentityProvider]
forall a. Maybe a
Prelude.Nothing,
        $sel:identityPoolId:IdentityPool' :: Text
identityPoolId = Text
pIdentityPoolId_,
        $sel:identityPoolName:IdentityPool' :: Text
identityPoolName = Text
pIdentityPoolName_,
        $sel:allowUnauthenticatedIdentities:IdentityPool' :: Bool
allowUnauthenticatedIdentities =
          Bool
pAllowUnauthenticatedIdentities_
      }

-- | An array of Amazon Resource Names (ARNs) of the SAML provider for your
-- identity pool.
identityPool_samlProviderARNs :: Lens.Lens' IdentityPool (Prelude.Maybe [Prelude.Text])
identityPool_samlProviderARNs :: (Maybe [Text] -> f (Maybe [Text]))
-> IdentityPool -> f IdentityPool
identityPool_samlProviderARNs = (IdentityPool -> Maybe [Text])
-> (IdentityPool -> Maybe [Text] -> IdentityPool)
-> Lens IdentityPool IdentityPool (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe [Text]
samlProviderARNs :: Maybe [Text]
$sel:samlProviderARNs:IdentityPool' :: IdentityPool -> Maybe [Text]
samlProviderARNs} -> Maybe [Text]
samlProviderARNs) (\s :: IdentityPool
s@IdentityPool' {} Maybe [Text]
a -> IdentityPool
s {$sel:samlProviderARNs:IdentityPool' :: Maybe [Text]
samlProviderARNs = Maybe [Text]
a} :: IdentityPool) ((Maybe [Text] -> f (Maybe [Text]))
 -> IdentityPool -> f IdentityPool)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> IdentityPool
-> f IdentityPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Optional key:value pairs mapping provider names to provider app IDs.
identityPool_supportedLoginProviders :: Lens.Lens' IdentityPool (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
identityPool_supportedLoginProviders :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> IdentityPool -> f IdentityPool
identityPool_supportedLoginProviders = (IdentityPool -> Maybe (HashMap Text Text))
-> (IdentityPool -> Maybe (HashMap Text Text) -> IdentityPool)
-> Lens
     IdentityPool
     IdentityPool
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe (HashMap Text Text)
supportedLoginProviders :: Maybe (HashMap Text Text)
$sel:supportedLoginProviders:IdentityPool' :: IdentityPool -> Maybe (HashMap Text Text)
supportedLoginProviders} -> Maybe (HashMap Text Text)
supportedLoginProviders) (\s :: IdentityPool
s@IdentityPool' {} Maybe (HashMap Text Text)
a -> IdentityPool
s {$sel:supportedLoginProviders:IdentityPool' :: Maybe (HashMap Text Text)
supportedLoginProviders = Maybe (HashMap Text Text)
a} :: IdentityPool) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> IdentityPool -> f IdentityPool)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> IdentityPool
-> f IdentityPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Enables or disables the Basic (Classic) authentication flow. For more
-- information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html Identity Pools (Federated Identities) Authentication Flow>
-- in the /Amazon Cognito Developer Guide/.
identityPool_allowClassicFlow :: Lens.Lens' IdentityPool (Prelude.Maybe Prelude.Bool)
identityPool_allowClassicFlow :: (Maybe Bool -> f (Maybe Bool)) -> IdentityPool -> f IdentityPool
identityPool_allowClassicFlow = (IdentityPool -> Maybe Bool)
-> (IdentityPool -> Maybe Bool -> IdentityPool)
-> Lens IdentityPool IdentityPool (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe Bool
allowClassicFlow :: Maybe Bool
$sel:allowClassicFlow:IdentityPool' :: IdentityPool -> Maybe Bool
allowClassicFlow} -> Maybe Bool
allowClassicFlow) (\s :: IdentityPool
s@IdentityPool' {} Maybe Bool
a -> IdentityPool
s {$sel:allowClassicFlow:IdentityPool' :: Maybe Bool
allowClassicFlow = Maybe Bool
a} :: IdentityPool)

-- | The \"domain\" by which Cognito will refer to your users.
identityPool_developerProviderName :: Lens.Lens' IdentityPool (Prelude.Maybe Prelude.Text)
identityPool_developerProviderName :: (Maybe Text -> f (Maybe Text)) -> IdentityPool -> f IdentityPool
identityPool_developerProviderName = (IdentityPool -> Maybe Text)
-> (IdentityPool -> Maybe Text -> IdentityPool)
-> Lens IdentityPool IdentityPool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe Text
developerProviderName :: Maybe Text
$sel:developerProviderName:IdentityPool' :: IdentityPool -> Maybe Text
developerProviderName} -> Maybe Text
developerProviderName) (\s :: IdentityPool
s@IdentityPool' {} Maybe Text
a -> IdentityPool
s {$sel:developerProviderName:IdentityPool' :: Maybe Text
developerProviderName = Maybe Text
a} :: IdentityPool)

-- | The tags that are assigned to the identity pool. A tag is a label that
-- you can apply to identity pools to categorize and manage them in
-- different ways, such as by purpose, owner, environment, or other
-- criteria.
identityPool_identityPoolTags :: Lens.Lens' IdentityPool (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
identityPool_identityPoolTags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> IdentityPool -> f IdentityPool
identityPool_identityPoolTags = (IdentityPool -> Maybe (HashMap Text Text))
-> (IdentityPool -> Maybe (HashMap Text Text) -> IdentityPool)
-> Lens
     IdentityPool
     IdentityPool
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe (HashMap Text Text)
identityPoolTags :: Maybe (HashMap Text Text)
$sel:identityPoolTags:IdentityPool' :: IdentityPool -> Maybe (HashMap Text Text)
identityPoolTags} -> Maybe (HashMap Text Text)
identityPoolTags) (\s :: IdentityPool
s@IdentityPool' {} Maybe (HashMap Text Text)
a -> IdentityPool
s {$sel:identityPoolTags:IdentityPool' :: Maybe (HashMap Text Text)
identityPoolTags = Maybe (HashMap Text Text)
a} :: IdentityPool) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> IdentityPool -> f IdentityPool)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> IdentityPool
-> f IdentityPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARNs of the OpenID Connect providers.
identityPool_openIdConnectProviderARNs :: Lens.Lens' IdentityPool (Prelude.Maybe [Prelude.Text])
identityPool_openIdConnectProviderARNs :: (Maybe [Text] -> f (Maybe [Text]))
-> IdentityPool -> f IdentityPool
identityPool_openIdConnectProviderARNs = (IdentityPool -> Maybe [Text])
-> (IdentityPool -> Maybe [Text] -> IdentityPool)
-> Lens IdentityPool IdentityPool (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe [Text]
openIdConnectProviderARNs :: Maybe [Text]
$sel:openIdConnectProviderARNs:IdentityPool' :: IdentityPool -> Maybe [Text]
openIdConnectProviderARNs} -> Maybe [Text]
openIdConnectProviderARNs) (\s :: IdentityPool
s@IdentityPool' {} Maybe [Text]
a -> IdentityPool
s {$sel:openIdConnectProviderARNs:IdentityPool' :: Maybe [Text]
openIdConnectProviderARNs = Maybe [Text]
a} :: IdentityPool) ((Maybe [Text] -> f (Maybe [Text]))
 -> IdentityPool -> f IdentityPool)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> IdentityPool
-> f IdentityPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list representing an Amazon Cognito user pool and its client ID.
identityPool_cognitoIdentityProviders :: Lens.Lens' IdentityPool (Prelude.Maybe [CognitoIdentityProvider])
identityPool_cognitoIdentityProviders :: (Maybe [CognitoIdentityProvider]
 -> f (Maybe [CognitoIdentityProvider]))
-> IdentityPool -> f IdentityPool
identityPool_cognitoIdentityProviders = (IdentityPool -> Maybe [CognitoIdentityProvider])
-> (IdentityPool
    -> Maybe [CognitoIdentityProvider] -> IdentityPool)
-> Lens
     IdentityPool
     IdentityPool
     (Maybe [CognitoIdentityProvider])
     (Maybe [CognitoIdentityProvider])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Maybe [CognitoIdentityProvider]
cognitoIdentityProviders :: Maybe [CognitoIdentityProvider]
$sel:cognitoIdentityProviders:IdentityPool' :: IdentityPool -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders} -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders) (\s :: IdentityPool
s@IdentityPool' {} Maybe [CognitoIdentityProvider]
a -> IdentityPool
s {$sel:cognitoIdentityProviders:IdentityPool' :: Maybe [CognitoIdentityProvider]
cognitoIdentityProviders = Maybe [CognitoIdentityProvider]
a} :: IdentityPool) ((Maybe [CognitoIdentityProvider]
  -> f (Maybe [CognitoIdentityProvider]))
 -> IdentityPool -> f IdentityPool)
-> ((Maybe [CognitoIdentityProvider]
     -> f (Maybe [CognitoIdentityProvider]))
    -> Maybe [CognitoIdentityProvider]
    -> f (Maybe [CognitoIdentityProvider]))
-> (Maybe [CognitoIdentityProvider]
    -> f (Maybe [CognitoIdentityProvider]))
-> IdentityPool
-> f IdentityPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
-> Iso
     (Maybe [CognitoIdentityProvider])
     (Maybe [CognitoIdentityProvider])
     (Maybe [CognitoIdentityProvider])
     (Maybe [CognitoIdentityProvider])
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
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
  [CognitoIdentityProvider]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An identity pool ID in the format REGION:GUID.
identityPool_identityPoolId :: Lens.Lens' IdentityPool Prelude.Text
identityPool_identityPoolId :: (Text -> f Text) -> IdentityPool -> f IdentityPool
identityPool_identityPoolId = (IdentityPool -> Text)
-> (IdentityPool -> Text -> IdentityPool)
-> Lens IdentityPool IdentityPool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Text
identityPoolId :: Text
$sel:identityPoolId:IdentityPool' :: IdentityPool -> Text
identityPoolId} -> Text
identityPoolId) (\s :: IdentityPool
s@IdentityPool' {} Text
a -> IdentityPool
s {$sel:identityPoolId:IdentityPool' :: Text
identityPoolId = Text
a} :: IdentityPool)

-- | A string that you provide.
identityPool_identityPoolName :: Lens.Lens' IdentityPool Prelude.Text
identityPool_identityPoolName :: (Text -> f Text) -> IdentityPool -> f IdentityPool
identityPool_identityPoolName = (IdentityPool -> Text)
-> (IdentityPool -> Text -> IdentityPool)
-> Lens IdentityPool IdentityPool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Text
identityPoolName :: Text
$sel:identityPoolName:IdentityPool' :: IdentityPool -> Text
identityPoolName} -> Text
identityPoolName) (\s :: IdentityPool
s@IdentityPool' {} Text
a -> IdentityPool
s {$sel:identityPoolName:IdentityPool' :: Text
identityPoolName = Text
a} :: IdentityPool)

-- | TRUE if the identity pool supports unauthenticated logins.
identityPool_allowUnauthenticatedIdentities :: Lens.Lens' IdentityPool Prelude.Bool
identityPool_allowUnauthenticatedIdentities :: (Bool -> f Bool) -> IdentityPool -> f IdentityPool
identityPool_allowUnauthenticatedIdentities = (IdentityPool -> Bool)
-> (IdentityPool -> Bool -> IdentityPool)
-> Lens IdentityPool IdentityPool Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPool' {Bool
allowUnauthenticatedIdentities :: Bool
$sel:allowUnauthenticatedIdentities:IdentityPool' :: IdentityPool -> Bool
allowUnauthenticatedIdentities} -> Bool
allowUnauthenticatedIdentities) (\s :: IdentityPool
s@IdentityPool' {} Bool
a -> IdentityPool
s {$sel:allowUnauthenticatedIdentities:IdentityPool' :: Bool
allowUnauthenticatedIdentities = Bool
a} :: IdentityPool)

instance Core.FromJSON IdentityPool where
  parseJSON :: Value -> Parser IdentityPool
parseJSON =
    String
-> (Object -> Parser IdentityPool) -> Value -> Parser IdentityPool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IdentityPool"
      ( \Object
x ->
          Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Text]
-> Maybe [CognitoIdentityProvider]
-> Text
-> Text
-> Bool
-> IdentityPool
IdentityPool'
            (Maybe [Text]
 -> Maybe (HashMap Text Text)
 -> Maybe Bool
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe [Text]
 -> Maybe [CognitoIdentityProvider]
 -> Text
 -> Text
 -> Bool
 -> IdentityPool)
-> Parser (Maybe [Text])
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [Text]
      -> Maybe [CognitoIdentityProvider]
      -> Text
      -> Text
      -> Bool
      -> IdentityPool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SamlProviderARNs"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [Text]
   -> Maybe [CognitoIdentityProvider]
   -> Text
   -> Text
   -> Bool
   -> IdentityPool)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [Text]
      -> Maybe [CognitoIdentityProvider]
      -> Text
      -> Text
      -> Bool
      -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedLoginProviders"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [Text]
   -> Maybe [CognitoIdentityProvider]
   -> Text
   -> Text
   -> Bool
   -> IdentityPool)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe [Text]
      -> Maybe [CognitoIdentityProvider]
      -> Text
      -> Text
      -> Bool
      -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AllowClassicFlow")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe [Text]
   -> Maybe [CognitoIdentityProvider]
   -> Text
   -> Text
   -> Bool
   -> IdentityPool)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe [Text]
      -> Maybe [CognitoIdentityProvider]
      -> Text
      -> Text
      -> Bool
      -> IdentityPool)
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
"DeveloperProviderName")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe [Text]
   -> Maybe [CognitoIdentityProvider]
   -> Text
   -> Text
   -> Bool
   -> IdentityPool)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe [Text]
      -> Maybe [CognitoIdentityProvider]
      -> Text
      -> Text
      -> Bool
      -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IdentityPoolTags"
                            Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [Text]
   -> Maybe [CognitoIdentityProvider]
   -> Text
   -> Text
   -> Bool
   -> IdentityPool)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [CognitoIdentityProvider]
      -> Text -> Text -> Bool -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OpenIdConnectProviderARNs"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [CognitoIdentityProvider]
   -> Text -> Text -> Bool -> IdentityPool)
-> Parser (Maybe [CognitoIdentityProvider])
-> Parser (Text -> Text -> Bool -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [CognitoIdentityProvider]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CognitoIdentityProviders"
                            Parser (Maybe (Maybe [CognitoIdentityProvider]))
-> Maybe [CognitoIdentityProvider]
-> Parser (Maybe [CognitoIdentityProvider])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CognitoIdentityProvider]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> Bool -> IdentityPool)
-> Parser Text -> Parser (Text -> Bool -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"IdentityPoolId")
            Parser (Text -> Bool -> IdentityPool)
-> Parser Text -> Parser (Bool -> IdentityPool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"IdentityPoolName")
            Parser (Bool -> IdentityPool) -> Parser Bool -> Parser IdentityPool
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AllowUnauthenticatedIdentities")
      )

instance Prelude.Hashable IdentityPool

instance Prelude.NFData IdentityPool

instance Core.ToJSON IdentityPool where
  toJSON :: IdentityPool -> Value
toJSON IdentityPool' {Bool
Maybe Bool
Maybe [Text]
Maybe [CognitoIdentityProvider]
Maybe Text
Maybe (HashMap Text Text)
Text
allowUnauthenticatedIdentities :: Bool
identityPoolName :: Text
identityPoolId :: Text
cognitoIdentityProviders :: Maybe [CognitoIdentityProvider]
openIdConnectProviderARNs :: Maybe [Text]
identityPoolTags :: Maybe (HashMap Text Text)
developerProviderName :: Maybe Text
allowClassicFlow :: Maybe Bool
supportedLoginProviders :: Maybe (HashMap Text Text)
samlProviderARNs :: Maybe [Text]
$sel:allowUnauthenticatedIdentities:IdentityPool' :: IdentityPool -> Bool
$sel:identityPoolName:IdentityPool' :: IdentityPool -> Text
$sel:identityPoolId:IdentityPool' :: IdentityPool -> Text
$sel:cognitoIdentityProviders:IdentityPool' :: IdentityPool -> Maybe [CognitoIdentityProvider]
$sel:openIdConnectProviderARNs:IdentityPool' :: IdentityPool -> Maybe [Text]
$sel:identityPoolTags:IdentityPool' :: IdentityPool -> Maybe (HashMap Text Text)
$sel:developerProviderName:IdentityPool' :: IdentityPool -> Maybe Text
$sel:allowClassicFlow:IdentityPool' :: IdentityPool -> Maybe Bool
$sel:supportedLoginProviders:IdentityPool' :: IdentityPool -> Maybe (HashMap Text Text)
$sel:samlProviderARNs:IdentityPool' :: IdentityPool -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SamlProviderARNs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
samlProviderARNs,
            (Text
"SupportedLoginProviders" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
supportedLoginProviders,
            (Text
"AllowClassicFlow" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowClassicFlow,
            (Text
"DeveloperProviderName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
developerProviderName,
            (Text
"IdentityPoolTags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
identityPoolTags,
            (Text
"OpenIdConnectProviderARNs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
openIdConnectProviderARNs,
            (Text
"CognitoIdentityProviders" Text -> [CognitoIdentityProvider] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CognitoIdentityProvider] -> Pair)
-> Maybe [CognitoIdentityProvider] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdentityPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityPoolId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdentityPoolName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identityPoolName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"AllowUnauthenticatedIdentities"
                  Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
allowUnauthenticatedIdentities
              )
          ]
      )