{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateIdentityPool
-- 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)
--
-- Creates a new identity pool. The identity pool is a store of user
-- identity information that is specific to your AWS account. The keys for
-- @SupportedLoginProviders@ are as follows:
--
-- -   Facebook: @graph.facebook.com@
--
-- -   Google: @accounts.google.com@
--
-- -   Amazon: @www.amazon.com@
--
-- -   Twitter: @api.twitter.com@
--
-- -   Digits: @www.digits.com@
--
-- You must use AWS Developer credentials to call this API.
module Amazonka.CognitoIdentity.CreateIdentityPool
  ( -- * Creating a Request
    CreateIdentityPool (..),
    newCreateIdentityPool,

    -- * Request Lenses
    createIdentityPool_samlProviderARNs,
    createIdentityPool_supportedLoginProviders,
    createIdentityPool_allowClassicFlow,
    createIdentityPool_developerProviderName,
    createIdentityPool_identityPoolTags,
    createIdentityPool_openIdConnectProviderARNs,
    createIdentityPool_cognitoIdentityProviders,
    createIdentityPool_identityPoolName,
    createIdentityPool_allowUnauthenticatedIdentities,

    -- * Destructuring the Response
    IdentityPool (..),
    newIdentityPool,

    -- * Response Lenses
    identityPool_samlProviderARNs,
    identityPool_supportedLoginProviders,
    identityPool_allowClassicFlow,
    identityPool_developerProviderName,
    identityPool_identityPoolTags,
    identityPool_openIdConnectProviderARNs,
    identityPool_cognitoIdentityProviders,
    identityPool_identityPoolId,
    identityPool_identityPoolName,
    identityPool_allowUnauthenticatedIdentities,
  )
where

import Amazonka.CognitoIdentity.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Input to the CreateIdentityPool action.
--
-- /See:/ 'newCreateIdentityPool' smart constructor.
data CreateIdentityPool = CreateIdentityPool'
  { -- | An array of Amazon Resource Names (ARNs) of the SAML provider for your
    -- identity pool.
    CreateIdentityPool -> Maybe [Text]
samlProviderARNs :: Prelude.Maybe [Prelude.Text],
    -- | Optional key:value pairs mapping provider names to provider app IDs.
    CreateIdentityPool -> 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/.
    CreateIdentityPool -> Maybe Bool
allowClassicFlow :: Prelude.Maybe Prelude.Bool,
    -- | The \"domain\" by which Cognito will refer to your users. This name acts
    -- as a placeholder that allows your backend and the Cognito service to
    -- communicate about the developer provider. For the
    -- @DeveloperProviderName@, you can use letters as well as period (@.@),
    -- underscore (@_@), and dash (@-@).
    --
    -- Once you have set a developer provider name, you cannot change it.
    -- Please take care in setting this parameter.
    CreateIdentityPool -> Maybe Text
developerProviderName :: Prelude.Maybe Prelude.Text,
    -- | Tags to assign 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.
    CreateIdentityPool -> Maybe (HashMap Text Text)
identityPoolTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Names (ARN) of the OpenID Connect providers.
    CreateIdentityPool -> Maybe [Text]
openIdConnectProviderARNs :: Prelude.Maybe [Prelude.Text],
    -- | An array of Amazon Cognito user pools and their client IDs.
    CreateIdentityPool -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders :: Prelude.Maybe [CognitoIdentityProvider],
    -- | A string that you provide.
    CreateIdentityPool -> Text
identityPoolName :: Prelude.Text,
    -- | TRUE if the identity pool supports unauthenticated logins.
    CreateIdentityPool -> Bool
allowUnauthenticatedIdentities :: Prelude.Bool
  }
  deriving (CreateIdentityPool -> CreateIdentityPool -> Bool
(CreateIdentityPool -> CreateIdentityPool -> Bool)
-> (CreateIdentityPool -> CreateIdentityPool -> Bool)
-> Eq CreateIdentityPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateIdentityPool -> CreateIdentityPool -> Bool
$c/= :: CreateIdentityPool -> CreateIdentityPool -> Bool
== :: CreateIdentityPool -> CreateIdentityPool -> Bool
$c== :: CreateIdentityPool -> CreateIdentityPool -> Bool
Prelude.Eq, ReadPrec [CreateIdentityPool]
ReadPrec CreateIdentityPool
Int -> ReadS CreateIdentityPool
ReadS [CreateIdentityPool]
(Int -> ReadS CreateIdentityPool)
-> ReadS [CreateIdentityPool]
-> ReadPrec CreateIdentityPool
-> ReadPrec [CreateIdentityPool]
-> Read CreateIdentityPool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateIdentityPool]
$creadListPrec :: ReadPrec [CreateIdentityPool]
readPrec :: ReadPrec CreateIdentityPool
$creadPrec :: ReadPrec CreateIdentityPool
readList :: ReadS [CreateIdentityPool]
$creadList :: ReadS [CreateIdentityPool]
readsPrec :: Int -> ReadS CreateIdentityPool
$creadsPrec :: Int -> ReadS CreateIdentityPool
Prelude.Read, Int -> CreateIdentityPool -> ShowS
[CreateIdentityPool] -> ShowS
CreateIdentityPool -> String
(Int -> CreateIdentityPool -> ShowS)
-> (CreateIdentityPool -> String)
-> ([CreateIdentityPool] -> ShowS)
-> Show CreateIdentityPool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateIdentityPool] -> ShowS
$cshowList :: [CreateIdentityPool] -> ShowS
show :: CreateIdentityPool -> String
$cshow :: CreateIdentityPool -> String
showsPrec :: Int -> CreateIdentityPool -> ShowS
$cshowsPrec :: Int -> CreateIdentityPool -> ShowS
Prelude.Show, (forall x. CreateIdentityPool -> Rep CreateIdentityPool x)
-> (forall x. Rep CreateIdentityPool x -> CreateIdentityPool)
-> Generic CreateIdentityPool
forall x. Rep CreateIdentityPool x -> CreateIdentityPool
forall x. CreateIdentityPool -> Rep CreateIdentityPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateIdentityPool x -> CreateIdentityPool
$cfrom :: forall x. CreateIdentityPool -> Rep CreateIdentityPool x
Prelude.Generic)

-- |
-- Create a value of 'CreateIdentityPool' 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', 'createIdentityPool_samlProviderARNs' - An array of Amazon Resource Names (ARNs) of the SAML provider for your
-- identity pool.
--
-- 'supportedLoginProviders', 'createIdentityPool_supportedLoginProviders' - Optional key:value pairs mapping provider names to provider app IDs.
--
-- 'allowClassicFlow', 'createIdentityPool_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', 'createIdentityPool_developerProviderName' - The \"domain\" by which Cognito will refer to your users. This name acts
-- as a placeholder that allows your backend and the Cognito service to
-- communicate about the developer provider. For the
-- @DeveloperProviderName@, you can use letters as well as period (@.@),
-- underscore (@_@), and dash (@-@).
--
-- Once you have set a developer provider name, you cannot change it.
-- Please take care in setting this parameter.
--
-- 'identityPoolTags', 'createIdentityPool_identityPoolTags' - Tags to assign 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', 'createIdentityPool_openIdConnectProviderARNs' - The Amazon Resource Names (ARN) of the OpenID Connect providers.
--
-- 'cognitoIdentityProviders', 'createIdentityPool_cognitoIdentityProviders' - An array of Amazon Cognito user pools and their client IDs.
--
-- 'identityPoolName', 'createIdentityPool_identityPoolName' - A string that you provide.
--
-- 'allowUnauthenticatedIdentities', 'createIdentityPool_allowUnauthenticatedIdentities' - TRUE if the identity pool supports unauthenticated logins.
newCreateIdentityPool ::
  -- | 'identityPoolName'
  Prelude.Text ->
  -- | 'allowUnauthenticatedIdentities'
  Prelude.Bool ->
  CreateIdentityPool
newCreateIdentityPool :: Text -> Bool -> CreateIdentityPool
newCreateIdentityPool
  Text
pIdentityPoolName_
  Bool
pAllowUnauthenticatedIdentities_ =
    CreateIdentityPool' :: Maybe [Text]
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe [Text]
-> Maybe [CognitoIdentityProvider]
-> Text
-> Bool
-> CreateIdentityPool
CreateIdentityPool'
      { $sel:samlProviderARNs:CreateIdentityPool' :: Maybe [Text]
samlProviderARNs =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:supportedLoginProviders:CreateIdentityPool' :: Maybe (HashMap Text Text)
supportedLoginProviders = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:allowClassicFlow:CreateIdentityPool' :: Maybe Bool
allowClassicFlow = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:developerProviderName:CreateIdentityPool' :: Maybe Text
developerProviderName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:identityPoolTags:CreateIdentityPool' :: Maybe (HashMap Text Text)
identityPoolTags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:openIdConnectProviderARNs:CreateIdentityPool' :: Maybe [Text]
openIdConnectProviderARNs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:cognitoIdentityProviders:CreateIdentityPool' :: Maybe [CognitoIdentityProvider]
cognitoIdentityProviders = Maybe [CognitoIdentityProvider]
forall a. Maybe a
Prelude.Nothing,
        $sel:identityPoolName:CreateIdentityPool' :: Text
identityPoolName = Text
pIdentityPoolName_,
        $sel:allowUnauthenticatedIdentities:CreateIdentityPool' :: Bool
allowUnauthenticatedIdentities =
          Bool
pAllowUnauthenticatedIdentities_
      }

-- | An array of Amazon Resource Names (ARNs) of the SAML provider for your
-- identity pool.
createIdentityPool_samlProviderARNs :: Lens.Lens' CreateIdentityPool (Prelude.Maybe [Prelude.Text])
createIdentityPool_samlProviderARNs :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_samlProviderARNs = (CreateIdentityPool -> Maybe [Text])
-> (CreateIdentityPool -> Maybe [Text] -> CreateIdentityPool)
-> Lens
     CreateIdentityPool CreateIdentityPool (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIdentityPool' {Maybe [Text]
samlProviderARNs :: Maybe [Text]
$sel:samlProviderARNs:CreateIdentityPool' :: CreateIdentityPool -> Maybe [Text]
samlProviderARNs} -> Maybe [Text]
samlProviderARNs) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe [Text]
a -> CreateIdentityPool
s {$sel:samlProviderARNs:CreateIdentityPool' :: Maybe [Text]
samlProviderARNs = Maybe [Text]
a} :: CreateIdentityPool) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateIdentityPool -> f CreateIdentityPool)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateIdentityPool
-> f CreateIdentityPool
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.
createIdentityPool_supportedLoginProviders :: Lens.Lens' CreateIdentityPool (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createIdentityPool_supportedLoginProviders :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_supportedLoginProviders = (CreateIdentityPool -> Maybe (HashMap Text Text))
-> (CreateIdentityPool
    -> Maybe (HashMap Text Text) -> CreateIdentityPool)
-> Lens
     CreateIdentityPool
     CreateIdentityPool
     (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 (\CreateIdentityPool' {Maybe (HashMap Text Text)
supportedLoginProviders :: Maybe (HashMap Text Text)
$sel:supportedLoginProviders:CreateIdentityPool' :: CreateIdentityPool -> Maybe (HashMap Text Text)
supportedLoginProviders} -> Maybe (HashMap Text Text)
supportedLoginProviders) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe (HashMap Text Text)
a -> CreateIdentityPool
s {$sel:supportedLoginProviders:CreateIdentityPool' :: Maybe (HashMap Text Text)
supportedLoginProviders = Maybe (HashMap Text Text)
a} :: CreateIdentityPool) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateIdentityPool -> f CreateIdentityPool)
-> ((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)))
-> CreateIdentityPool
-> f CreateIdentityPool
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/.
createIdentityPool_allowClassicFlow :: Lens.Lens' CreateIdentityPool (Prelude.Maybe Prelude.Bool)
createIdentityPool_allowClassicFlow :: (Maybe Bool -> f (Maybe Bool))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_allowClassicFlow = (CreateIdentityPool -> Maybe Bool)
-> (CreateIdentityPool -> Maybe Bool -> CreateIdentityPool)
-> Lens
     CreateIdentityPool CreateIdentityPool (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIdentityPool' {Maybe Bool
allowClassicFlow :: Maybe Bool
$sel:allowClassicFlow:CreateIdentityPool' :: CreateIdentityPool -> Maybe Bool
allowClassicFlow} -> Maybe Bool
allowClassicFlow) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe Bool
a -> CreateIdentityPool
s {$sel:allowClassicFlow:CreateIdentityPool' :: Maybe Bool
allowClassicFlow = Maybe Bool
a} :: CreateIdentityPool)

-- | The \"domain\" by which Cognito will refer to your users. This name acts
-- as a placeholder that allows your backend and the Cognito service to
-- communicate about the developer provider. For the
-- @DeveloperProviderName@, you can use letters as well as period (@.@),
-- underscore (@_@), and dash (@-@).
--
-- Once you have set a developer provider name, you cannot change it.
-- Please take care in setting this parameter.
createIdentityPool_developerProviderName :: Lens.Lens' CreateIdentityPool (Prelude.Maybe Prelude.Text)
createIdentityPool_developerProviderName :: (Maybe Text -> f (Maybe Text))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_developerProviderName = (CreateIdentityPool -> Maybe Text)
-> (CreateIdentityPool -> Maybe Text -> CreateIdentityPool)
-> Lens
     CreateIdentityPool CreateIdentityPool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIdentityPool' {Maybe Text
developerProviderName :: Maybe Text
$sel:developerProviderName:CreateIdentityPool' :: CreateIdentityPool -> Maybe Text
developerProviderName} -> Maybe Text
developerProviderName) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe Text
a -> CreateIdentityPool
s {$sel:developerProviderName:CreateIdentityPool' :: Maybe Text
developerProviderName = Maybe Text
a} :: CreateIdentityPool)

-- | Tags to assign 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.
createIdentityPool_identityPoolTags :: Lens.Lens' CreateIdentityPool (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createIdentityPool_identityPoolTags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_identityPoolTags = (CreateIdentityPool -> Maybe (HashMap Text Text))
-> (CreateIdentityPool
    -> Maybe (HashMap Text Text) -> CreateIdentityPool)
-> Lens
     CreateIdentityPool
     CreateIdentityPool
     (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 (\CreateIdentityPool' {Maybe (HashMap Text Text)
identityPoolTags :: Maybe (HashMap Text Text)
$sel:identityPoolTags:CreateIdentityPool' :: CreateIdentityPool -> Maybe (HashMap Text Text)
identityPoolTags} -> Maybe (HashMap Text Text)
identityPoolTags) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe (HashMap Text Text)
a -> CreateIdentityPool
s {$sel:identityPoolTags:CreateIdentityPool' :: Maybe (HashMap Text Text)
identityPoolTags = Maybe (HashMap Text Text)
a} :: CreateIdentityPool) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateIdentityPool -> f CreateIdentityPool)
-> ((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)))
-> CreateIdentityPool
-> f CreateIdentityPool
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 Amazon Resource Names (ARN) of the OpenID Connect providers.
createIdentityPool_openIdConnectProviderARNs :: Lens.Lens' CreateIdentityPool (Prelude.Maybe [Prelude.Text])
createIdentityPool_openIdConnectProviderARNs :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_openIdConnectProviderARNs = (CreateIdentityPool -> Maybe [Text])
-> (CreateIdentityPool -> Maybe [Text] -> CreateIdentityPool)
-> Lens
     CreateIdentityPool CreateIdentityPool (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIdentityPool' {Maybe [Text]
openIdConnectProviderARNs :: Maybe [Text]
$sel:openIdConnectProviderARNs:CreateIdentityPool' :: CreateIdentityPool -> Maybe [Text]
openIdConnectProviderARNs} -> Maybe [Text]
openIdConnectProviderARNs) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe [Text]
a -> CreateIdentityPool
s {$sel:openIdConnectProviderARNs:CreateIdentityPool' :: Maybe [Text]
openIdConnectProviderARNs = Maybe [Text]
a} :: CreateIdentityPool) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateIdentityPool -> f CreateIdentityPool)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateIdentityPool
-> f CreateIdentityPool
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

-- | An array of Amazon Cognito user pools and their client IDs.
createIdentityPool_cognitoIdentityProviders :: Lens.Lens' CreateIdentityPool (Prelude.Maybe [CognitoIdentityProvider])
createIdentityPool_cognitoIdentityProviders :: (Maybe [CognitoIdentityProvider]
 -> f (Maybe [CognitoIdentityProvider]))
-> CreateIdentityPool -> f CreateIdentityPool
createIdentityPool_cognitoIdentityProviders = (CreateIdentityPool -> Maybe [CognitoIdentityProvider])
-> (CreateIdentityPool
    -> Maybe [CognitoIdentityProvider] -> CreateIdentityPool)
-> Lens
     CreateIdentityPool
     CreateIdentityPool
     (Maybe [CognitoIdentityProvider])
     (Maybe [CognitoIdentityProvider])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIdentityPool' {Maybe [CognitoIdentityProvider]
cognitoIdentityProviders :: Maybe [CognitoIdentityProvider]
$sel:cognitoIdentityProviders:CreateIdentityPool' :: CreateIdentityPool -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders} -> Maybe [CognitoIdentityProvider]
cognitoIdentityProviders) (\s :: CreateIdentityPool
s@CreateIdentityPool' {} Maybe [CognitoIdentityProvider]
a -> CreateIdentityPool
s {$sel:cognitoIdentityProviders:CreateIdentityPool' :: Maybe [CognitoIdentityProvider]
cognitoIdentityProviders = Maybe [CognitoIdentityProvider]
a} :: CreateIdentityPool) ((Maybe [CognitoIdentityProvider]
  -> f (Maybe [CognitoIdentityProvider]))
 -> CreateIdentityPool -> f CreateIdentityPool)
-> ((Maybe [CognitoIdentityProvider]
     -> f (Maybe [CognitoIdentityProvider]))
    -> Maybe [CognitoIdentityProvider]
    -> f (Maybe [CognitoIdentityProvider]))
-> (Maybe [CognitoIdentityProvider]
    -> f (Maybe [CognitoIdentityProvider]))
-> CreateIdentityPool
-> f CreateIdentityPool
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

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

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

instance Core.AWSRequest CreateIdentityPool where
  type AWSResponse CreateIdentityPool = IdentityPool
  request :: CreateIdentityPool -> Request CreateIdentityPool
request = Service -> CreateIdentityPool -> Request CreateIdentityPool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateIdentityPool
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateIdentityPool)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateIdentityPool))
-> Logger
-> Service
-> Proxy CreateIdentityPool
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateIdentityPool)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String IdentityPool
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateIdentityPool

instance Prelude.NFData CreateIdentityPool

instance Core.ToHeaders CreateIdentityPool where
  toHeaders :: CreateIdentityPool -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateIdentityPool -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityService.CreateIdentityPool" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateIdentityPool where
  toJSON :: CreateIdentityPool -> Value
toJSON CreateIdentityPool' {Bool
Maybe Bool
Maybe [Text]
Maybe [CognitoIdentityProvider]
Maybe Text
Maybe (HashMap Text Text)
Text
allowUnauthenticatedIdentities :: Bool
identityPoolName :: 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:CreateIdentityPool' :: CreateIdentityPool -> Bool
$sel:identityPoolName:CreateIdentityPool' :: CreateIdentityPool -> Text
$sel:cognitoIdentityProviders:CreateIdentityPool' :: CreateIdentityPool -> Maybe [CognitoIdentityProvider]
$sel:openIdConnectProviderARNs:CreateIdentityPool' :: CreateIdentityPool -> Maybe [Text]
$sel:identityPoolTags:CreateIdentityPool' :: CreateIdentityPool -> Maybe (HashMap Text Text)
$sel:developerProviderName:CreateIdentityPool' :: CreateIdentityPool -> Maybe Text
$sel:allowClassicFlow:CreateIdentityPool' :: CreateIdentityPool -> Maybe Bool
$sel:supportedLoginProviders:CreateIdentityPool' :: CreateIdentityPool -> Maybe (HashMap Text Text)
$sel:samlProviderARNs:CreateIdentityPool' :: CreateIdentityPool -> 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
"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
              )
          ]
      )

instance Core.ToPath CreateIdentityPool where
  toPath :: CreateIdentityPool -> ByteString
toPath = ByteString -> CreateIdentityPool -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateIdentityPool where
  toQuery :: CreateIdentityPool -> QueryString
toQuery = QueryString -> CreateIdentityPool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty